SnapDotNet.Apps.App.InitNotificationsAsync C# (CSharp) Метод

InitNotificationsAsync() приватный статический Метод

private static InitNotificationsAsync ( ) : void
Результат void
		private static async void InitNotificationsAsync()
		{
#if WINDOWS_PHONE_APP
			DeviceIdent = Sha.Sha256(BitConverter.ToString(HardwareIdentification.GetPackageSpecificToken(null).Id.ToArray()));
			var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
			channel.PushNotificationReceived += (sender, args) =>
			{
				switch (args.NotificationType)
				{
					case PushNotificationType.Toast:
						if (args.ToastNotification == null) return;
						Debug.WriteLine(args.ToastNotification);

						var s = args.ToastNotification.Content.SelectSingleNode("/toast/visual/binding/text[@id = '2']");
						var notificationString = "";
						if (s != null) notificationString = s.InnerText;

						if (notificationString.ToLowerInvariant().StartsWith("new snap from"))
							// New snap, we need to update the tile's badge
							Settings.UnreadSnapCount += 1;
						
						// Update Live Tile
						UpdateLiveTile(notificationString);

						Debug.WriteLine("*** Everything did aite");

						// Tell the app to navigate to snaps page
						args.ToastNotification.Activated += (notification, o) =>
						{
							CurrentFrame.Navigate(typeof(SnapsPage));
							UpdateSnapchatData();
						};
						args.ToastNotification.Group = "Snaps";
						break;
				}
			};

			try
			{
				// Request a push notification channel.
				await MobileService.GetPush().RegisterNativeAsync(channel.Uri, new[] { DeviceIdent });
			}
			catch (Exception exception)
			{
				if (exception.HResult == 0x803E0103) return; // register request is already in progress

				if (exception.HResult == 0x80131509) // the SDN WNS service is down
				{
					SnazzyDebug.WriteLine(exception);
					return;
				}

				throw;
			}
#endif
		}