No time for comments.
authorGustavo Martin <gu.martinm@gmail.com>
Sun, 9 Mar 2014 19:08:17 +0000 (20:08 +0100)
committerGustavo Martin <gu.martinm@gmail.com>
Sun, 9 Mar 2014 19:08:17 +0000 (20:08 +0100)
WindowsPhone/RemoteAgents/RemoteAgents.sln
WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml
WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml.cs
WindowsPhone/RemoteAgents/RemoteAgents/RemoteAgents.csproj
WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.Designer.cs
WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.en-US.resx
WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.resx
WindowsPhone/RemoteAgents/RemoteAgents/View/View.cs
WindowsPhone/RemoteAgents/RemoteAgents/ViewModel/ViewModel.cs

index 1d0a861..087e84b 100644 (file)
@@ -5,6 +5,8 @@ VisualStudioVersion = 12.0.30110.0
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteAgents", "RemoteAgents\RemoteAgents.csproj", "{C11B661C-3470-4542-83A7-939674DB2BD2}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jsonrpc4net.WindowsPhone8", "..\..\jsonrpc4net\jsonrpc4net\jsonrpc4net.WindowsPhone8.csproj", "{9FC57CC3-23D0-486B-A3E4-92C547561949}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,18 @@ Global
                {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|x86.ActiveCfg = Release|x86
                {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|x86.Build.0 = Release|x86
                {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|x86.Deploy.0 = Release|x86
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Debug|ARM.ActiveCfg = Debug|ARM
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Debug|ARM.Build.0 = Debug|ARM
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Debug|x86.ActiveCfg = Debug|x86
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Debug|x86.Build.0 = Debug|x86
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Release|Any CPU.Build.0 = Release|Any CPU
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Release|ARM.ActiveCfg = Release|ARM
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Release|ARM.Build.0 = Release|ARM
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Release|x86.ActiveCfg = Release|x86
+               {9FC57CC3-23D0-486B-A3E4-92C547561949}.Release|x86.Build.0 = Release|x86
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 4db3b90..57f0f33 100644 (file)
         <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
             <TextBox x:Name="CurrentDateTextBox" HorizontalAlignment="Left" Height="72" Margin="0,57,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="456" IsReadOnly="True" InputScope="Date"/>
             <Button x:Name="ButtonRetrieveRemoteData" Content="{Binding LocalizedResources.ButtonRetrieveRemoteData, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Margin="289,479,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.915,0.432"/>
+            <Button x:Name="ButtonSendRemoteData" Content="{Binding LocalizedResources.ButtonSendRemoteData, Mode=OneWay, Source={StaticResource LocalizedStrings}}" HorizontalAlignment="Left" Margin="29,479,0,0" VerticalAlignment="Top"/>
+            <TextBox x:Name="TextBoxSendText" HorizontalAlignment="Left" Height="182" Margin="10,236,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="251"/>
+            <TextBlock HorizontalAlignment="Left" Margin="29,192,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="29" Width="121" Text="{Binding LocalizedResources.TextBlockSendText, Mode=OneWay, Source={StaticResource LocalizedStrings}}">
+               <Run Text="Send Text"/>
+               <Run Text=":"/>
+               <LineBreak/>
+               <Run/>
+            </TextBlock>
+            <TextBlock HorizontalAlignment="Left" Margin="29,23,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="29" Width="121" Text="{Binding LocalizedResources.TextBlockRemoteDate, Mode=OneWay, Source={StaticResource LocalizedStrings}}">
+               <Run Text="Remote Date:"/>
+               <LineBreak/>
+               <Run/>
+            </TextBlock>
 
         </Grid>
 
index 8c692cc..76c967c 100644 (file)
@@ -42,13 +42,28 @@ namespace RemoteAgents
             }
             catch (Exception exception)
             {
-                _logger.Error("ButtonGetDateClicked. Message: {0}  Stacktrace: {1}", exception.Message, exception.StackTrace);
+                _logger.ErrorException("ButtonGetDateClicked error: ", exception);
+            }
+        }
+
+        async private void SendDataButtonClicked(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                int number = 666;
+                await _view.SetWriteTextAsync(this.TextBoxSendText.Text,
+                                              number);
+            }
+            catch (Exception exception)
+            {
+                _logger.ErrorException("SendDataButtonClicked error: ", exception);
             }
         }
 
         private void registerEvents ()
         {
             this.ButtonRetrieveRemoteData.Click += ButtonRetrieveRemoteData_Click;
+            this.ButtonSendRemoteData.Click += SendDataButtonClicked;
         }
 
         // Código de ejemplo para compilar una ApplicationBar traducida
