diff --git a/Microsoft.AspNet.SignalR.WindowsPhone.sln b/Microsoft.AspNet.SignalR.WindowsPhone.sln index 92386ce04c..9ed443c1e2 100644 --- a/Microsoft.AspNet.SignalR.WindowsPhone.sln +++ b/Microsoft.AspNet.SignalR.WindowsPhone.sln @@ -11,29 +11,38 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SignalR.Cl EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SignalR.Client.WP7.Sample", "samples\Microsoft.AspNet.SignalR.Client.WP7.Sample\Microsoft.AspNet.SignalR.Client.WP7.Sample.csproj", "{E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SignalR.Client.WP8", "src\Microsoft.AspNet.SignalR.Client.WP8\Microsoft.AspNet.SignalR.Client.WP8.csproj", "{12D04172-2A5A-420D-A29B-026DB62C3B72}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SignalR.Client.WP8.Sample", "samples\Microsoft.AspNet.SignalR.Client.WP8.Sample\Microsoft.AspNet.SignalR.Client.WP8.Sample.csproj", "{2117F295-6451-4447-A646-614B2D8352EF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM Debug|Mixed Platforms = Debug|Mixed Platforms Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM Release|Mixed Platforms = Release|Mixed Platforms Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Debug|ARM.ActiveCfg = Debug|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Debug|x86.ActiveCfg = Debug|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Release|Any CPU.Build.0 = Release|Any CPU + {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Release|ARM.ActiveCfg = Release|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Release|Mixed Platforms.Build.0 = Release|Any CPU {1B2BD09D-ECFF-427F-BA58-C59A01EE6A2C}.Release|x86.ActiveCfg = Release|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Debug|Any CPU.Build.0 = Debug|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Debug|ARM.ActiveCfg = Debug|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU @@ -41,10 +50,51 @@ Global {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|Any CPU.ActiveCfg = Release|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|Any CPU.Build.0 = Release|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|Any CPU.Deploy.0 = Release|Any CPU + {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|ARM.ActiveCfg = Release|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|Mixed Platforms.Build.0 = Release|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU {E059F6F3-E9D5-4113-AF2B-C2D19CE7FAFF}.Release|x86.ActiveCfg = Release|Any CPU + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|ARM.ActiveCfg = Debug|ARM + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|ARM.Build.0 = Debug|ARM + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|x86.ActiveCfg = Debug|x86 + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Debug|x86.Build.0 = Debug|x86 + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|Any CPU.Build.0 = Release|Any CPU + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|ARM.ActiveCfg = Release|ARM + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|ARM.Build.0 = Release|ARM + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|Mixed Platforms.Build.0 = Release|x86 + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|x86.ActiveCfg = Release|x86 + {12D04172-2A5A-420D-A29B-026DB62C3B72}.Release|x86.Build.0 = Release|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|ARM.ActiveCfg = Debug|ARM + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|ARM.Build.0 = Debug|ARM + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|ARM.Deploy.0 = Debug|ARM + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|Mixed Platforms.Deploy.0 = Debug|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|x86.ActiveCfg = Debug|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|x86.Build.0 = Debug|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Debug|x86.Deploy.0 = Debug|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2117F295-6451-4447-A646-614B2D8352EF}.Release|Any CPU.Build.0 = Release|Any CPU + {2117F295-6451-4447-A646-614B2D8352EF}.Release|Any CPU.Deploy.0 = Release|Any CPU + {2117F295-6451-4447-A646-614B2D8352EF}.Release|ARM.ActiveCfg = Release|ARM + {2117F295-6451-4447-A646-614B2D8352EF}.Release|ARM.Build.0 = Release|ARM + {2117F295-6451-4447-A646-614B2D8352EF}.Release|ARM.Deploy.0 = Release|ARM + {2117F295-6451-4447-A646-614B2D8352EF}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Release|Mixed Platforms.Build.0 = Release|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Release|Mixed Platforms.Deploy.0 = Release|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Release|x86.ActiveCfg = Release|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Release|x86.Build.0 = Release|x86 + {2117F295-6451-4447-A646-614B2D8352EF}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/lib/Newtonsoft.Json.dll b/lib/Newtonsoft.Json.dll new file mode 100644 index 0000000000..81f9c58b73 Binary files /dev/null and b/lib/Newtonsoft.Json.dll differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/App.xaml b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/App.xaml new file mode 100644 index 0000000000..73d42efed1 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/App.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/App.xaml.cs b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/App.xaml.cs new file mode 100644 index 0000000000..3201dbea4e --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/App.xaml.cs @@ -0,0 +1,187 @@ +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 Microsoft.AspNet.SignalR.Client.WP8.Sample.ViewModels; + +namespace Microsoft.AspNet.SignalR.Client.WP8.Sample +{ + public partial class App : Application + { + private static MainViewModel viewModel = null; + + /// + /// A static ViewModel used by the views to bind against. + /// + /// The MainViewModel object. + public static MainViewModel ViewModel + { + get + { + // Delay creation of the view model until necessary + if (viewModel == null) + viewModel = new MainViewModel(); + + return viewModel; + } + } + + /// + /// Provides easy access to the root frame of the Phone Application. + /// + /// The root frame of the Phone Application. + public static PhoneApplicationFrame RootFrame { get; private set; } + + /// + /// Constructor for the Application object. + /// + public App() + { + // Global handler for uncaught exceptions. + UnhandledException += Application_UnhandledException; + + // Standard XAML initialization + InitializeComponent(); + + // Phone-specific initialization + InitializePhoneApplication(); + + // Show graphics profiling information while debugging. + if (Debugger.IsAttached) + { + // Display the current frame rate counters. + Application.Current.Host.Settings.EnableFrameRateCounter = true; + + // Show the areas of the app that are being redrawn in each frame. + //Application.Current.Host.Settings.EnableRedrawRegions = true; + + // Enable non-production analysis visualization mode, + // which shows areas of a page that are handed off GPU with a colored overlay. + //Application.Current.Host.Settings.EnableCacheVisualization = true; + + // Prevent the screen from turning off while under the debugger by disabling + // the application's idle detection. + // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run + // and consume battery power when the user is not using the phone. + PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; + } + } + + // Code to execute when the application is launching (eg, from Start) + // This code will not execute when the application is reactivated + private void Application_Launching(object sender, LaunchingEventArgs e) + { + } + + // Code to execute when the application is activated (brought to foreground) + // This code will not execute when the application is first launched + private void Application_Activated(object sender, ActivatedEventArgs e) + { + // Ensure that application state is restored appropriately + //if (!App.ViewModel.IsDataLoaded) + //{ + // App.ViewModel.LoadData(); + //} + } + + // Code to execute when the application is deactivated (sent to background) + // This code will not execute when the application is closing + private void Application_Deactivated(object sender, DeactivatedEventArgs e) + { + // Ensure that required application state is persisted here. + } + + // Code to execute when the application is closing (eg, user hit Back) + // This code will not execute when the application is deactivated + private void Application_Closing(object sender, ClosingEventArgs e) + { + } + + // Code to execute if a navigation fails + private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) + { + if (Debugger.IsAttached) + { + // A navigation has failed; break into the debugger + Debugger.Break(); + } + } + + // Code to execute on Unhandled Exceptions + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + if (Debugger.IsAttached) + { + // An unhandled exception has occurred; break into the debugger + Debugger.Break(); + } + } + + #region Phone application initialization + + // Avoid double-initialization + private bool phoneApplicationInitialized = false; + + // Do not add any additional code to this method + private void InitializePhoneApplication() + { + if (phoneApplicationInitialized) + return; + + // Create the frame but don't set it as RootVisual yet; this allows the splash + // screen to remain active until the application is ready to render. + RootFrame = new PhoneApplicationFrame(); + RootFrame.Navigated += CompleteInitializePhoneApplication; + + // Handle navigation failures + RootFrame.NavigationFailed += RootFrame_NavigationFailed; + + // Handle reset requests for clearing the backstack + RootFrame.Navigated += CheckForResetNavigation; + + // Ensure we don't initialize again + phoneApplicationInitialized = true; + } + + // Do not add any additional code to this method + private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) + { + // Set the root visual to allow the application to render + if (RootVisual != RootFrame) + RootVisual = RootFrame; + + // Remove this handler since it is no longer needed + RootFrame.Navigated -= CompleteInitializePhoneApplication; + } + + private void CheckForResetNavigation(object sender, NavigationEventArgs e) + { + // If the app has received a 'reset' navigation, then we need to check + // on the next navigation to see if the page stack should be reset + if (e.NavigationMode == NavigationMode.Reset) + RootFrame.Navigated += ClearBackStackAfterReset; + } + + private void ClearBackStackAfterReset(object sender, NavigationEventArgs e) + { + // Unregister the event so it doesn't get called again + RootFrame.Navigated -= ClearBackStackAfterReset; + + // Only clear the stack for 'new' (forward) and 'refresh' navigations + if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh) + return; + + // For UI consistency, clear the entire page stack + while (RootFrame.RemoveBackEntry() != null) + { + ; // do nothing + } + } + + #endregion + } +} \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ApplicationIcon.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ApplicationIcon.png new file mode 100644 index 0000000000..5859393ca1 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ApplicationIcon.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/AlignmentGrid.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/AlignmentGrid.png new file mode 100644 index 0000000000..f7d2e97804 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/AlignmentGrid.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/ApplicationIcon.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/ApplicationIcon.png new file mode 100644 index 0000000000..7d95d4e081 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/ApplicationIcon.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileLarge.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileLarge.png new file mode 100644 index 0000000000..e0c59ac014 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileLarge.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileMedium.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileMedium.png new file mode 100644 index 0000000000..e93b89d600 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileMedium.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileSmall.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileSmall.png new file mode 100644 index 0000000000..550b1b5e8d Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/FlipCycleTileSmall.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/IconicTileMediumLarge.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/IconicTileMediumLarge.png new file mode 100644 index 0000000000..686e6b53f0 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/IconicTileMediumLarge.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/IconicTileSmall.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/IconicTileSmall.png new file mode 100644 index 0000000000..d4b5ede1b5 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Assets/Tiles/IconicTileSmall.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Background.png b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Background.png new file mode 100644 index 0000000000..e46f21d940 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Background.png differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/DetailsPage.xaml b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/DetailsPage.xaml new file mode 100644 index 0000000000..6f9c8e9f65 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/DetailsPage.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/DetailsPage.xaml.cs b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/DetailsPage.xaml.cs new file mode 100644 index 0000000000..012b96bf68 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/DetailsPage.xaml.cs @@ -0,0 +1,54 @@ +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; + +namespace Microsoft.AspNet.SignalR.Client.WP8.Sample +{ + public partial class DetailsPage : PhoneApplicationPage + { + // Constructor + public DetailsPage() + { + InitializeComponent(); + + // Sample code to localize the ApplicationBar + //BuildLocalizedApplicationBar(); + } + + // When page is navigated to set data context to selected item in list + protected override void OnNavigatedTo(NavigationEventArgs e) + { + if (DataContext == null) + { + string selectedIndex = ""; + if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedIndex)) + { + int index = int.Parse(selectedIndex); + DataContext = App.ViewModel.Items[index]; + } + } + } + + // Sample code for building a localized ApplicationBar + //private void BuildLocalizedApplicationBar() + //{ + // // Set the page's ApplicationBar to a new instance of ApplicationBar. + // ApplicationBar = new ApplicationBar(); + + // // Create a new button and set the text value to the localized string from AppResources. + // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); + // appBarButton.Text = AppResources.AppBarButtonText; + // ApplicationBar.Buttons.Add(appBarButton); + + // // Create a new menu item with the localized string from AppResources. + // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); + // ApplicationBar.MenuItems.Add(appBarMenuItem); + //} + } +} \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/MainPage.xaml b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/MainPage.xaml new file mode 100644 index 0000000000..f36ff9fb5c --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/MainPage.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/MainPage.xaml.cs b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/MainPage.xaml.cs new file mode 100644 index 0000000000..64aa5c63ee --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/MainPage.xaml.cs @@ -0,0 +1,84 @@ +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 Microsoft.AspNet.SignalR.Client.WP8.Sample.ViewModels; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.AspNet.SignalR.Client.WP8.Sample +{ + public partial class MainPage : PhoneApplicationPage + { + // Constructor + public MainPage() + { + InitializeComponent(); + + // Set the data context of the listbox control to the sample data + DataContext = App.ViewModel; + this.Loaded += new RoutedEventHandler(MainPage_Loaded); + + var connection = new Connection("http://signalr-sample.azurewebsites.net/raw-connection/"); + connection.Received += data => + { + Dispatcher.BeginInvoke(() => + { + App.ViewModel.Items.Add(new ItemViewModel { LineOne = data }); + }); + }; + + connection.Error += ex => + { + Dispatcher.BeginInvoke(() => + { + var aggEx = (AggregateException)ex; + App.ViewModel.Items.Add(new ItemViewModel { LineOne = aggEx.InnerExceptions[0].Message }); + }); + }; + + connection.Reconnected += () => + { + Dispatcher.BeginInvoke(() => + { + App.ViewModel.Items.Add(new ItemViewModel { LineOne = "Connection restored" }); + }); + }; + + var scheduler = TaskScheduler.FromCurrentSynchronizationContext(); + connection.Start().ContinueWith(task => + { + var ex = task.Exception.InnerExceptions[0]; + App.ViewModel.Items.Add(new ItemViewModel { LineOne = ex.Message }); + }, + CancellationToken.None, + TaskContinuationOptions.OnlyOnFaulted, + scheduler); + } + + // Handle selection changed on ListBox + private void MainListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + // If selected index is -1 (no selection) do nothing + if (MainListBox.SelectedIndex == -1) + return; + + // Navigate to the new page + NavigationService.Navigate(new Uri("/DetailsPage.xaml?selectedItem=" + MainListBox.SelectedIndex, UriKind.Relative)); + + // Reset selected index to -1 (no selection) + MainListBox.SelectedIndex = -1; + } + + // Load data for the ViewModel Items + private void MainPage_Loaded(object sender, RoutedEventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Microsoft.AspNet.SignalR.Client.WP8.Sample.csproj b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Microsoft.AspNet.SignalR.Client.WP8.Sample.csproj new file mode 100644 index 0000000000..401380a1c7 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Microsoft.AspNet.SignalR.Client.WP8.Sample.csproj @@ -0,0 +1,162 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {2117F295-6451-4447-A646-614B2D8352EF} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Microsoft.AspNet.SignalR.Client.WP8.Sample + Microsoft.AspNet.SignalR.Client.WP8.Sample + WindowsPhone + v8.0 + $(TargetFrameworkVersion) + true + + + true + true + Microsoft.AspNet.SignalR.Client.WP8.Sample_$(Configuration)_$(Platform).xap + Properties\AppManifest.xml + Microsoft.AspNet.SignalR.Client.WP8.Sample.App + true + 11.0 + true + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\x86\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\x86\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\ARM\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\ARM\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + App.xaml + + + DetailsPage.xaml + + + MainPage.xaml + + + + + + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + + + + Designer + + + + + PreserveNewest + + + + + + + + + + PreserveNewest + + + + + + {12D04172-2A5A-420D-A29B-026DB62C3B72} + Microsoft.AspNet.SignalR.Client.WP8 + + + + + + + \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/AppManifest.xml b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/AppManifest.xml new file mode 100644 index 0000000000..6712a11783 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/AppManifest.xml @@ -0,0 +1,6 @@ + + + + diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/AssemblyInfo.cs b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..0fc0a91fd5 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.AspNet.SignalR.Client.WP8.Sample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Microsoft.AspNet.SignalR.Client.WP8.Sample")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("725537dc-d7d1-403c-b30c-1daf3daa709f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/WMAppManifest.xml b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/WMAppManifest.xml new file mode 100644 index 0000000000..f31f63f2e7 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/Properties/WMAppManifest.xml @@ -0,0 +1,38 @@ + + + + + + Assets\ApplicationIcon.png + + + + + + + + + + + + + + Assets\Tiles\FlipCycleTileSmall.png + 0 + Assets\Tiles\FlipCycleTileMedium.png + Microsoft.AspNet.SignalR.Client.WP8.Sample + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/SampleData/MainViewModelSampleData.xaml b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/SampleData/MainViewModelSampleData.xaml new file mode 100644 index 0000000000..353a4b82a8 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/SampleData/MainViewModelSampleData.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/SplashScreenImage.jpg b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/SplashScreenImage.jpg new file mode 100644 index 0000000000..353b1927b9 Binary files /dev/null and b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/SplashScreenImage.jpg differ diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ViewModels/ItemViewModel.cs b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ViewModels/ItemViewModel.cs new file mode 100644 index 0000000000..a3d1e81e91 --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ViewModels/ItemViewModel.cs @@ -0,0 +1,109 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; + +namespace Microsoft.AspNet.SignalR.Client.WP8.Sample.ViewModels +{ + public class ItemViewModel : INotifyPropertyChanged + { + private string _id; + /// + /// Sample ViewModel property; this property is used to identify the object. + /// + /// + public string ID + { + get + { + return _id; + } + set + { + if (value != _id) + { + _id = value; + NotifyPropertyChanged("ID"); + } + } + } + + private string _lineOne; + /// + /// Sample ViewModel property; this property is used in the view to display its value using a Binding. + /// + /// + public string LineOne + { + get + { + return _lineOne; + } + set + { + if (value != _lineOne) + { + _lineOne = value; + NotifyPropertyChanged("LineOne"); + } + } + } + + private string _lineTwo; + /// + /// Sample ViewModel property; this property is used in the view to display its value using a Binding. + /// + /// + public string LineTwo + { + get + { + return _lineTwo; + } + set + { + if (value != _lineTwo) + { + _lineTwo = value; + NotifyPropertyChanged("LineTwo"); + } + } + } + + private string _lineThree; + /// + /// Sample ViewModel property; this property is used in the view to display its value using a Binding. + /// + /// + public string LineThree + { + get + { + return _lineThree; + } + set + { + if (value != _lineThree) + { + _lineThree = value; + NotifyPropertyChanged("LineThree"); + } + } + } + + public event PropertyChangedEventHandler PropertyChanged; + private void NotifyPropertyChanged(String propertyName) + { + PropertyChangedEventHandler handler = PropertyChanged; + if (null != handler) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + } +} \ No newline at end of file diff --git a/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ViewModels/MainViewModel.cs b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ViewModels/MainViewModel.cs new file mode 100644 index 0000000000..553fcc390a --- /dev/null +++ b/samples/Microsoft.AspNet.SignalR.Client.WP8.Sample/ViewModels/MainViewModel.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; + +namespace Microsoft.AspNet.SignalR.Client.WP8.Sample.ViewModels +{ + public class MainViewModel : INotifyPropertyChanged + { + public MainViewModel() + { + this.Items = new ObservableCollection(); + } + + /// + /// A collection for ItemViewModel objects. + /// + public ObservableCollection Items { get; private set; } + + private string _sampleProperty = "Sample Runtime Property Value"; + /// + /// Sample ViewModel property; this property is used in the view to display its value using a Binding + /// + /// + public string SampleProperty + { + get + { + return _sampleProperty; + } + set + { + if (value != _sampleProperty) + { + _sampleProperty = value; + NotifyPropertyChanged("SampleProperty"); + } + } + } + + public bool IsDataLoaded + { + get; + private set; + } + + public event PropertyChangedEventHandler PropertyChanged; + private void NotifyPropertyChanged(String propertyName) + { + PropertyChangedEventHandler handler = PropertyChanged; + if (null != handler) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.SignalR.Client.WP8/Microsoft.AspNet.SignalR.Client.WP8.csproj b/src/Microsoft.AspNet.SignalR.Client.WP8/Microsoft.AspNet.SignalR.Client.WP8.csproj new file mode 100644 index 0000000000..f71dfc3c8e --- /dev/null +++ b/src/Microsoft.AspNet.SignalR.Client.WP8/Microsoft.AspNet.SignalR.Client.WP8.csproj @@ -0,0 +1,229 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {12D04172-2A5A-420D-A29B-026DB62C3B72} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Microsoft.AspNet.SignalR.Client.WP8 + Microsoft.AspNet.SignalR.Client.WP8 + WindowsPhone + v8.0 + $(TargetFrameworkVersion) + false + true + 11.0 + true + ..\ + true + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\x86\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\x86\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\ARM\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\ARM\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + Connection.cs + + + ConnectionExtensions.cs + + + ConnectionState.cs + + + Http\DefaultHttpClient.cs + + + Http\HttpHelper.cs + + + Http\HttpWebRequestWrapper.cs + + + Http\HttpWebResponseWrapper.cs + + + Http\IHttpClient.cs + + + Http\IHttpClientExtensions.cs + + + Http\IRequest.cs + + + Http\IResponse.cs + + + Hubs\HubConnection.cs + + + Hubs\HubInvocation.cs + + + Hubs\HubProxy.cs + + + Hubs\HubProxyExtensions.cs + + + Hubs\HubRegistrationData.cs + + + Hubs\HubResult.cs + + + Hubs\IHubProxy.cs + + + Hubs\Subscription.cs + + + IConnection.cs + + + Infrastructure\DisposableAction.cs + + + Infrastructure\ExceptionHelper.cs + + + Infrastructure\StreamExtensions.cs + + + Infrastructure\ThreadSafeInvoker.cs + + + Infrastructure\UrlEncoder.cs + + + NegotiationResponse.cs + + + Resources.Designer.cs + + + StateChange.cs + + + Transports\AutoTransport.cs + + + Transports\HttpBasedTransport.cs + + + Transports\IClientTransport.cs + + + Transports\LongPollingTransport.cs + + + Transports\ServerSentEventsTransport.cs + + + Transports\ServerSentEvents\ChunkBuffer.cs + + + Transports\ServerSentEvents\EventSourceStreamReader.cs + + + Transports\ServerSentEvents\EventType.cs + + + Transports\ServerSentEvents\SseEvent.cs + + + Infrastructure\ExceptionsExtensions.cs + + + Infrastructure\TaskAsyncHelper.cs + + + + + + Resources.resx + + + + + False + ..\lib\Newtonsoft.Json.dll + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.AspNet.SignalR.Client.WP8/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.SignalR.Client.WP8/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..26e49758b5 --- /dev/null +++ b/src/Microsoft.AspNet.SignalR.Client.WP8/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.AspNet.SignalR.Client.WP8")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Microsoft.AspNet.SignalR.Client.WP8")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("12d04172-2a5a-420d-a29b-026db62c3b72")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: NeutralResourcesLanguageAttribute("en-US")]