usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [08/25] incubator-usergrid git commit: push sample
Date Wed, 11 Feb 2015 21:18:17 GMT
push sample


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/122607d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/122607d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/122607d1

Branch: refs/heads/USERGRID-273
Commit: 122607d13d5b551a1474eb4f748948922aa46f2c
Parents: 74ea17e
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Jan 22 08:47:41 2015 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Jan 22 08:47:41 2015 -0700

----------------------------------------------------------------------
 .../Usergrid.Notifications/App.xaml             |   7 +
 .../Usergrid.Notifications/App.xaml.cs          | 131 ++++++++++++
 .../Assets/Logo.scale-240.png                   | Bin 0 -> 2516 bytes
 .../Assets/SmallLogo.scale-240.png              | Bin 0 -> 753 bytes
 .../Assets/SplashScreen.scale-240.png           | Bin 0 -> 14715 bytes
 .../Assets/Square71x71Logo.scale-240.png        | Bin 0 -> 1122 bytes
 .../Assets/StoreLogo.scale-240.png              | Bin 0 -> 2200 bytes
 .../Assets/WideLogo.scale-240.png               | Bin 0 -> 4530 bytes
 .../Usergrid.Notifications/MainPage.xaml        |  20 ++
 .../Usergrid.Notifications/MainPage.xaml.cs     |  89 ++++++++
 .../Package.StoreAssociation.xml                | 194 +++++++++++++++++
 .../Usergrid.Notifications/Package.appxmanifest |  32 +++
 .../Properties/AssemblyInfo.cs                  |  29 +++
 .../Usergrid.Notifications.csproj               | 139 ++++++++++++
 .../Usergrid.Notifications/Usergrid.cs          | 209 +++++++++++++++++++
 .../Usergrid.Notifications/packages.config      |   4 +
 16 files changed, 854 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml b/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml
