Repository: usergrid-dotnet Updated Branches: refs/heads/master [created] 94c0483cc
http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/messageeTutorial/Messagee/UserSettings.resx ---------------------------------------------------------------------- diff --git a/samples/messageeTutorial/Messagee/UserSettings.resx b/samples/messageeTutorial/Messagee/UserSettings.resx new file mode 100644 index 0000000..85d1d78 --- /dev/null +++ b/samples/messageeTutorial/Messagee/UserSettings.resx @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<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> +</root> http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/messageeTutorial/Messagee/UserSettings.vb ---------------------------------------------------------------------- diff --git a/samples/messageeTutorial/Messagee/UserSettings.vb b/samples/messageeTutorial/Messagee/UserSettings.vb new file mode 100644 index 0000000..52c7f8a --- /dev/null +++ b/samples/messageeTutorial/Messagee/UserSettings.vb @@ -0,0 +1,96 @@ +' Licensed to the Apache Software Foundation (ASF) under one or more +' contributor license agreements. See the NOTICE file distributed with +' this work for additional information regarding copyright ownership. +' The ASF licenses this file to You under the Apache License, Version 2.0 +' (the "License"); you may not use this file except in compliance with +' the License. You may obtain a copy of the License at +' +' http://www.apache.org/licenses/LICENSE-2.0 +' +' Unless required by applicable law or agreed to in writing, software +' distributed under the License is distributed on an "AS IS" BASIS, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' See the License for the specific language governing permissions and +' limitations under the License. + +Imports Usergrid.Sdk +Imports Usergrid.Sdk.Model + +Public Class UserSettings + Private userName As String + + + Private Sub UserSettings_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Me.userName = MessageeMainWindow.Users.Items(MessageeMainWindow.Users.SelectedIndex).ToString + userNameLabel.Text = Me.userName + Dim user As UsergridUser = Globals.client.GetUser(Of UsergridUser)(userName) + uuidLabel.Text = user.Uuid + PopulateUsersAndFollowingLists(userName) + btnAddFollowing.Enabled = False + btnDeleteFollowing.Enabled = False + End Sub + + Private Sub PopulateUsersAndFollowingLists(userName As String) + unconnectedUsers.Items.Clear() + followingList.Items.Clear() + + Dim following As IList(Of UsergridEntity) = Utils.GetFollowers(userName) + Dim followersList As IList(Of UsergridEntity) = Utils.GetFollowed(userName) + + Dim allUsers As UsergridCollection(Of UsergridUser) = Globals.client.GetEntities(Of UsergridUser)("users") + Dim i As Integer = 0 + While i < allUsers.Count + If Not EntityInIList(allUsers(i), following) And allUsers(i).UserName <> userName Then + unconnectedUsers.Items.Add(allUsers(i).UserName) + End If + i = i + 1 + End While + i = 0 + + While i < following.Count + Dim dc As UsergridUser = Globals.client.GetUser(Of UsergridUser)(following(i).Uuid) + followingList.Items.Add(dc.UserName) + i = i + 1 + End While + End Sub + Private Function EntityInIList(entity As UsergridEntity, ilist As IList) As Boolean + Dim i As Integer = 0 + While i < ilist.Count + Dim ilistEntity As UsergridEntity = ilist(i) + If ilistEntity.Name = entity.Name Then + Return True + End If + i = i + 1 + End While + Return False + End Function + + Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click + Me.Close() + Globals.mainWindow.UpdateFollowersAndFollowing() + Globals.mainWindow.UpdateYourFeed() + End Sub + + Private Sub btnAddFollowing_Click(sender As Object, e As EventArgs) Handles btnAddFollowing.Click + Utils.FollowUser(Me.userName, unconnectedUsers.Items(unconnectedUsers.SelectedIndex).ToString) + Utils.AddFollower(Me.userName, unconnectedUsers.Items(unconnectedUsers.SelectedIndex).ToString) + btnAddFollowing.Enabled = False + PopulateUsersAndFollowingLists(Me.userName) + End Sub + + Private Sub unconnectedUsers_SelectedIndexChanged(sender As Object, e As EventArgs) Handles unconnectedUsers.SelectedIndexChanged + btnAddFollowing.Enabled = True + End Sub + + Private Sub followingList_SelectedIndexChanged(sender As Object, e As EventArgs) Handles followingList.SelectedIndexChanged + btnDeleteFollowing.Enabled = True + End Sub + + Private Sub btnDeleteFollowing_Click(sender As Object, e As EventArgs) Handles btnDeleteFollowing.Click + Dim delUserName = followingList.Items(followingList.SelectedIndex).ToString() + Utils.DeleteFollowUser(Me.userName, delUserName) + Utils.DeleteFollower(Me.userName, delUserName) + btnDeleteFollowing.Enabled = False + PopulateUsersAndFollowingLists(Me.userName) + End Sub +End Class http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/messageeTutorial/Messagee/Utils.vb ---------------------------------------------------------------------- diff --git a/samples/messageeTutorial/Messagee/Utils.vb b/samples/messageeTutorial/Messagee/Utils.vb new file mode 100644 index 0000000..3a42ea2 --- /dev/null +++ b/samples/messageeTutorial/Messagee/Utils.vb @@ -0,0 +1,82 @@ +' Licensed to the Apache Software Foundation (ASF) under one or more +' contributor license agreements. See the NOTICE file distributed with +' this work for additional information regarding copyright ownership. +' The ASF licenses this file to You under the Apache License, Version 2.0 +' (the "License"); you may not use this file except in compliance with +' the License. You may obtain a copy of the License at +' +' http://www.apache.org/licenses/LICENSE-2.0 +' +' Unless required by applicable law or agreed to in writing, software +' distributed under the License is distributed on an "AS IS" BASIS, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' See the License for the specific language governing permissions and +' limitations under the License. + +Imports Usergrid.Sdk +Imports Usergrid.Sdk.Model + +Public Class Utils + + Public Shared Function GetFollowers(userName As String) As IList + Dim conn As Connection = New Connection() + conn.ConnectorIdentifier = userName + conn.ConnectorCollectionName = "users" + conn.ConnectionName = "following" + Return Globals.client.GetConnections(conn) + End Function + + Public Shared Function GetFollowed(userName As String) As IList + Dim conn As Connection = New Connection() + conn.ConnectorIdentifier = userName + conn.ConnectorCollectionName = "users" + conn.ConnectionName = "followed" + Return Globals.client.GetConnections(conn) + End Function + + Public Shared Sub FollowUser(follower As String, followed As String) + Dim conn As Connection = New Connection() + conn.ConnecteeCollectionName = "users" + conn.ConnectorCollectionName = "users" + + conn.ConnectorIdentifier = follower + conn.ConnecteeIdentifier = followed + conn.ConnectionName = "following" + Globals.client.CreateConnection(conn) + End Sub + + Public Shared Sub AddFollower(follower As String, followed As String) + Dim conn As Connection = New Connection() + conn.ConnecteeCollectionName = "users" + conn.ConnectorCollectionName = "users" + + conn.ConnectorIdentifier = followed + conn.ConnecteeIdentifier = follower + conn.ConnectionName = "followed" + Globals.client.CreateConnection(conn) + End Sub + + Public Shared Sub DeleteFollowUser(follower As String, followed As String) + Dim conn As Connection = New Connection() + conn.ConnecteeCollectionName = "users" + conn.ConnectorCollectionName = "users" + + conn.ConnectorIdentifier = follower + conn.ConnecteeIdentifier = followed + conn.ConnectionName = "following" + Dim clist As IList = Globals.client.GetConnections(conn) + Globals.client.DeleteConnection(conn) + End Sub + + Public Shared Sub DeleteFollower(follower As String, followed As String) + Dim conn As Connection = New Connection() + conn.ConnecteeCollectionName = "users" + conn.ConnectorCollectionName = "users" + + conn.ConnectorIdentifier = followed + conn.ConnecteeIdentifier = follower + conn.ConnectionName = "followed" + Globals.client.DeleteConnection(conn) + End Sub + +End Class http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/messageeTutorial/README.md ---------------------------------------------------------------------- diff --git a/samples/messageeTutorial/README.md b/samples/messageeTutorial/README.md new file mode 100644 index 0000000..7a8bbf3 --- /dev/null +++ b/samples/messageeTutorial/README.md @@ -0,0 +1,15 @@ +usergrid-sample-.net-messagee +============================= +Directions for use + +1. Sign up for a free Apigee App Services account +2. In the organization that is created for you, create a user and give that user administrative privileges +3. Create an app in the organization +4. In the app, create as many test users as you like +5. Clone the following branch for the Usergrid sdk: https://github.com/apigee/usergrid-.net-sdk and build it +6. Clone this repository. Open the Messagee solution file in the top level folder. Add references to the .dll files located in the UsergridSdk\bin\debug folder to the project +7. Build Messagee +8. Run the solution. On the main screen choose the Settings menu item and input the admin user credentials, the org name and the application name + +At this point, the users for that app should be populated. Choosing a particular user and then choosing the User Settings menu option will allow you to control who that user is following +Connect a few users and do some posts. Posts are automatically routed to users who are connected as followers http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/App.xaml ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/App.xaml b/samples/notifications/Usergrid.Notifications/App.xaml new file mode 100644 index 0000000..486a2fd --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/App.xaml @@ -0,0 +1,27 @@ +<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"> +<!-- + /* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ + --> +</Application> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/App.xaml.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/App.xaml.cs b/samples/notifications/Usergrid.Notifications/App.xaml.cs new file mode 100644 index 0000000..eb079fb --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/App.xaml.cs @@ -0,0 +1,150 @@ +/* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ +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/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png b/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png new file mode 100644 index 0000000..76921ca Binary files /dev/null and b/samples/notifications/Usergrid.Notifications/Assets/Logo.scale-240.png differ http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png b/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png new file mode 100644 index 0000000..3166301 Binary files /dev/null and b/samples/notifications/Usergrid.Notifications/Assets/SmallLogo.scale-240.png differ http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png b/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png new file mode 100644 index 0000000..33f26b3 Binary files /dev/null and b/samples/notifications/Usergrid.Notifications/Assets/SplashScreen.scale-240.png differ http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png b/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png new file mode 100644 index 0000000..cfa54be Binary files /dev/null and b/samples/notifications/Usergrid.Notifications/Assets/Square71x71Logo.scale-240.png differ http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png b/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png new file mode 100644 index 0000000..47e084b Binary files /dev/null and b/samples/notifications/Usergrid.Notifications/Assets/StoreLogo.scale-240.png differ http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png b/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png new file mode 100644 index 0000000..6249d29 Binary files /dev/null and b/samples/notifications/Usergrid.Notifications/Assets/WideLogo.scale-240.png differ http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/BackgroundTask.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/BackgroundTask.cs b/samples/notifications/Usergrid.Notifications/BackgroundTask.cs new file mode 100644 index 0000000..1096ca8 --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/BackgroundTask.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.ApplicationModel.Background; + +namespace Usergrid.Notifications +{ + public sealed class ExampleBackgroundTask : IBackgroundTask + { + private static BackgroundTaskRegistration task; + public void Run(IBackgroundTaskInstance taskInstance) + { + var test = ""; + + } + public static void Register() + { + + foreach (var iter in BackgroundTaskRegistration.AllTasks) + { + IBackgroundTaskRegistration mytask = iter.Value; + if (mytask.Name == "ExampleBackgroundTask") + { + + mytask.Unregister(true); + break; + } + } + + + var builder = new BackgroundTaskBuilder(); + PushNotificationTrigger trigger = new PushNotificationTrigger(); + builder.SetTrigger(trigger); + builder.Name = "ExampleBackgroundTask"; + builder.TaskEntryPoint = "Usergrid.Notifications.ExampleBackgroundTask"; + + ExampleBackgroundTask.task = builder.Register(); + task.Progress += task_Progress; + + task.Completed += task_Completed; + + } + + static void task_Progress(BackgroundTaskRegistration sender, BackgroundTaskProgressEventArgs args) + { + + var test = "done"; + } + + static void task_Completed(BackgroundTaskRegistration sender, BackgroundTaskCompletedEventArgs args) + { + var test = "done"; + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Client/EntityResponse.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Client/EntityResponse.cs b/samples/notifications/Usergrid.Notifications/Client/EntityResponse.cs new file mode 100644 index 0000000..0be267a --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/Client/EntityResponse.cs @@ -0,0 +1,80 @@ +/* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ + +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace Usergrid.Notifications.Client +{ + public class EntityResponse : JObject + { + private HttpResponseMessage response; + + private EntityResponse(HttpResponseMessage response, JObject jObject) + : base() + { + this.response = response; + parseResponse(jObject); + } + + private void parseResponse(JObject jobject) + { + foreach (var kv in jobject) + { + this[kv.Key] = kv.Value; + } + } + + public HttpStatusCode Status + { + get { return this.response.StatusCode; } + } + + public static async Task<EntityResponse> Parse(HttpResponseMessage httpResponseMessage) + { + JObject jobject; + + using (var stream = await httpResponseMessage.Content.ReadAsStreamAsync()) + { + using (var reader = new StreamReader(stream, Encoding.UTF8)) + { + jobject = JObject.Parse(reader.ReadToEnd()); + } + } + + return new EntityResponse(httpResponseMessage, jobject); + } + + public bool StatusIsOk + { + get + { + return this.Status == HttpStatusCode.OK; + } + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Client/IUsergridClient.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Client/IUsergridClient.cs b/samples/notifications/Usergrid.Notifications/Client/IUsergridClient.cs new file mode 100644 index 0000000..5efbb9b --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/Client/IUsergridClient.cs @@ -0,0 +1,123 @@ +/* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ + +using Newtonsoft.Json.Linq; +using System; +using System.Net.Http; +using System.Threading.Tasks; +using Windows.Networking.PushNotifications; +namespace Usergrid.Notifications.Client +{ + /// <summary> + /// encapsulates usergrid calls, use UsergridFactory + /// </summary> + public interface IUsergridClient + { + /// <summary> + /// Authenticate your calls + /// </summary> + /// <param name="user"></param> + /// <param name="password"></param> + /// <param name="isManagement"></param> + /// <returns></returns> + Task Authenticate(string user, string password, bool isManagement); + /// <summary> + /// Send a message + /// </summary> + /// <param name="method"></param> + /// <param name="url"></param> + /// <param name="obj"></param> + /// <returns></returns> + Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj); + /// <summary> + /// Send a message + /// </summary> + /// <param name="method"></param> + /// <param name="url"></param> + /// <param name="obj"></param> + /// <param name="useManagementUrl"></param> + /// <returns></returns> + Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj, bool useManagementUrl); + /// <summary> + /// Reference the push client, you should call register before using + /// </summary> + IPushClient Push { get; } + + Exception LastException { get; } + + } + + /// <summary> + /// Only show http calls + /// </summary> + public interface IUsergridHttpClient + { + /// <summary> + /// Send Http call async + /// </summary> + /// <param name="method"></param> + /// <param name="url"></param> + /// <param name="obj"></param> + /// <param name="useManagementUrl">use management endpoint</param> + /// <returns></returns> + Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj, bool useManagementUrl); + /// <summary> + /// send Http call async + /// </summary> + /// <param name="method"></param> + /// <param name="url"></param> + /// <param name="obj"></param> + /// <returns></returns> + Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj); + } + + /// <summary> + /// Push client, call register + /// </summary> + public interface IPushClient + { + /// <summary> + /// the notifier you are currently using + /// </summary> + string Notifier { get; set; } + + /// <summary> + /// Device id in usergrid + /// </summary> + Guid DeviceId { get; set; } + /// <summary> + /// send a toast + /// </summary> + /// <param name="message"></param> + /// <returns></returns> + Task<bool> SendToast(string message); + Task<bool> SendRaw(string message); + /// <summary> + /// Send a badge update + /// </summary> + /// <param name="message"></param> + /// <returns></returns> + Task<bool> SendBadge<T>(T message); + + Exception LastException { get; } + + } + +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Client/PushClient.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Client/PushClient.cs b/samples/notifications/Usergrid.Notifications/Client/PushClient.cs new file mode 100644 index 0000000..7ccb391 --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/Client/PushClient.cs @@ -0,0 +1,185 @@ +/* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Windows.Networking.PushNotifications; +using Windows.Storage; + +namespace Usergrid.Notifications.Client +{ + public class PushClient : IPushClient + { + const string DEVICE_KEY = "currentDeviceId"; + private IUsergridHttpClient usergrid; + private ApplicationDataContainer settings; + private PushNotificationChannel channel; + private string userId; + + public PushClient(IUsergridHttpClient usergrid,string userId, string notifier) + { + this.usergrid = usergrid; + this.settings = ApplicationData.Current.LocalSettings; + this.Notifier = notifier; + this.userId = userId; + this.init().ContinueWith(t => + { + LastException = t.Exception; + } + ); + } + + + public async Task<bool> SendToast(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(Notifier, payload); + jsonObject.Add("payloads", payloads); + jsonObject.Add("debug", true); + var jsonResponse = await usergrid.SendAsync(HttpMethod.Post, String.Format("users/{1}/devices/{0}/notifications", this.DeviceId,userId), jsonObject); + return jsonResponse.StatusIsOk; + } + + public async Task<bool> SendBadge<T>(T 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("badge", new JValue(message)); + payloads.Add(Notifier, payload); + jsonObject.Add("payloads", payloads); + jsonObject.Add("debug", true); + var jsonResponse = await usergrid.SendAsync(HttpMethod.Post, String.Format("users/{1}/devices/{0}/notifications", this.DeviceId,userId), jsonObject); + return jsonResponse.StatusIsOk; + } + + + public async Task<bool> SendRaw(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("raw", message); + payloads.Add(Notifier, payload); + jsonObject.Add("payloads", payloads); + jsonObject.Add("debug", true); + var jsonResponse = await usergrid.SendAsync(HttpMethod.Post, String.Format("users/{1}/devices/{0}/notifications", this.DeviceId, userId), jsonObject); + return jsonResponse.StatusIsOk; + } + + private async Task init() + { + channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync().AsTask<PushNotificationChannel>(); + channel.PushNotificationReceived += channel_PushNotificationReceived; + ExampleBackgroundTask.Register(); + + if (settings.Values[DEVICE_KEY] == null) + { + Guid uuid = await registerDevice(true); + settings.Values.Add(DEVICE_KEY, uuid); + this.DeviceId = uuid; + } + else + { + object tempId; + settings.Values.TryGetValue(DEVICE_KEY, out tempId); + this.DeviceId = Guid.Parse(tempId.ToString()); + var device = await GetDevice(DeviceId); + if (device == null) + { + Guid uuid = await registerDevice(true); + settings.Values[DEVICE_KEY] = uuid; + this.DeviceId = uuid; + } + else + { + await registerDevice(false); + } + } + } + + void channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args) + { + var test = "test"; + if (args.NotificationType == PushNotificationType.Raw) + { + + } + } + + + private async Task<JToken> GetDevice(Guid deviceId) + { + var jsonResponse = await usergrid.SendAsync(HttpMethod.Get, "users/"+userId+"/devices/" + deviceId, null); + + if (jsonResponse.StatusIsOk) + { + var body = jsonResponse.GetValue("entities"); + return body != null && body.Value<JArray>().Count > 0 ? body.Value<JArray>()[0] : null; + } + else { return null; } + } + + private async Task<Guid> registerDevice(bool isNew) + { + JObject obj = new JObject(); + obj.Add(Notifier + ".notifier.id", new JValue(channel.Uri)); + var jsonResponse = await usergrid.SendAsync( + (isNew ? HttpMethod.Post : HttpMethod.Put), + "users/"+userId+"/devices/" + (isNew ? "" : this.DeviceId.ToString()), + obj + ); + + if (jsonResponse.StatusIsOk) + { + 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; } + public Guid DeviceId { get; set; } + public Exception LastException { get; set; } + + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Client/Usergrid.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Client/Usergrid.cs b/samples/notifications/Usergrid.Notifications/Client/Usergrid.cs new file mode 100644 index 0000000..977eb8b --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/Client/Usergrid.cs @@ -0,0 +1,122 @@ +/* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ + +using System; +using System.Threading.Tasks; +using System.Net; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Usergrid.Notifications.Client +{ + + /// <summary> + /// Usergrid client + /// </summary> + + public class Usergrid : IUsergridHttpClient, IUsergridClient + { + private string appUrl; + private string token; + private HttpClient client; + private IPushClient push; + private string managementUrl; + + /// <summary> + /// Constructor + /// </summary> + /// <param name="serverUrl"></param> + /// <param name="org"></param> + /// <param name="app"></param> + /// <param name="channel"></param> + internal Usergrid(string serverUrl, string org, string app, string userId, string password,string notifier) + { + string serverUrlWithSlash = serverUrl.EndsWith("/", StringComparison.CurrentCulture) ? serverUrl : serverUrl + "/"; + this.appUrl = String.Format("{0}{1}/{2}/", serverUrlWithSlash, org, app); + this.managementUrl = serverUrlWithSlash + "management/"; + this.client = new HttpClient(); + Authenticate(userId, password, false).ContinueWith(task => { + this.push = new PushClient(this, userId, notifier); + }); + } + + public async Task Authenticate(string user, string password, bool isManagement) + { + var jsonObject = new JObject(); + jsonObject.Add("username", user); + jsonObject.Add("password", password); + jsonObject.Add("grant_type", "password"); + + var response = await SendAsync(HttpMethod.Post,"token", jsonObject, isManagement); + + if (response.StatusIsOk) + { + this.token = response.GetValue("access_token").Value<String>(); + client.DefaultRequestHeaders.Add("Authorization", "Bearer "+ token); + } + else + { + throw new Exception("Authentication failed: "+response.ToString()); + } + } + + private async Task<EntityResponse> GetJsonResponse(HttpResponseMessage response) + { + return await EntityResponse.Parse(response); + } + + public async Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj) + { + return await SendAsync(method, url, obj, false); + } + + public async Task<EntityResponse> SendAsync(HttpMethod method, string url, object obj, bool useManagementUrl) + { + HttpRequestMessage message = new HttpRequestMessage(method, (useManagementUrl ? this.managementUrl : this.appUrl) + url); + if (obj != null) + { + message.Content = getJsonBody(obj); + } + message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue( "application/json")); + var response = await this.client.SendAsync(message); + return await EntityResponse.Parse(response); + } + + public IPushClient Push + { + get { return push; } + } + + private HttpContent getJsonBody(Object jsonObject) + { + return new StringContent(JsonConvert.SerializeObject(jsonObject)); + } + + + public Exception LastException + { + get; + set; + } + } + +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/MainPage.xaml ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/MainPage.xaml b/samples/notifications/Usergrid.Notifications/MainPage.xaml new file mode 100644 index 0000000..004eba9 --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/MainPage.xaml @@ -0,0 +1,39 @@ +<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}"> + <!-- + /* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ + --> + <Grid> + <TextBox x:Name="pushText" HorizontalAlignment="Left" Margin="46,10,0,0" TextWrapping="Wrap" Text="Push Text" VerticalAlignment="Top" Width="261" TextChanged="pushText_TextChanged"/> + <Button x:Name="SendToast" Content="Toast" HorizontalAlignment="Left" Margin="114,88,0,0" VerticalAlignment="Top" Click="Button_Click" Width="39"/> + <Button x:Name="Badge" Content="Badge" HorizontalAlignment="Left" Margin="114,157,0,0" VerticalAlignment="Top" Click="Badge_Click"/> + <TextBlock x:Name="Result" HorizontalAlignment="Left" Margin="46,295,0,0" TextWrapping="Wrap" Text="Did it work? " VerticalAlignment="Top" Height="49" Width="261" FontSize="25" SelectionChanged="Result_SelectionChanged"/> + <Button Content="Raw" HorizontalAlignment="Left" Margin="114,223,0,0" VerticalAlignment="Top" Click="Button_Click_1"/> + + </Grid> +</Page> http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs b/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs new file mode 100644 index 0000000..2625289 --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/MainPage.xaml.cs @@ -0,0 +1,143 @@ +using Newtonsoft.Json.Linq; +/* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ +using System; +using System.Threading.Tasks; +using Usergrid.Notifications.Client; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +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 IUsergridClient usergrid; + private string serverUrl; + private string org; + private string app; + private string notifier; + private string user; + private string password; + public MainPage() + { + this.InitializeComponent(); + //TODO: change me to your server + serverUrl = "http://10.0.1.20:8080/"; + //TODO: change me to your org + org = "test-organization"; + //TODO: change me to your app + app = "test-app"; + //TODO: change me to your notifier name + notifier = "windows"; + //TODO: change me to your user + user = "mobileuser"; + //TODO: change me to your password + password = "P@ssw0rd1"; + this.NavigationCacheMode = NavigationCacheMode.Required; + usergrid = new Client.Usergrid(serverUrl, org, app, user, password, notifier); + + } + + private async Task setup() + { + } + + /// <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 void pushText_TextChanged(object sender, TextChangedEventArgs e) + { + + } + + private async void Button_Click(object sender, RoutedEventArgs e) + { + Result.Text = "Sending...."; + + var message = this.pushText.Text; + if (await usergrid.Push.SendToast(message)) + { + Result.Text = "It did! :)"; + } + else + { + Result.Text = "It did not! :("; + } + } + + private async void Badge_Click(object sender, RoutedEventArgs e) + { + Result.Text = "Sending...."; + + if (await usergrid.Push.SendBadge<int>(new Random().Next(1,100))) + { + Result.Text = "It did! :)"; + } + else + { + Result.Text = "It did not! :("; + } + } + + private void Result_SelectionChanged(object sender, RoutedEventArgs e) + { + + } + + public AggregateException LastException { get; set; } + + private async void Button_Click_1(object sender, RoutedEventArgs e) + { + Result.Text = "Sending...."; + + var message = this.pushText.Text; + + JObject obj = new JObject(); + obj.Add("message", message); + if (await usergrid.Push.SendRaw(message)) + { + Result.Text = "It did! :)"; + } + else + { + Result.Text = "It did not! :("; + } + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/MyBackgroundTask.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/MyBackgroundTask.cs b/samples/notifications/Usergrid.Notifications/MyBackgroundTask.cs new file mode 100644 index 0000000..9d8a446 --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/MyBackgroundTask.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.ApplicationModel.Background; + +namespace Usergrid.Notifications +{ + + public sealed class ExampleBackgroundTask : IBackgroundTask + { + public void Run(IBackgroundTaskInstance taskInstance) + { + + } + } +} http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Package.StoreAssociation.xml ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Package.StoreAssociation.xml b/samples/notifications/Usergrid.Notifications/Package.StoreAssociation.xml new file mode 100644 index 0000000..c6278a4 --- /dev/null +++ b/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/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Package.appxmanifest ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Package.appxmanifest b/samples/notifications/Usergrid.Notifications/Package.appxmanifest new file mode 100644 index 0000000..2eec1a9 --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/Package.appxmanifest @@ -0,0 +1,61 @@ +<?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"> + <!-- + /* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ + --> + <Identity Name="15661feldrocker.usergridsample" Publisher="CN=AC3A1EB7-E4EA-48C0-9556-C37AA8BAE0CF" Version="1.1.0.1" /> + <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> + <Extensions> + <Extension Category="windows.backgroundTasks" EntryPoint="Usergrid.Notifications.ExampleBackgroundTask"> + <BackgroundTasks> + <Task Type="pushNotification" /> + </BackgroundTasks> + </Extension> + + </Extensions> + </Application> + </Applications> + <Capabilities> + <Capability Name="internetClientServer" /> + </Capabilities> +</Package> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Properties/AssemblyInfo.cs b/samples/notifications/Usergrid.Notifications/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..daf5838 --- /dev/null +++ b/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/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj b/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj new file mode 100644 index 0000000..b2361e8 --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.csproj @@ -0,0 +1,143 @@ +<?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="BackgroundTask.cs" /> + <Compile Include="Client\EntityResponse.cs" /> + <Compile Include="Client\IUsergridClient.cs" /> + <Compile Include="Client\PushClient.cs" /> + <Compile Include="MainPage.xaml.cs"> + <DependentUpon>MainPage.xaml</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Client\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)' < '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/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.sln ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.sln b/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.sln new file mode 100644 index 0000000..79e96ec --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/Usergrid.Notifications.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Usergrid.Notifications", "Usergrid.Notifications.csproj", "{EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}" +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 + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|ARM.ActiveCfg = Debug|ARM + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|ARM.Build.0 = Debug|ARM + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|ARM.Deploy.0 = Debug|ARM + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|x86.ActiveCfg = Debug|x86 + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|x86.Build.0 = Debug|x86 + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Debug|x86.Deploy.0 = Debug|x86 + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|Any CPU.Build.0 = Release|Any CPU + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|Any CPU.Deploy.0 = Release|Any CPU + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|ARM.ActiveCfg = Release|ARM + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|ARM.Build.0 = Release|ARM + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|ARM.Deploy.0 = Release|ARM + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|x86.ActiveCfg = Release|x86 + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|x86.Build.0 = Release|x86 + {EB364B8E-B7C1-45C2-BF13-1CBF731EA8B6}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/Usergrid.Notifications/packages.config ---------------------------------------------------------------------- diff --git a/samples/notifications/Usergrid.Notifications/packages.config b/samples/notifications/Usergrid.Notifications/packages.config new file mode 100644 index 0000000..2a3ff3c --- /dev/null +++ b/samples/notifications/Usergrid.Notifications/packages.config @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <!-- + /* + * + * * Licensed to the Apache Software Foundation (ASF) under one or more + * * contributor license agreements. The ASF licenses this file to You + * * under the Apache License, Version 2.0 (the "License"); you may not + * * use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. For additional information regarding + * * copyright in this work, please see the NOTICE file in the top level + * * directory of this distribution. + * + */ + --> + <package id="Newtonsoft.Json" version="6.0.8" targetFramework="wpa81" /> +</packages> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/samples/notifications/packages/repositories.config ---------------------------------------------------------------------- diff --git a/samples/notifications/packages/repositories.config b/samples/notifications/packages/repositories.config new file mode 100644 index 0000000..deb9991 --- /dev/null +++ b/samples/notifications/packages/repositories.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<repositories> + <repository path="..\Usergrid.Notifications\packages.config" /> +</repositories> \ No newline at end of file