index c81bd3b..80f6acc 100644 (file)
     </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
-    <Reference Include="jsonrpc4net, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\jsonrpc4net\jsonrpc4net\Bin\Debug\jsonrpc4net.dll</HintPath>
-    </Reference>
     <Reference Include="NLog">
       <HintPath>..\packages\NLog.2.1.0\lib\sl4-windowsphone71\NLog.dll</HintPath>
     </Reference>
   <ItemGroup>
     <Folder Include="Model\" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\jsonrpc4net\jsonrpc4net\jsonrpc4net.WindowsPhone8.csproj">
+      <Project>{9FC57CC3-23D0-486B-A3E4-92C547561949}</Project>
+      <Name>jsonrpc4net.WindowsPhone8</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
index c7be4e4..8c2adf9 100644 (file)
@@ -106,6 +106,15 @@ namespace Example.RemoteAgents.WindowsPhone.Resources {
         }
         
         /// <summary>
+        ///   Busca una cadena traducida similar a SendData.
+        /// </summary>
+        public static string ButtonSendRemoteData {
+            get {
+                return ResourceManager.GetString("ButtonSendRemoteData", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Busca una cadena traducida similar a LeftToRight.
         /// </summary>
         public static string ResourceFlowDirection {
@@ -122,5 +131,23 @@ namespace Example.RemoteAgents.WindowsPhone.Resources {
                 return ResourceManager.GetString("ResourceLanguage", resourceCulture);
             }
         }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a RemoteDate:.
+        /// </summary>
+        public static string TextBlockRemoteDate {
+            get {
+                return ResourceManager.GetString("TextBlockRemoteDate", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a SendText:.
+        /// </summary>
+        public static string TextBlockSendText {
+            get {
+                return ResourceManager.GetString("TextBlockSendText", resourceCulture);
+            }
+        }
     }
 }
index 67e4e49..55148b1 100644 (file)
   <data name="ButtonRetrieveRemoteData" xml:space="preserve">
     <value>GetData</value>
   </data>
+  <data name="ButtonSendRemoteData" xml:space="preserve">
+    <value>SendData</value>
+  </data>
 </root>
\ No newline at end of file
index f5b28d5..3faabb4 100644 (file)
   <data name="ButtonRetrieveRemoteData" xml:space="preserve">
     <value>GetData</value>
   </data>
+  <data name="ButtonSendRemoteData" xml:space="preserve">
+    <value>SendData</value>
+  </data>
+  <data name="TextBlockRemoteDate" xml:space="preserve">
+    <value>RemoteDate:</value>
+  </data>
+  <data name="TextBlockSendText" xml:space="preserve">
+    <value>SendText:</value>
+  </data>
 </root>
\ No newline at end of file
index b9e8ee3..72093b5 100644 (file)
@@ -11,5 +11,10 @@ namespace RemoteAgents.WindowsPhone.View
         {
             return await _vm.GetCurrentDateAsync();
         }
+
+        async public Task SetWriteTextAsync(params object[] parameters)
+        {
+            await _vm.SetWriteTextAsync(parameters);
+        }
     }
 }
index ae57902..6b49ab3 100644 (file)
@@ -6,11 +6,18 @@ namespace RemoteAgents.WindowsPhone.ViewModel
     public class ViewModelImpl
     {
         private static readonly string uri = "http://gumartinm.name/spring-mainapp/CurrentDateService.json";
-        private readonly JsonRpcHttpAsyncClient _remoteProcedure = new JsonRpcHttpAsyncClient();
+        private static readonly string uriSetWriteText = "http://gumartinm.name/spring-mainapp/WriteTextService.json";
+        private readonly JsonRpcHttpAsyncClient _remoteClient = new JsonRpcHttpAsyncClient();
 
         async public Task<string> GetCurrentDateAsync()
         {
-            return await _remoteProcedure.PostRemoteServiceAsync<string>(uri, "getCurrentDate");
+            return await _remoteClient.PostRemoteServiceAsync<string>(uri, "getCurrentDate");
         }
+
+        async public Task SetWriteTextAsync(params object[] parameters)
+        {
+            await _remoteClient.PostRemoteServiceAsync(uriSetWriteText, "setWriteText", parameters);
+        }
+
     }
 }