new file mode 100644
index 0000000..8a36359
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml
@@ -0,0 +1,7 @@
+<Application
+    x:Class="Usergrid.Notifications.App"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:Usergrid.Notifications">
+
+</Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml.cs b/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml.cs
new file mode 100644
index 0000000..9bf62ac
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/App.xaml.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.Activation;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Media.Animation;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=391641
+
+namespace Usergrid.Notifications
+{
+    /// <summary>
+    /// Provides application-specific behavior to supplement the default Application class.
+    /// </summary>
+    public sealed partial class App : Application
+    {
+        private TransitionCollection transitions;
+
+        /// <summary>
+        /// Initializes the singleton application object.  This is the first line of authored code
+        /// executed, and as such is the logical equivalent of main() or WinMain().
+        /// </summary>
+        public App()
+        {
+            this.InitializeComponent();
+            this.Suspending += this.OnSuspending;
+        }
+
+        /// <summary>
+        /// Invoked when the application is launched normally by the end user.  Other entry points
+        /// will be used when the application is launched to open a specific file, to display
+        /// search results, and so forth.
+        /// </summary>
+        /// <param name="e">Details about the launch request and process.</param>
+        protected override void OnLaunched(LaunchActivatedEventArgs e)
+        {
+#if DEBUG
+            if (System.Diagnostics.Debugger.IsAttached)
+            {
+                this.DebugSettings.EnableFrameRateCounter = true;
+            }
+#endif
+
+            Frame rootFrame = Window.Current.Content as Frame;
+
+            // Do not repeat app initialization when the Window already has content,
+            // just ensure that the window is active
+            if (rootFrame == null)
+            {
+                // Create a Frame to act as the navigation context and navigate to the first page
+                rootFrame = new Frame();
+
+                // TODO: change this value to a cache size that is appropriate for your application
+                rootFrame.CacheSize = 1;
+
+                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
+                {
+                    // TODO: Load state from previously suspended application
+                }
+
+                // Place the frame in the current Window
+                Window.Current.Content = rootFrame;
+            }
+
+            if (rootFrame.Content == null)
+            {
+                // Removes the turnstile navigation for startup.
+                if (rootFrame.ContentTransitions != null)
+                {
+                    this.transitions = new TransitionCollection();
+                    foreach (var c in rootFrame.ContentTransitions)
+                    {
+                        this.transitions.Add(c);
+                    }
+                }
+
+                rootFrame.ContentTransitions = null;
+                rootFrame.Navigated += this.RootFrame_FirstNavigated;
+
+                // When the navigation stack isn't restored navigate to the first page,
+                // configuring the new page by passing required information as a navigation
+                // parameter
+                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
+                {
+                    throw new Exception("Failed to create initial page");
+                }
+            }
+
+            // Ensure the current window is active
+            Window.Current.Activate();
+        }
+
+        /// <summary>
+        /// Restores the content transitions after the app has launched.
+        /// </summary>
+        /// <param name="sender">The object where the handler is attached.</param>
+        /// <param name="e">Details about the navigation event.</param>
+        private void RootFrame_FirstNavigated(object sender, NavigationEventArgs e)
+        {
+            var rootFrame = sender as Frame;
+            rootFrame.ContentTransitions = this.transitions ?? new TransitionCollection() { new NavigationThemeTransition() };
+            rootFrame.Navigated -= this.RootFrame_FirstNavigated;
+        }
+
+        /// <summary>
+        /// Invoked when application execution is being suspended.  Application state is saved
+        /// without knowing whether the application will be terminated or resumed with the contents
+        /// of memory still intact.
+        /// </summary>
+        /// <param name="sender">The source of the suspend request.</param>
+        /// <param name="e">Details about the suspend request.</param>
+        private void OnSuspending(object sender, SuspendingEventArgs e)
+        {
+            var deferral = e.SuspendingOperation.GetDeferral();
+
+            // TODO: Save application state and stop any background activity
+            deferral.Complete();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png
new file mode 100644
index 0000000..76921ca
Binary files /dev/null and b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png
new file mode 100644
index 0000000..3166301
Binary files /dev/null and b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png
new file mode 100644
index 0000000..33f26b3
Binary files /dev/null and b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png
new file mode 100644
index 0000000..cfa54be
Binary files /dev/null and b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png
new file mode 100644
index 0000000..47e084b
Binary files /dev/null and b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png
new file mode 100644
index 0000000..6249d29
Binary files /dev/null and b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml b/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml
new file mode 100644
index 0000000..3e0affd
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml
@@ -0,0 +1,20 @@
+<Page
+    x:Class="Usergrid.Notifications.MainPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:Usergrid.Notifications"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d"
+    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+
+    <Grid>
+        <TextBox x:Name="pushText" HorizontalAlignment="Left" Margin="75,46,0,0" TextWrapping="Wrap" Text="Push Text" VerticalAlignment="Top" Width="261" TextChanged="pushText_TextChanged"/>
+        <Button  Content="Send" HorizontalAlignment="Left" Margin="146,121,0,0" VerticalAlignment="Top" Click="Button_Click"/>
+        <TextBox x:Name="NotifierName" HorizontalAlignment="Left" Margin="75,210,0,0" TextWrapping="Wrap" Text="Notifier Name" VerticalAlignment="Top" Width="261"/>
+        <TextBox x:Name="Api_Key" HorizontalAlignment="Left" Margin="75,276,0,0" TextWrapping="Wrap" Text="Sid" VerticalAlignment="Top" Width="261"/>
+        <TextBox x:Name="Sid" HorizontalAlignment="Left" Margin="75,348,0,0" TextWrapping="Wrap" Text="Api Key" VerticalAlignment="Top" Width="261"/>
+        <Button x:Name="AddNotifierButton" Content="Add Notifier" HorizontalAlignment="Left" Margin="146,405,0,0" VerticalAlignment="Top" Click="AddNotifierButton_Click"/>
+
+    </Grid>
+</Page>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs b/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs
new file mode 100644
index 0000000..882838d
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.Networking.PushNotifications;
+using Windows.Storage;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641
+
+namespace Usergrid.Notifications
+{
+    /// <summary>
+    /// An empty page that can be used on its own or navigated to within a Frame.
+    /// </summary>
+    public sealed partial class MainPage : Page
+    {
+        private Usergrid usergrid;
+        private string serverUrl;
+        private string org;
+        private string app;
+        private string notifier;
+        private string apiKey;
+        private string secret;
+        private Guid deviceId;
+        public MainPage()
+        {
+            this.InitializeComponent();
+            var myIp = "10.0.1.20";
+            serverUrl = "http://" + myIp + ":8080";
+            org = "mobile";
+            app = "sandbox";
+            notifier = "winphone";
+            this.NavigationCacheMode = NavigationCacheMode.Required;
+            this.setup();
+        }
+
+        private async void setup()
+        {
+            usergrid = new Usergrid(serverUrl, org, app);
+            await this.usergrid.Authenticate("superuser", "test", true);
+            await usergrid.Push.RegisterDevice(notifier);
+           
+            
+        }
+
+        /// <summary>
+        /// Invoked when this page is about to be displayed in a Frame.
+        /// </summary>
+        /// <param name="e">Event data that describes how this page was reached.
+        /// This parameter is typically used to configure the page.</param>
+        protected override void OnNavigatedTo(NavigationEventArgs e)
+        {
+            // TODO: Prepare page for display here.
+
+            // TODO: If your application contains multiple pages, ensure that you are
+            // handling the hardware Back button by registering for the
+            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
+            // If you are using the NavigationHelper provided by some templates,
+            // this event is handled for you.
+        }
+
+        private async void Button_Click(object sender, RoutedEventArgs e)
+        {
+
+            var message = this.pushText.Text;
+            await usergrid.Push.SendNotification(deviceId,message);
+        }
+
+        private void pushText_TextChanged(object sender, TextChangedEventArgs e)
+        {
+
+        }
+
+        private async void AddNotifierButton_Click(object sender, RoutedEventArgs e)
+        {
+            await usergrid.Push.AddNotifier(NotifierName.Text,Sid.Text,Api_Key.Text);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.StoreAssociation.xml
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.StoreAssociation.xml b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.StoreAssociation.xml
new file mode 100644
index 0000000..c6278a4
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.StoreAssociation.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="utf-8"?>
+<StoreAssociation xmlns="http://schemas.microsoft.com/appx/2010/storeassociation">
+  <Publisher>CN=AC3A1EB7-E4EA-48C0-9556-C37AA8BAE0CF</Publisher>
+  <PublisherDisplayName>feldrocker</PublisherDisplayName>
+  <GeneratePackageHash>http://www.w3.org/2001/04/xmlenc#sha256</GeneratePackageHash>
+  <SupportedLocales>
+    <Language Code="af" InMinimumRequirementSet="true" />
+    <Language Code="af-za" InMinimumRequirementSet="true" />
+    <Language Code="sq" InMinimumRequirementSet="true" />
+    <Language Code="sq-al" InMinimumRequirementSet="true" />
+    <Language Code="ar" InMinimumRequirementSet="true" />
+    <Language Code="ar-ae" InMinimumRequirementSet="true" />
+    <Language Code="ar-bh" InMinimumRequirementSet="true" />
+    <Language Code="ar-dz" InMinimumRequirementSet="true" />
+    <Language Code="ar-eg" InMinimumRequirementSet="true" />
+    <Language Code="ar-iq" InMinimumRequirementSet="true" />
+    <Language Code="ar-jo" InMinimumRequirementSet="true" />
+    <Language Code="ar-kw" InMinimumRequirementSet="true" />
+    <Language Code="ar-lb" InMinimumRequirementSet="true" />
+    <Language Code="ar-ly" InMinimumRequirementSet="true" />
+    <Language Code="ar-ma" InMinimumRequirementSet="true" />
+    <Language Code="ar-om" InMinimumRequirementSet="true" />
+    <Language Code="ar-qa" InMinimumRequirementSet="true" />
+    <Language Code="ar-sa" InMinimumRequirementSet="true" />
+    <Language Code="ar-sy" InMinimumRequirementSet="true" />
+    <Language Code="ar-tn" InMinimumRequirementSet="true" />
+    <Language Code="ar-ye" InMinimumRequirementSet="true" />
+    <Language Code="az-latn" InMinimumRequirementSet="true" />
+    <Language Code="az-latn-az" InMinimumRequirementSet="true" />
+    <Language Code="az" InMinimumRequirementSet="true" />
+    <Language Code="eu" InMinimumRequirementSet="true" />
+    <Language Code="eu-es" InMinimumRequirementSet="true" />
+    <Language Code="be" InMinimumRequirementSet="true" />
+    <Language Code="be-by" InMinimumRequirementSet="true" />
+    <Language Code="pt-br" InMinimumRequirementSet="true" />
+    <Language Code="bg" InMinimumRequirementSet="true" />
+    <Language Code="bg-bg" InMinimumRequirementSet="true" />
+    <Language Code="ca" InMinimumRequirementSet="true" />
+    <Language Code="ca-es" InMinimumRequirementSet="true" />
+    <Language Code="hr" InMinimumRequirementSet="true" />
+    <Language Code="hr-hr" InMinimumRequirementSet="true" />
+    <Language Code="hr-ba" InMinimumRequirementSet="true" />
+    <Language Code="cs" InMinimumRequirementSet="true" />
+    <Language Code="cs-cz" InMinimumRequirementSet="true" />
+    <Language Code="da" InMinimumRequirementSet="true" />
+    <Language Code="da-dk" InMinimumRequirementSet="true" />
+    <Language Code="nl" InMinimumRequirementSet="true" />
+    <Language Code="nl-nl" InMinimumRequirementSet="true" />
+    <Language Code="nl-be" InMinimumRequirementSet="true" />
+    <Language Code="en" InMinimumRequirementSet="true" />
+    <Language Code="en-gb" InMinimumRequirementSet="true" />
+    <Language Code="en-029" InMinimumRequirementSet="true" />
+    <Language Code="en-au" InMinimumRequirementSet="true" />
+    <Language Code="en-bz" InMinimumRequirementSet="true" />
+    <Language Code="en-ie" InMinimumRequirementSet="true" />
+    <Language Code="en-in" InMinimumRequirementSet="true" />
+    <Language Code="en-jm" InMinimumRequirementSet="true" />
+    <Language Code="en-my" InMinimumRequirementSet="true" />
+    <Language Code="en-nz" InMinimumRequirementSet="true" />
+    <Language Code="en-ph" InMinimumRequirementSet="true" />
+    <Language Code="en-sg" InMinimumRequirementSet="true" />
+    <Language Code="en-tt" InMinimumRequirementSet="true" />
+    <Language Code="en-za" InMinimumRequirementSet="true" />
+    <Language Code="en-zw" InMinimumRequirementSet="true" />
+    <Language Code="en-hk" InMinimumRequirementSet="true" />
+    <Language Code="en-us" InMinimumRequirementSet="true" />
+    <Language Code="en-ca" InMinimumRequirementSet="true" />
+    <Language Code="et" InMinimumRequirementSet="true" />
+    <Language Code="et-ee" InMinimumRequirementSet="true" />
+    <Language Code="fil" InMinimumRequirementSet="true" />
+    <Language Code="fil-ph" InMinimumRequirementSet="true" />
+    <Language Code="fi" InMinimumRequirementSet="true" />
+    <Language Code="fi-fi" InMinimumRequirementSet="true" />
+    <Language Code="fr" InMinimumRequirementSet="true" />
+    <Language Code="fr-fr" InMinimumRequirementSet="true" />
+    <Language Code="fr-ca" InMinimumRequirementSet="true" />
+    <Language Code="fr-ch" InMinimumRequirementSet="true" />
+    <Language Code="fr-be" InMinimumRequirementSet="true" />
+    <Language Code="fr-lu" InMinimumRequirementSet="true" />
+    <Language Code="fr-mc" InMinimumRequirementSet="true" />
+    <Language Code="gl" InMinimumRequirementSet="true" />
+    <Language Code="gl-es" InMinimumRequirementSet="true" />
+    <Language Code="de" InMinimumRequirementSet="true" />
+    <Language Code="de-de" InMinimumRequirementSet="true" />
+    <Language Code="de-ch" InMinimumRequirementSet="true" />
+    <Language Code="de-at" InMinimumRequirementSet="true" />
+    <Language Code="de-li" InMinimumRequirementSet="true" />
+    <Language Code="de-lu" InMinimumRequirementSet="true" />
+    <Language Code="el" InMinimumRequirementSet="true" />
+    <Language Code="el-gr" InMinimumRequirementSet="true" />
+    <Language Code="ha-latn" InMinimumRequirementSet="true" />
+    <Language Code="ha-latn-ng" InMinimumRequirementSet="true" />
+    <Language Code="ha" InMinimumRequirementSet="true" />
+    <Language Code="he" InMinimumRequirementSet="true" />
+    <Language Code="he-il" InMinimumRequirementSet="true" />
+    <Language Code="hi" InMinimumRequirementSet="true" />
+    <Language Code="hi-in" InMinimumRequirementSet="true" />
+    <Language Code="hu" InMinimumRequirementSet="true" />
+    <Language Code="hu-hu" InMinimumRequirementSet="true" />
+    <Language Code="id" InMinimumRequirementSet="true" />
+    <Language Code="id-id" InMinimumRequirementSet="true" />
+    <Language Code="it" InMinimumRequirementSet="true" />
+    <Language Code="it-it" InMinimumRequirementSet="true" />
+    <Language Code="it-ch" InMinimumRequirementSet="true" />
+    <Language Code="ja" InMinimumRequirementSet="true" />
+    <Language Code="ja-jp" InMinimumRequirementSet="true" />
+    <Language Code="kk" InMinimumRequirementSet="true" />
+    <Language Code="kk-kz" InMinimumRequirementSet="true" />
+    <Language Code="ko" InMinimumRequirementSet="true" />
+    <Language Code="ko-kr" InMinimumRequirementSet="true" />
+    <Language Code="sr-latn" InMinimumRequirementSet="true" />
+    <Language Code="sr-latn-ba" InMinimumRequirementSet="true" />
+    <Language Code="sr-latn-cs" InMinimumRequirementSet="true" />
+    <Language Code="sr-latn-me" InMinimumRequirementSet="true" />
+    <Language Code="sr-latn-rs" InMinimumRequirementSet="true" />
+    <Language Code="sr" InMinimumRequirementSet="true" />
+    <Language Code="lv" InMinimumRequirementSet="true" />
+    <Language Code="lv-lv" InMinimumRequirementSet="true" />
+    <Language Code="lt" InMinimumRequirementSet="true" />
+    <Language Code="lt-lt" InMinimumRequirementSet="true" />
+    <Language Code="mk" InMinimumRequirementSet="true" />
+    <Language Code="mk-mk" InMinimumRequirementSet="true" />
+    <Language Code="ms" InMinimumRequirementSet="true" />
+    <Language Code="ms-my" InMinimumRequirementSet="true" />
+    <Language Code="ms-bn" InMinimumRequirementSet="true" />
+    <Language Code="nb" InMinimumRequirementSet="true" />
+    <Language Code="nb-no" InMinimumRequirementSet="true" />
+    <Language Code="fa" InMinimumRequirementSet="true" />
+    <Language Code="fa-ir" InMinimumRequirementSet="true" />
+    <Language Code="pl" InMinimumRequirementSet="true" />
+    <Language Code="pl-pl" InMinimumRequirementSet="true" />
+    <Language Code="pt" InMinimumRequirementSet="true" />
+    <Language Code="pt-pt" InMinimumRequirementSet="true" />
+    <Language Code="ro" InMinimumRequirementSet="true" />
+    <Language Code="ro-ro" InMinimumRequirementSet="true" />
+    <Language Code="ru" InMinimumRequirementSet="true" />
+    <Language Code="ru-ru" InMinimumRequirementSet="true" />
+    <Language Code="zh" InMinimumRequirementSet="true" />
+    <Language Code="zh-cn" InMinimumRequirementSet="true" />
+    <Language Code="zh-hans" InMinimumRequirementSet="true" />
+    <Language Code="zh-sg" InMinimumRequirementSet="true" />
+    <Language Code="sk" InMinimumRequirementSet="true" />
+    <Language Code="sk-sk" InMinimumRequirementSet="true" />
+    <Language Code="sl" InMinimumRequirementSet="true" />
+    <Language Code="sl-si" InMinimumRequirementSet="true" />
+    <Language Code="es" InMinimumRequirementSet="true" />
+    <Language Code="es-es" InMinimumRequirementSet="true" />
+    <Language Code="es-mx" InMinimumRequirementSet="true" />
+    <Language Code="es-ar" InMinimumRequirementSet="true" />
+    <Language Code="es-bo" InMinimumRequirementSet="true" />
+    <Language Code="es-cl" InMinimumRequirementSet="true" />
+    <Language Code="es-co" InMinimumRequirementSet="true" />
+    <Language Code="es-cr" InMinimumRequirementSet="true" />
+    <Language Code="es-do" InMinimumRequirementSet="true" />
+    <Language Code="es-ec" InMinimumRequirementSet="true" />
+    <Language Code="es-gt" InMinimumRequirementSet="true" />
+    <Language Code="es-hn" InMinimumRequirementSet="true" />
+    <Language Code="es-ni" InMinimumRequirementSet="true" />
+    <Language Code="es-pa" InMinimumRequirementSet="true" />
+    <Language Code="es-pe" InMinimumRequirementSet="true" />
+    <Language Code="es-pr" InMinimumRequirementSet="true" />
+    <Language Code="es-py" InMinimumRequirementSet="true" />
+    <Language Code="es-sv" InMinimumRequirementSet="true" />
+    <Language Code="es-us" InMinimumRequirementSet="true" />
+    <Language Code="es-uy" InMinimumRequirementSet="true" />
+    <Language Code="es-ve" InMinimumRequirementSet="true" />
+    <Language Code="sv" InMinimumRequirementSet="true" />
+    <Language Code="sv-fi" InMinimumRequirementSet="true" />
+    <Language Code="sv-se" InMinimumRequirementSet="true" />
+    <Language Code="th" InMinimumRequirementSet="true" />
+    <Language Code="th-th" InMinimumRequirementSet="true" />
+    <Language Code="zh-hant" InMinimumRequirementSet="true" />
+    <Language Code="zh-hk" InMinimumRequirementSet="true" />
+    <Language Code="zh-mo" InMinimumRequirementSet="true" />
+    <Language Code="zh-tw" InMinimumRequirementSet="true" />
+    <Language Code="tr" InMinimumRequirementSet="true" />
+    <Language Code="tr-tr" InMinimumRequirementSet="true" />
+    <Language Code="uk" InMinimumRequirementSet="true" />
+    <Language Code="uk-ua" InMinimumRequirementSet="true" />
+    <Language Code="uz-latn" InMinimumRequirementSet="true" />
+    <Language Code="uz-latn-uz" InMinimumRequirementSet="true" />
+    <Language Code="uz" InMinimumRequirementSet="true" />
+    <Language Code="vi" InMinimumRequirementSet="true" />
+    <Language Code="vi-vn" InMinimumRequirementSet="true" />
+  </SupportedLocales>
+  <ProductReservedInfo>
+    <MainPackageIdentityName>15661feldrocker.usergridsample</MainPackageIdentityName>
+    <ReservedNames>
+      <ReservedName>usergrid sample</ReservedName>
+    </ReservedNames>
+  </ProductReservedInfo>
+  <AccountPackageIdentityNames />
+  <PackageInfoList LandingUrl="https://dev.windowsphone.com/AppSubmission/AssociationLanding?windowsProductId=142f4403-3810-4c59-8236-0afe0b8472bf" />
+</StoreAssociation>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.appxmanifest
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.appxmanifest b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.appxmanifest
new file mode 100644
index 0000000..a47ef82
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Package.appxmanifest
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
+  <Identity Name="15661feldrocker.usergridsample" Publisher="CN=AC3A1EB7-E4EA-48C0-9556-C37AA8BAE0CF" Version="1.1.0.0" />
+  <mp:PhoneIdentity PhoneProductId="c05b658a-0b41-4187-a6e4-ca186c2338de" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
+  <Properties>
+    <DisplayName>usergrid sample</DisplayName>
+    <PublisherDisplayName>feldrocker</PublisherDisplayName>
+    <Logo>Assets\StoreLogo.png</Logo>
+  </Properties>
+  <Prerequisites>
+    <OSMinVersion>6.3.1</OSMinVersion>
+    <OSMaxVersionTested>6.3.1</OSMaxVersionTested>
+  </Prerequisites>
+  <Resources>
+    <Resource Language="x-generate" />
+  </Resources>
+  <Applications>
+    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Usergrid.Notifications.App">
+      <m3:VisualElements DisplayName="usergrid sample" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="Usergrid.Notifications" ForegroundText="light" BackgroundColor="transparent" ToastCapable="true">
+        <m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png">
+        </m3:DefaultTile>
+        <m3:SplashScreen Image="Assets\SplashScreen.png" />
+        <m3:InitialRotationPreference>
+          <m3:Rotation Preference="portrait" />
+        </m3:InitialRotationPreference>
+      </m3:VisualElements>
+    </Application>
+  </Applications>
+  <Capabilities>
+    <Capability Name="internetClientServer" />
+  </Capabilities>
+</Package>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Properties/AssemblyInfo.cs b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..daf5838
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Properties/AssemblyInfo.cs
@@ -0,0 +1,29 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("Usergrid.Notifications")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Usergrid.Notifications")]
+[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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 Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: ComVisible(false)]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj
new file mode 100644
index 0000000..c811c83
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}</ProjectGuid>
+    <OutputType>AppContainerExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Usergrid.Notifications</RootNamespace>
+    <AssemblyName>Usergrid.Notifications</AssemblyName>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <TargetPlatformVersion>8.1</TargetPlatformVersion>
+    <MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
+    <AppxBundlePlatforms>neutral</AppxBundlePlatforms>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\ARM\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
+    <NoWarn>;2008</NoWarn>
+    <DebugType>full</DebugType>
+    <PlatformTarget>ARM</PlatformTarget>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
+    <OutputPath>bin\ARM\Release\</OutputPath>
+    <DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
+    <Optimize>true</Optimize>
+    <NoWarn>;2008</NoWarn>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>ARM</PlatformTarget>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
+    <NoWarn>;2008</NoWarn>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
+    <Optimize>true</Optimize>
+    <NoWarn>;2008</NoWarn>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <ErrorReport>prompt</ErrorReport>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="MainPage.xaml.cs">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Usergrid.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <AppxManifest Include="Package.appxmanifest">
+      <SubType>Designer</SubType>
+    </AppxManifest>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Assets\Logo.scale-240.png" />
+    <Content Include="Assets\SmallLogo.scale-240.png" />
+    <Content Include="Assets\SplashScreen.scale-240.png" />
+    <Content Include="Assets\Square71x71Logo.scale-240.png" />
+    <Content Include="Assets\StoreLogo.scale-240.png" />
+    <Content Include="Assets\WideLogo.scale-240.png" />
+    <None Include="Package.StoreAssociation.xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Page Include="MainPage.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
+    <VisualStudioVersion>12.0</VisualStudioVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == '' ">
+    <TargetPlatformIdentifier>WindowsPhoneApp</TargetPlatformIdentifier>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.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>
+  -->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.cs b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.cs
new file mode 100644
index 0000000..cc715f8
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/Usergrid.cs
@@ -0,0 +1,209 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Net;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Json;
+using System.Text;
+using Newtonsoft.Json.Linq;
+using Newtonsoft.Json;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using Windows.Storage;
+using Windows.Networking.PushNotifications;
+
+namespace Usergrid.Notifications
+{
+    public class Usergrid : UsergridHttpClient
+    {
+        private string url;
+        private string token;
+        private HttpClient client;
+        private PushClient push;
+        private string managementUrl;
+
+        public Usergrid(string url, string org, string app)
+        {
+            string urlWithSlash = url.EndsWith("/",StringComparison.CurrentCulture) ? url : url+"/";
+            this.url = String.Format("{0}{1}/{2}/", urlWithSlash, org, app);
+            this.managementUrl = urlWithSlash + "management/";
+            this.client = new HttpClient();
+            push = new PushClient(this);
+        }
+
+        public async Task Authenticate(string user, string password, bool isManagement)
+        {
+            var url = "token";
+            var jsonObject = new JObject();
+            jsonObject.Add("username", user);
+            jsonObject.Add("password", password);
+            jsonObject.Add("grant_type", "password");
+            HttpResponseMessage response = await SendAsync(HttpMethod.Post,url, jsonObject, isManagement);
+
+            if (response.StatusCode == HttpStatusCode.OK)
+            {
+                JObject jsonResponse = await GetJsonResponse(response);
+                this.token = jsonResponse.GetValue("access_token").Value<String>();
+                client.DefaultRequestHeaders.Add("X-Authorization", token);
+            }
+            else
+            {
+                throw new Exception("Authentication failed");
+            }
+        }
+
+        public async Task<JObject> GetJsonResponse(HttpResponseMessage response)
+        {
+            JObject jsonResponse = null;
+            using (var stream = await response.Content.ReadAsStreamAsync())
+            {
+                using (var reader = new StreamReader(stream, Encoding.UTF8))
+                {
+                    jsonResponse = JObject.Parse(reader.ReadToEnd());
+                }
+            }
+            return jsonResponse;
+        }
+
+        private HttpContent getJsonBody(Object jsonObject)
+        {
+            var content =  new StringContent(JsonConvert.SerializeObject(jsonObject));
+            return content;
+        }
+        public  Task<HttpResponseMessage> SendAsync(HttpMethod method, string url, object obj)
+        {
+            return SendAsync(method, url, obj, false);
+        }
+        public Task<HttpResponseMessage> SendAsync(HttpMethod method, string url, object obj, bool useManagementUrl)
+        {
+            HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Post, (useManagementUrl ? this.managementUrl : this.url) + url);
+            if(obj!=null)
+                message.Content = getJsonBody(obj);
+            message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue( "application/json"));
+            return this.client.SendAsync(message);
+
+        }
+   
+        public PushClient Push
+        {
+            get { return push; }
+        }
+
+
+    }
+
+    public interface UsergridHttpClient
+    {
+        Task<HttpResponseMessage>SendAsync(HttpMethod method,string url, object obj);
+        Task<JObject> GetJsonResponse(HttpResponseMessage response);
+
+    }
+    public class PushClient
+    {
+        private UsergridHttpClient usergrid;
+        
+        public PushClient(UsergridHttpClient usergrid)
+        { 
+            this.usergrid = usergrid; 
+        }
+
+        public async Task<bool> SendNotification(string message)
+        {
+            if (DeviceId == null)
+            {
+                throw new Exception("Please call PushClient.RegisterDevice first.");
+            }
+            var jsonObject = new JObject();
+            var payloads = new JObject();
+            var payload = new JObject();
+            payload.Add("toast", new JValue(message));
+            payloads.Add("winphone", payload);
+            jsonObject.Add("payloads",payloads);
+            jsonObject.Add("debug", true);
+            var response = await usergrid.SendAsync(HttpMethod.Post,String.Format("devices/{0}/notifications",deviceId), jsonObject);
+            var status = response.StatusCode;
+            JObject jsonResponse = await usergrid.GetJsonResponse(response);
+            return (status == HttpStatusCode.OK);
+        }
+
+        public async Task RegisterDevice(string notifier)
+        {
+            this.Notifier = notifier;
+            var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
+            var settings = ApplicationData.Current.LocalSettings;
+            if (!settings.Values.ContainsKey("currentDeviceId"))
+            {
+                Guid uuid = await registerDevice(notifier, channel.Uri);
+                settings.Values.Add("currentDeviceId", uuid);
+                this.DeviceId = uuid;
+            }
+            else
+            {
+                object tempId;
+                settings.Values.TryGetValue("currentDeviceId", out tempId);
+                this.DeviceId = Guid.Parse(tempId.ToString());
+                if (!await DeviceExists(DeviceId))
+                {
+                    Guid uuid = await registerDevice(notifier, channel.Uri);
+                    settings.Values["currentDeviceId"] = uuid;
+                    this.DeviceId = uuid;
+                }
+
+            }
+
+           
+        }
+      
+        public async Task AddNotifier(string name, string sid, string apiKey)
+        {
+            JObject obj = new JObject();
+            obj.Add("name", new JValue(name));
+            obj.Add("sid", new JValue(sid));
+            obj.Add("provider", new JValue("windows"));
+            obj.Add("apiKey", new JValue(apiKey));
+            obj.Add("logging", new JValue(true));
+            HttpResponseMessage response = await usergrid.SendAsync(HttpMethod.Post, "notifiers", obj);
+
+            JObject jsonResponse = await usergrid.GetJsonResponse(response);
+            if (jsonResponse != null)
+            {
+                var body = jsonResponse.GetValue("entities").ToString();
+            }
+        }
+
+        public async Task<bool> DeviceExists(Guid deviceId)
+        {
+            HttpResponseMessage response = await usergrid.SendAsync(HttpMethod.Get, "devices/"+deviceId, null);
+            JObject jsonResponse = await usergrid.GetJsonResponse(response);
+            if (jsonResponse != null)
+            {
+                    var body = jsonResponse.GetValue("entities");
+                    return body!=null &&  body.Value<JArray>().Count > 0;
+            }
+            else { return false; }
+        }
+
+        private async Task<Guid> registerDevice(string notifier, string uri)
+        {
+            JObject obj = new JObject();
+            obj.Add(notifier + ".notifier.id", new JValue(uri));
+            HttpResponseMessage response = await usergrid.SendAsync(HttpMethod.Post, "devices/", obj);
+
+            JObject jsonResponse = await usergrid.GetJsonResponse(response);
+
+            if (response.StatusCode == HttpStatusCode.OK && jsonResponse != null)
+            {
+                var entity = jsonResponse.GetValue("entities").Value<JArray>()[0];
+                var uuid = Guid.Parse(entity.Value<String>("uuid"));
+                return uuid;
+            }
+            else { return Guid.Empty; }
+        }
+
+        public string Notifier { get; set; }
+        private Guid DeviceId { get; set; }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/122607d1/sdks/dotnet/samples/notifications/Usergrid.Notifications/packages.config
----------------------------------------------------------------------
diff --git a/sdks/dotnet/samples/notifications/Usergrid.Notifications/packages.config b/sdks/dotnet/samples/notifications/Usergrid.Notifications/packages.config
new file mode 100644
index 0000000..efaa424
--- /dev/null
+++ b/sdks/dotnet/samples/notifications/Usergrid.Notifications/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Newtonsoft.Json" version="6.0.8" targetFramework="wpa81" />
+</packages>
\ No newline at end of file


Mime
View raw message