RemoteAgens .NET Windows Phone implementation
authorGustavo Martin <gu.martinm@gmail.com>
Sun, 23 Feb 2014 20:39:18 +0000 (21:39 +0100)
committerGustavo Martin <gu.martinm@gmail.com>
Sun, 23 Feb 2014 20:39:18 +0000 (21:39 +0100)
24 files changed:
WindowsPhone/RemoteAgents/RemoteAgents.sln [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/App.xaml [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/App.xaml.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Assets/AlignmentGrid.png [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Assets/ApplicationIcon.png [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileLarge.png [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileMedium.png [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileSmall.png [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileMediumLarge.png [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileSmall.png [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/LocalizedStrings.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Model/CallRemoteProcedure.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Properties/AppManifest.xml [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Properties/AssemblyInfo.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Properties/WMAppManifest.xml [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/RemoteAgents.csproj [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.Designer.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.en-US.resx [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.resx [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/View/View.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/ViewModel/ViewModel.cs [new file with mode: 0644]
WindowsPhone/RemoteAgents/RemoteAgents/packages.config [new file with mode: 0644]

diff --git a/WindowsPhone/RemoteAgents/RemoteAgents.sln b/WindowsPhone/RemoteAgents/RemoteAgents.sln
new file mode 100644 (file)
index 0000000..1d0a861
--- /dev/null
@@ -0,0 +1,40 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+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
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Any CPU = Debug|Any CPU
+               Debug|ARM = Debug|ARM
+               Debug|x86 = Debug|x86
+               Release|Any CPU = Release|Any CPU
+               Release|ARM = Release|ARM
+               Release|x86 = Release|x86
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|ARM.ActiveCfg = Debug|ARM
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|ARM.Build.0 = Debug|ARM
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|ARM.Deploy.0 = Debug|ARM
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|x86.ActiveCfg = Debug|x86
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|x86.Build.0 = Debug|x86
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Debug|x86.Deploy.0 = Debug|x86
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|Any CPU.Build.0 = Release|Any CPU
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|Any CPU.Deploy.0 = Release|Any CPU
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|ARM.ActiveCfg = Release|ARM
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|ARM.Build.0 = Release|ARM
+               {C11B661C-3470-4542-83A7-939674DB2BD2}.Release|ARM.Deploy.0 = Release|ARM
+               {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
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/App.xaml b/WindowsPhone/RemoteAgents/RemoteAgents/App.xaml
new file mode 100644 (file)
index 0000000..f2681b6
--- /dev/null
@@ -0,0 +1,20 @@
+<Application
+    x:Class="RemoteAgents.App"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
+    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
+
+    <!--Recursos de la aplicación-->
+    <Application.Resources>
+        <local:LocalizedStrings xmlns:local="clr-namespace:RemoteAgents" x:Key="LocalizedStrings"/>
+    </Application.Resources>
+
+    <Application.ApplicationLifetimeObjects>
+        <!--Objeto requerido que controla los eventos de duración de la aplicación-->
+        <shell:PhoneApplicationService
+            Launching="Application_Launching" Closing="Application_Closing"
+            Activated="Application_Activated" Deactivated="Application_Deactivated"/>
+    </Application.ApplicationLifetimeObjects>
+
+</Application>
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/App.xaml.cs b/WindowsPhone/RemoteAgents/RemoteAgents/App.xaml.cs
new file mode 100644 (file)
index 0000000..5453f1e
--- /dev/null
@@ -0,0 +1,223 @@
+using System;
+using System.Diagnostics;
+using System.Resources;
+using System.Windows;
+using System.Windows.Markup;
+using System.Windows.Navigation;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+using Example.RemoteAgents.WindowsPhone.Resources;
+
+namespace RemoteAgents
+{
+    public partial class App : Application
+    {
+        /// <summary>
+        /// Proporcionar acceso sencillo al marco raíz de la aplicación telefónica.
+        /// </summary>
+        /// <returns>Marco raíz de la aplicación telefónica.</returns>
+        public static PhoneApplicationFrame RootFrame { get; private set; }
+
+        /// <summary>
+        /// Constructor para el objeto Application.
+        /// </summary>
+        public App()
+        {
+            // Controlador global para excepciones no detectadas.
+            UnhandledException += Application_UnhandledException;
+
+            // Inicialización XAML estándar
+            InitializeComponent();
+
+            // Inicialización especifica del teléfono
+            InitializePhoneApplication();
+
+            // Inicialización del idioma
+            InitializeLanguage();
+
+            // Mostrar información de generación de perfiles gráfica durante la depuración.
+            if (Debugger.IsAttached)
+            {
+                // Mostrar los contadores de velocidad de marcos actual.
+                Application.Current.Host.Settings.EnableFrameRateCounter = true;
+
+                // Mostrar las áreas de la aplicación que se están volviendo a dibujar en cada marco.
+                //Application.Current.Host.Settings.EnableRedrawRegions = true;
+
+                // Habilitar el modo de visualización de análisis de no producción,
+                // que muestra áreas de una página que se entregan a la GPU con una superposición coloreada.
+                //Application.Current.Host.Settings.EnableCacheVisualization = true;
+
+                // Impedir que la pantalla se apague mientras se realiza la depuración deshabilitando
+                // la detección de inactividad de la aplicación.
+                // Precaución: solo debe usarse en modo de depuración. Las aplicaciones que deshabiliten la detección de inactividad del usuario seguirán en ejecución
+                // y consumirán energía de la batería cuando el usuario no esté usando el teléfono.
+                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
+            }
+
+        }
+
+        // Código para ejecutar cuando la aplicación se inicia (p.ej. a partir de Inicio)
+        // Este código no se ejecutará cuando la aplicación se reactive
+        private void Application_Launching(object sender, LaunchingEventArgs e)
+        {
+        }
+
+        // Código para ejecutar cuando la aplicación se activa (se trae a primer plano)
+        // Este código no se ejecutará cuando la aplicación se inicie por primera vez
+        private void Application_Activated(object sender, ActivatedEventArgs e)
+        {
+        }
+
+        // Código para ejecutar cuando la aplicación se desactiva (se envía a segundo plano)
+        // Este código no se ejecutará cuando la aplicación se cierre
+        private void Application_Deactivated(object sender, DeactivatedEventArgs e)
+        {
+        }
+
+        // Código para ejecutar cuando la aplicación se cierra (p.ej., al hacer clic en Atrás)
+        // Este código no se ejecutará cuando la aplicación se desactive
+        private void Application_Closing(object sender, ClosingEventArgs e)
+        {
+        }
+
+        // Código para ejecutar si hay un error de navegación
+        private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
+        {
+            if (Debugger.IsAttached)
+            {
+                // Ha habido un error de navegación; interrumpir el depurador
+                Debugger.Break();
+            }
+        }
+
+        // Código para ejecutar en excepciones no controladas
+        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+        {
+            if (Debugger.IsAttached)
+            {
+                // Se ha producido una excepción no controlada; interrumpir el depurador
+                Debugger.Break();
+            }
+        }
+
+        #region Inicialización de la aplicación telefónica
+
+        // Evitar inicialización doble
+        private bool phoneApplicationInitialized = false;
+
+        // No agregar ningún código adicional a este método
+        private void InitializePhoneApplication()
+        {
+            if (phoneApplicationInitialized)
+                return;
+
+            // Crear el marco pero no establecerlo como RootVisual todavía; esto permite que
+            // la pantalla de presentación permanezca activa hasta que la aplicación esté lista para la presentación.
+            RootFrame = new PhoneApplicationFrame();
+            RootFrame.Navigated += CompleteInitializePhoneApplication;
+
+            // Controlar errores de navegación
+            RootFrame.NavigationFailed += RootFrame_NavigationFailed;
+
+            // Controlar solicitudes de restablecimiento para borrar la pila de retroceso
+            RootFrame.Navigated += CheckForResetNavigation;
+
+            // Asegurarse de que no volvemos a inicializar
+            phoneApplicationInitialized = true;
+        }
+
+        // No agregar ningún código adicional a este método
+        private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
+        {
+            // Establecer el objeto visual raíz para permitir que la aplicación se presente
+            if (RootVisual != RootFrame)
+                RootVisual = RootFrame;
+
+            // Quitar este controlador porque ya no es necesario
+            RootFrame.Navigated -= CompleteInitializePhoneApplication;
+        }
+
+        private void CheckForResetNavigation(object sender, NavigationEventArgs e)
+        {
+            // Si la aplicación ha recibido una navegación 'reset', tenemos que comprobarlo
+            // en la siguiente navegación para ver si se debe restablecer la pila de páginas
+            if (e.NavigationMode == NavigationMode.Reset)
+                RootFrame.Navigated += ClearBackStackAfterReset;
+        }
+
+        private void ClearBackStackAfterReset(object sender, NavigationEventArgs e)
+        {
+            // Anular registro del evento para que no se vuelva a llamar
+            RootFrame.Navigated -= ClearBackStackAfterReset;
+
+            // Borrar solo la pila de navegaciones 'new' (hacia delante) y 'refresh'
+            if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh)
+                return;
+
+            // Por coherencia de la IU, borrar toda la pila de páginas
+            while (RootFrame.RemoveBackEntry() != null)
+            {
+                ; // no hacer nada
+            }
+        }
+
+        #endregion
+
+        // Inicializar la fuente y la dirección de flujo de la aplicación según se define en sus cadenas de recursos traducidas.
+        //
+        // Para asegurarse de que la fuente de la aplicación está alineada con sus idiomas admitidos y que
+        // FlowDirection para todos esos idiomas sigue su dirección tradicional, ResourceLanguage
+        // y ResourceFlowDirection se debe inicializar en cada archivo resx para que estos valores coincidan con ese
+        // referencia cultural del archivo. Por ejemplo:
+        //
+        // AppResources.es-ES.resx
+        //    El valor de ResourceLanguage debe ser "es-ES"
+        //    El valor de ResourceFlowDirection debe ser "LeftToRight"
+        //
+        // AppResources.ar-SA.resx
+        //     El valor de ResourceLanguage debe ser "ar-SA"
+        //     El valor de ResourceFlowDirection debe ser "RightToLeft"
+        //
+        // Para obtener más información sobre cómo traducir aplicaciones para Windows Phone, consulte http://go.microsoft.com/fwlink/?LinkId=262072.
+        //
+        private void InitializeLanguage()
+        {
+            try
+            {
+                // Establecer la fuente para que coincida con el idioma definido por
+                // Cadena de recursos ResourceLanguage para cada idioma admitido.
+                //
+                // Recurrir a la fuente del idioma neutro si el idioma
+                // del teléfono no se admite.
+                //
+                // Si se produce un error del compilador, falta ResourceLanguage
+                // el archivo de recursos.
+                RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage);
+
+                // Establecer FlowDirection de todos los elementos del marco raíz según
+                // en la cadena de recursos ResourceFlowDirection para cada
+                // idioma admitido.
+                //
+                // Si se produce un error del compilador, falta ResourceFlowDirection
+                // el archivo de recursos.
+                FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection);
+                RootFrame.FlowDirection = flow;
+            }
+            catch
+            {
+                // Si se detecta aquí una excepción, lo más probable es que se deba a
+                // ResourceLanguage no se ha establecido correctamente en un idioma admitido
+                // o ResourceFlowDirection se ha establecido en un valor distinto de LeftToRight
+                // o RightToLeft.
+
+                if (Debugger.IsAttached)
+                {
+                    Debugger.Break();
+                }
+
+                throw;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Assets/AlignmentGrid.png b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/AlignmentGrid.png
new file mode 100644 (file)
index 0000000..f7d2e97
Binary files /dev/null and b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/AlignmentGrid.png differ
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Assets/ApplicationIcon.png b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/ApplicationIcon.png
new file mode 100644 (file)
index 0000000..7d95d4e
Binary files /dev/null and b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/ApplicationIcon.png differ
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileLarge.png b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileLarge.png
new file mode 100644 (file)
index 0000000..e0c59ac
Binary files /dev/null and b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileLarge.png differ
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileMedium.png b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileMedium.png
new file mode 100644 (file)
index 0000000..e93b89d
Binary files /dev/null and b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileMedium.png differ
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileSmall.png b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileSmall.png
new file mode 100644 (file)
index 0000000..550b1b5
Binary files /dev/null and b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/FlipCycleTileSmall.png differ
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileMediumLarge.png b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileMediumLarge.png
new file mode 100644 (file)
index 0000000..686e6b5
Binary files /dev/null and b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileMediumLarge.png differ
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileSmall.png b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileSmall.png
new file mode 100644 (file)
index 0000000..d4b5ede
Binary files /dev/null and b/WindowsPhone/RemoteAgents/RemoteAgents/Assets/Tiles/IconicTileSmall.png differ
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/LocalizedStrings.cs b/WindowsPhone/RemoteAgents/RemoteAgents/LocalizedStrings.cs
new file mode 100644 (file)
index 0000000..e9c2ec8
--- /dev/null
@@ -0,0 +1,14 @@
+using Example.RemoteAgents.WindowsPhone.Resources;
+
+namespace RemoteAgents
+{
+    /// <summary>
+    /// Proporciona acceso a los recursos de cadena.
+    /// </summary>
+    public class LocalizedStrings
+    {
+        private static AppResources _localizedResources = new AppResources();
+
+        public AppResources LocalizedResources { get { return _localizedResources; } }
+    }
+}
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml b/WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml
new file mode 100644 (file)
index 0000000..e0d53d1
--- /dev/null
@@ -0,0 +1,64 @@
+<phone:PhoneApplicationPage
+    x:Class="RemoteAgents.MainPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
+    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d"
+    FontFamily="{StaticResource PhoneFontFamilyNormal}"
+    FontSize="{StaticResource PhoneFontSizeNormal}"
+    Foreground="{StaticResource PhoneForegroundBrush}"
+    SupportedOrientations="Portrait" Orientation="Portrait"
+    shell:SystemTray.IsVisible="True">
+
+    <!--LayoutRoot es la cuadrícula raíz donde se coloca todo el contenido de la página-->
+    <Grid x:Name="LayoutRoot" Background="Transparent">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+
+        <!-- NOTA PARA LA TRADUCCIÓN:
+            Para traducir las cadenas mostradas, copia sus valores a las claves con el nombre
+            correspondiente en el archivo de recursos del idioma neutro (AppResources.resx) de la aplicación y
+            reemplaza el valor de texto codificado de forma rígida entre las comillas de los atributos
+            con la cláusula de enlace cuya ruta de acceso apunte a ese nombre de cadena.
+
+            Por ejemplo:
+
+                Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}"
+
+            Este enlace apunta al recurso de cadena de la plantilla denominado "ApplicationTitle".
+
+            Al agregar idiomas admitidos en la pestaña Propiedades del proyecto se creará un
+            nuevo archivo resx por idioma que puede contener los valores traducidos de las
+            cadenas de la interfaz de usuario. El enlace de estos ejemplos hará que el valor de los atributos
+            se tome del archivo .resx correspondiente al valor de
+            CurrentUICulture de la aplicación en tiempo de ejecución.
+         -->
+
+        <!--TitlePanel contiene el nombre de la aplicación y el título de la página-->
+        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
+            <TextBlock Text="{Binding LocalizedResources.ApplicationTitle, Mode=OneWay, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
+            <TextBlock Text="{Binding LocalizedResources.ApplicationName, Mode=OneWay, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
+        </StackPanel>
+
+        <!--ContentPanel. Colocar aquí el contenido adicional-->
+        <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" Click="ButtonRetrieveRemoteData_Click"/>
+
+        </Grid>
+
+        <!--Quitar la marca de comentarios para ver una cuadrícula de alineación que
+            ayuda a comprobar que los controles están alineados en los límites normales.  La imagen tiene un margen superior de -32px para
+            tener en cuenta la bandeja del sistema. Establécelo en 0 (o quite el margen)
+            si la bandeja del sistema está oculta.
+
+            Antes de enviarla, quita este código XAML y la propia imagen.-->
+        <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
+    </Grid>
+
+</phone:PhoneApplicationPage>
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml.cs b/WindowsPhone/RemoteAgents/RemoteAgents/MainPage.xaml.cs
new file mode 100644 (file)
index 0000000..8705bb9
--- /dev/null
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Navigation;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+using Example.RemoteAgents.WindowsPhone.Resources;
+using RemoteAgents.WindowsPhone.View;
+
+namespace RemoteAgents
+{
+    public partial class MainPage : PhoneApplicationPage
+    {
+        private readonly ViewImpl view;
+
+        // Constructor
+        public MainPage()
+        {
+            view = new ViewImpl();
+
+            InitializeComponent();
+
+            this.registerEvents();
+            // Código de ejemplo para traducir ApplicationBar
+            //BuildLocalizedApplicationBar();
+        }
+
+        async private void ButtonRetrieveRemoteData_Click(object sender, RoutedEventArgs e)
+        {
+            string currentDate = await view.getCurrentDate();
+            if (currentDate != null)
+            {
+                this.CurrentDateTextBox.Text = currentDate;
+            }
+        }
+
+        private void registerEvents ()
+        {
+            this.ButtonRetrieveRemoteData.Click += ButtonRetrieveRemoteData_Click;
+        }
+
+        // Código de ejemplo para compilar una ApplicationBar traducida
+        //private void BuildLocalizedApplicationBar()
+        //{
+        //    // Establecer ApplicationBar de la página en una nueva instancia de ApplicationBar.
+        //    ApplicationBar = new ApplicationBar();
+
+        //    // Crear un nuevo botón y establecer el valor de texto en la cadena traducida de AppResources.
+        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
+        //    appBarButton.Text = AppResources.AppBarButtonText;
+        //    ApplicationBar.Buttons.Add(appBarButton);
+
+        //    // Crear un nuevo elemento de menú con la cadena traducida de AppResources.
+        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
+        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
+        //}
+    }
+}
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Model/CallRemoteProcedure.cs b/WindowsPhone/RemoteAgents/RemoteAgents/Model/CallRemoteProcedure.cs
new file mode 100644 (file)
index 0000000..b63e5c3
--- /dev/null
@@ -0,0 +1,78 @@
+using Newtonsoft.Json;
+using System.Net;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RemoteAgents.WindowsPhone.Model
+{
+    public class CallRemoteProcedure
+    {
+
+        async public Task<TResult> callRemoteService<TResult>(string uri, string method)
+        {
+            var postData = new POST();
+            postData.id = "2114567586433855105";
+            postData.jsonrpc = "2.0";
+            postData.method = method;
+
+            string data = JsonConvert.SerializeObject(postData);
+            HttpContent content = new StringContent(data, System.Text.Encoding.UTF8, "application/json-rpc");
+
+            // TODO: find out why HttpClient is sendig two times the same POST. Is there something wrong with the .NET implementation?
+            // At least it is doing that, when error response from web server.
+            HttpResponseMessage response = await this.doCall(uri, content);
+
+            TResult result = default(TResult);
+
+            if (response.StatusCode == HttpStatusCode.OK)
+            {
+                Task<byte[]> responseBytes = response.Content.ReadAsByteArrayAsync();
+                string responseString = Encoding.UTF8.GetString(responseBytes.Result, 0, responseBytes.Result.Length);
+                POSTResult<TResult> postResult = JsonConvert.DeserializeObject<POSTResult<TResult>>(responseString);
+                result = postResult.result;
+            }
+
+            return result;
+        }
+
+
+        async private Task<HttpResponseMessage> doCall(string uri, HttpContent content)
+        {
+            using (HttpClient client = new HttpClient())
+            {
+                return await client.PostAsync(uri, content);
+            }
+        }
+
+        private class POST
+        {
+            public string id { get; set; }
+            public string jsonrpc { get; set; }
+            public string method { get; set; }
+        }
+
+
+        private class POSTResult<TResult>
+        {
+            public string id { get; set; }
+            public string jsonrpc { get; set; }
+            public TResult result { get; set; }
+        }
+
+        // TODO: When error I receive from JSONRPC: {"jsonrpc":"2.0","id":"null","error":{"code":-32600,"message":"Invalid Request"}}
+        private class Error
+        {
+            public int code { get; set; }
+            public string message { get; set; }
+        }
+
+        private class ERRORResult
+        {
+            public string jsonrpc { get; set; }
+            public string id { get; set; }
+            public Error error { get; set; }
+        }
+    }
+
+}
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Properties/AppManifest.xml b/WindowsPhone/RemoteAgents/RemoteAgents/Properties/AppManifest.xml
new file mode 100644 (file)
index 0000000..3b998eb
--- /dev/null
@@ -0,0 +1,4 @@
+<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    <Deployment.Parts>
+    </Deployment.Parts>
+</Deployment>
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Properties/AssemblyInfo.cs b/WindowsPhone/RemoteAgents/RemoteAgents/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..b3eafc0
--- /dev/null
@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Resources;
+
+// La información general de un ensamblado se controla mediante el siguiente 
+// conjunto de atributos. Cambie los valores de estos atributos para modificar la información
+// asociada a un ensamblado.
+[assembly: AssemblyTitle("RemoteAgents")]
+[assembly: AssemblyDescription("Little program to connect with remote applications through JSON API")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("gumartinm.name")]
+[assembly: AssemblyProduct("RemoteAgents")]
+[assembly: AssemblyCopyright("Gustavo Martin Morcuende ©  2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Si ComVisible se establece en False, los componentes COM no verán los 
+// tipos de este ensamblado.  Si necesita obtener acceso a un tipo de este ensamblado desde 
+// COM, establezca el atributo ComVisible en True en este tipo.
+[assembly: ComVisible(false)]
+
+// El siguiente GUID sirve como identificador de typelib si este proyecto se expone a COM
+[assembly: Guid("49e577e0-1571-4598-a428-522438fa6a16")]
+
+// La información de versión de un ensamblado consta de los cuatro valores siguientes:
+//
+//      Versión principal
+//      Versión secundaria 
+//      Número de compilación
+//      Revisión
+//
+// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y revisión 
+// mediante el carácter '*', como se muestra a continuación:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: NeutralResourcesLanguageAttribute("es-ES")]
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Properties/WMAppManifest.xml b/WindowsPhone/RemoteAgents/RemoteAgents/Properties/WMAppManifest.xml
new file mode 100644 (file)
index 0000000..acb6a52
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
+  <DefaultLanguage xmlns="" code="es-ES" />
+  <Languages xmlns="">
+    <Language code="en-US" />
+  </Languages>
+  <App xmlns="" ProductID="{c11b661c-3470-4542-83a7-939674db2bd2}" Title="RemoteAgents" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="RemoteAgents author" Description="Sample description" Publisher="RemoteAgents" PublisherID="{911c4cb8-4dfc-4145-93c3-f2723d77b481}">
+    <IconPath IsRelative="true" IsResource="false">Assets\ApplicationIcon.png</IconPath>
+    <Capabilities>
+      <Capability Name="ID_CAP_NETWORKING" />
+      <Capability Name="ID_CAP_MEDIALIB_AUDIO" />
+      <Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
+      <Capability Name="ID_CAP_SENSORS" />
+      <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
+    </Capabilities>
+    <Tasks>
+      <DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
+    </Tasks>
+    <Tokens>
+      <PrimaryToken TokenID="RemoteAgentsToken" TaskName="_default">
+        <TemplateFlip>
+          <SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileSmall.png</SmallImageURI>
+          <Count>0</Count>
+          <BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI>
+          <Title>RemoteAgents</Title>
+          <BackContent></BackContent>
+          <BackBackgroundImageURI></BackBackgroundImageURI>
+          <BackTitle></BackTitle>
+          <DeviceLockImageURI></DeviceLockImageURI>
+          <HasLarge></HasLarge>
+        </TemplateFlip>
+      </PrimaryToken>
+    </Tokens>
+    <ScreenResolutions>
+      <ScreenResolution Name="ID_RESOLUTION_WVGA" />
+      <ScreenResolution Name="ID_RESOLUTION_WXGA" />
+      <ScreenResolution Name="ID_RESOLUTION_HD720P" />
+    </ScreenResolutions>
+  </App>
+</Deployment>
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/RemoteAgents.csproj b/WindowsPhone/RemoteAgents/RemoteAgents/RemoteAgents.csproj
new file mode 100644 (file)
index 0000000..e19be1e
--- /dev/null
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>10.0.20506</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{C11B661C-3470-4542-83A7-939674DB2BD2}</ProjectGuid>
+    <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Example.RemoteAgents.WindowsPhone</RootNamespace>
+    <AssemblyName>RemoteAgents</AssemblyName>
+    <TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
+    <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
+    <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+    <SilverlightApplication>true</SilverlightApplication>
+    <SupportedCultures>en-US</SupportedCultures>
+    <XapOutputs>true</XapOutputs>
+    <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
+    <XapFilename>RemoteAgents_$(Configuration)_$(Platform).xap</XapFilename>
+    <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
+    <SilverlightAppEntry>RemoteAgents.App</SilverlightAppEntry>
+    <ValidateXaml>true</ValidateXaml>
+    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
+    <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Bin\Release</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Bin\x86\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Bin\x86\Release</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Bin\ARM\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Bin\ARM\Release</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="LocalizedStrings.cs" />
+    <Compile Include="MainPage.xaml.cs">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Model\CallRemoteProcedure.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Resources\AppResources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>AppResources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="ViewModel\ViewModel.cs" />
+    <Compile Include="View\View.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </ApplicationDefinition>
+    <Page Include="MainPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+    <None Include="Properties\AppManifest.xml" />
+    <None Include="Properties\WMAppManifest.xml">
+      <SubType>Designer</SubType>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Assets\AlignmentGrid.png" />
+    <Content Include="Assets\ApplicationIcon.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Assets\Tiles\FlipCycleTileLarge.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Assets\Tiles\FlipCycleTileMedium.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Assets\Tiles\FlipCycleTileSmall.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Assets\Tiles\IconicTileMediumLarge.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Assets\Tiles\IconicTileSmall.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Resources\AppResources.en-US.resx" />
+    <EmbeddedResource Include="Resources\AppResources.resx">
+      <Generator>PublicResXFileCodeGenerator</Generator>
+      <LastGenOutput>AppResources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http">
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Extensions">
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Primitives">
+      <HintPath>..\packages\Microsoft.Net.Http.2.2.18\lib\sl4-windowsphone71\System.Net.Http.Primitives.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <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.
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <ProjectExtensions />
+  <Import Project="..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" />
+  <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
+    <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
+    <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
+  </Target>
+</Project>
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.Designer.cs b/WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.Designer.cs
new file mode 100644 (file)
index 0000000..c7be4e4
--- /dev/null
@@ -0,0 +1,126 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Este código fue generado por una herramienta.
+//     Versión de runtime:4.0.30319.34011
+//
+//     Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
+//     se vuelve a generar el código.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Example.RemoteAgents.WindowsPhone.Resources {
+    using System;
+    
+    
+    /// <summary>
+    ///   Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
+    /// </summary>
+    // StronglyTypedResourceBuilder generó automáticamente esta clase
+    // a través de una herramienta como ResGen o Visual Studio.
+    // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen
+    // con la opción /str o recompile su proyecto de VS.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    public class AppResources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal AppResources() {
+        }
+        
+        /// <summary>
+        ///   Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        public static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Example.RemoteAgents.WindowsPhone.Resources.AppResources", typeof(AppResources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las
+        ///   búsquedas de recursos mediante esta clase de recurso fuertemente tipado.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        public static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a agregar.
+        /// </summary>
+        public static string AppBarButtonText {
+            get {
+                return ResourceManager.GetString("AppBarButtonText", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a Elemento de menú.
+        /// </summary>
+        public static string AppBarMenuItemText {
+            get {
+                return ResourceManager.GetString("AppBarMenuItemText", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a Remote Agent.
+        /// </summary>
+        public static string ApplicationName {
+            get {
+                return ResourceManager.GetString("ApplicationName", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a Remote Agents.
+        /// </summary>
+        public static string ApplicationTitle {
+            get {
+                return ResourceManager.GetString("ApplicationTitle", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a GetData.
+        /// </summary>
+        public static string ButtonRetrieveRemoteData {
+            get {
+                return ResourceManager.GetString("ButtonRetrieveRemoteData", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a LeftToRight.
+        /// </summary>
+        public static string ResourceFlowDirection {
+            get {
+                return ResourceManager.GetString("ResourceFlowDirection", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Busca una cadena traducida similar a es-ES.
+        /// </summary>
+        public static string ResourceLanguage {
+            get {
+                return ResourceManager.GetString("ResourceLanguage", resourceCulture);
+            }
+        }
+    }
+}
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.en-US.resx b/WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.en-US.resx
new file mode 100644 (file)
index 0000000..67e4e49
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="ResourceFlowDirection" xml:space="preserve">
+    <value>LeftToRight</value>
+    <comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment>
+  </data>
+  <data name="ResourceLanguage" xml:space="preserve">
+    <value>en-US</value>
+    <comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment>
+  </data>
+  <data name="ApplicationTitle" xml:space="preserve">
+    <value>Remote Agents</value>
+  </data>
+  <data name="AppBarButtonText" xml:space="preserve">
+    <value>agregar</value>
+  </data>
+  <data name="AppBarMenuItemText" xml:space="preserve">
+    <value>Elemento de menú</value>
+  </data>
+  <data name="ApplicationName" xml:space="preserve">
+    <value>Remote Agent</value>
+  </data>
+  <data name="ButtonRetrieveRemoteData" xml:space="preserve">
+    <value>GetData</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.resx b/WindowsPhone/RemoteAgents/RemoteAgents/Resources/AppResources.resx
new file mode 100644 (file)
index 0000000..f5b28d5
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="ResourceFlowDirection" xml:space="preserve">
+    <value>LeftToRight</value>
+    <comment>Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language</comment>
+  </data>
+  <data name="ResourceLanguage" xml:space="preserve">
+    <value>es-ES</value>
+    <comment>Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language.</comment>
+  </data>
+  <data name="ApplicationTitle" xml:space="preserve">
+    <value>Remote Agents</value>
+  </data>
+  <data name="AppBarButtonText" xml:space="preserve">
+    <value>agregar</value>
+  </data>
+  <data name="AppBarMenuItemText" xml:space="preserve">
+    <value>Elemento de menú</value>
+  </data>
+  <data name="ApplicationName" xml:space="preserve">
+    <value>Remote Agent</value>
+  </data>
+  <data name="ButtonRetrieveRemoteData" xml:space="preserve">
+    <value>GetData</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/View/View.cs b/WindowsPhone/RemoteAgents/RemoteAgents/View/View.cs
new file mode 100644 (file)
index 0000000..92c1324
--- /dev/null
@@ -0,0 +1,15 @@
+using RemoteAgents.WindowsPhone.ViewModel;
+using System.Threading.Tasks;
+
+namespace RemoteAgents.WindowsPhone.View
+{
+    public class ViewImpl
+    {
+        private static readonly ViewModelImpl vm = new ViewModelImpl();
+
+        async public Task<string> getCurrentDate()
+        {
+            return await vm.getCurrentDate();
+        }
+    }
+}
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/ViewModel/ViewModel.cs b/WindowsPhone/RemoteAgents/RemoteAgents/ViewModel/ViewModel.cs
new file mode 100644 (file)
index 0000000..7e52b6d
--- /dev/null
@@ -0,0 +1,16 @@
+using RemoteAgents.WindowsPhone.Model;
+using System.Threading.Tasks;
+
+namespace RemoteAgents.WindowsPhone.ViewModel
+{
+    public class ViewModelImpl
+    {
+        private static readonly string uri = "http://gumartinm.name/spring-mainapp/CurrentDateService.json";
+        private readonly CallRemoteProcedure remoteProcedure = new CallRemoteProcedure();
+
+        async public Task<string> getCurrentDate()
+        {
+            return await remoteProcedure.callRemoteService<string>(uri, "getCurrentDate");
+        }
+    }
+}
diff --git a/WindowsPhone/RemoteAgents/RemoteAgents/packages.config b/WindowsPhone/RemoteAgents/RemoteAgents/packages.config
new file mode 100644 (file)
index 0000000..8d09569
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Microsoft.Bcl" version="1.1.3" targetFramework="wp80" />
+  <package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="wp80" />
+  <package id="Microsoft.Net.Http" version="2.2.18" targetFramework="wp80" />
+  <package id="Newtonsoft.Json" version="6.0.1" targetFramework="wp80" />
+</packages>
\ No newline at end of file