public MainPage() { InitializeComponent(); _service = NotificationService.GetCurrent("3A43A-A3EAB", null, null); _service.OnPushTokenReceived += (sender, args) => { tbPushToken.Text = args.ToString(); }; _service.OnPushTokenFailed += (sender, args) => { tbPushToken.Text = args.ToString(); }; _service.OnPushAccepted += (sender, args) => { tbPush.Text = args.ToString(); }; _service.SubscribeToPushService(); //tbPushToken.Text = _service.PushToken; ResetMyMainTile(); }
private void Subscribe_Tapped(object sender_, TappedRoutedEventArgs e) { try { string _PWId = PWID.Text; service = PushSDK.NotificationService.GetCurrent(_PWId, "", null); if (Host.Text.EndsWith("/")) { service.SetHost(Host.Text); } else { service.SetHost(Host.Text + "/"); } service.OnPushAccepted += service_OnPushAccepted; service.SubscribeToPushService(); if (service.PushToken != null) { tbPushToken.Text = service.PushToken; } SubButton.IsEnabled = false; UnSubButton.IsEnabled = true; } catch (Exception ex) { MessageDialog dialog = new MessageDialog("Host does not exist: \n" + ex.Message); dialog.ShowAsync(); } }
public static NotificationService GetCurrent(string appID, string pushPage, IEnumerable<string> tileTrustedServers) { return _instance ?? (_instance = tileTrustedServers == null ? new NotificationService(appID, pushPage) : new NotificationService(appID, pushPage, tileTrustedServers)); }
public static NotificationService GetCurrent(string appID, string pushPage) { if(appID == null) appID = (String) ApplicationData.Current.LocalSettings.Values["com.pushwoosh.appid"]; if (appID == null) return null; if (appID != (String)ApplicationData.Current.LocalSettings.Values["com.pushwoosh.appid"]) _instance = null; return _instance ?? (_instance = new NotificationService(appID)); }
public static NotificationService GetCurrent(string appID, string pushPage, IEnumerable <string> tileTrustedServers) { return(_instance ?? (_instance = tileTrustedServers == null ? new NotificationService(appID, pushPage) : new NotificationService(appID, pushPage, tileTrustedServers))); }