/// <summary> /// When Tile is checked, request Tile notifications /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void TileCheckBox_Checked() { if (HttpChannel.ChannelUri == null) { NotificationFlag &= ~NotificationFlagType.Tile; UpdateStatus("Channel not open!"); return; } NotificationFlag |= NotificationFlagType.Tile; SubscribeToTileNotifications(HttpChannel); }
// Constructor public TripService(NotificationFlagType notificationTypes) { NotifyData = new NotificationData(); NotificationFlag = notificationTypes; IsRawBound = false; Imagery = ImagerySet.Unknown; UpdateStatus("Starting..."); HttpChannel = EstablishChannel(); }
/// <summary> /// When Toast is checked, request Toast notifications /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void ToastCheckBox_Checked() { // // If there is no active channel, don't allow the check to occur, provides // positive feedback that it is not yet ready. // if (HttpChannel.ChannelUri == null) { NotificationFlag &= ~NotificationFlagType.Toast; UpdateStatus("Channel not open!"); return; } // // Add Toast to the Tile service Uri and subscribe to Toast eents // NotificationFlag |= NotificationFlagType.Toast; SubscribeToToastNotifications(HttpChannel); }
/// <summary> /// Establish a channel to the notification service and register for events. /// </summary> /// <returns>The notification channel</returns> /// <remarks>The channel may not be active on return.</remarks> private HttpNotificationChannel EstablishChannel() { HttpNotificationChannel httpChannel = null; try { // // First, try to pick up existing channel // httpChannel = HttpNotificationChannel.Find(ChannelName); if (httpChannel != null) { Trace("Channel Exists - no need to create a new one"); // // Unconditionally subscribe to all the events, inactive events will be ignored. // Service subscriptions occur when checkboxes selected // SubscribeToChannelEvents(httpChannel); if (httpChannel.IsShellTileBound) { NotificationFlag |= NotificationFlagType.Tile; } if (httpChannel.IsShellToastBound) { NotificationFlag |= NotificationFlagType.Toast; } } else { Trace("Trying to create a new channel..."); // // Create the channel // httpChannel = new HttpNotificationChannel(ChannelName, ServiceName); Trace("New Push Notification channel created successfully"); // // Unconditionally subscribe to all the events, inactive events will be ignored. // Service subscriptions occur when checkboxes selected // SubscribeToChannelEvents(httpChannel); Trace("Trying to open the channel"); httpChannel.Open(); } } catch (Exception ex) { UpdateStatus("Channel error: " + ex.Message); } return httpChannel; }
/// <summary> /// Clear the Tile notification request /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void TileCheckBox_Unchecked() { NotificationFlag &= ~NotificationFlagType.Tile; UnSubscribeToTileNotifications(HttpChannel); }
/// <summary> /// When Tile is checked, request Tile notifications /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void TileCheckBox_Checked() { if (HttpChannel.ChannelUri == null) { NotificationFlag &= ~NotificationFlagType.Tile; UpdateStatus("Channel not open!"); return; } NotificationFlag |= NotificationFlagType.Tile; SubscribeToTileNotifications(HttpChannel); }
/// <summary> /// Clear the Toast notification request /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void ToastCheckBox_Unchecked() { NotificationFlag &= ~NotificationFlagType.Toast; UnSubscribeToToastNotifications(HttpChannel); }
/// <summary> /// When Toast is checked, request Toast notifications /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void ToastCheckBox_Checked() { // // If there is no active channel, don't allow the check to occur, provides // positive feedback that it is not yet ready. // if (HttpChannel.ChannelUri == null) { NotificationFlag &= ~NotificationFlagType.Toast; UpdateStatus("Channel not open!"); return; } // // Add Toast to the Tile service Uri and subscribe to Toast eents // NotificationFlag |= NotificationFlagType.Toast; SubscribeToToastNotifications(HttpChannel); }
/// <summary> /// Clear the Raw notification request /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void RawCheckBox_Unchecked() { NotificationFlag &= ~NotificationFlagType.Raw; UnSubscribeToRawNotifications(HttpChannel); }
// Constructor public TripService(NotificationFlagType notificationTypes) { NotifyData = new NotificationData(); NotificationFlag = notificationTypes; IsRawBound = false; Imagery = ImagerySet.Unknown; UpdateStatus("Starting..."); HttpChannel = EstablishChannel(); }
/// <summary> /// Establish a channel to the notification service and register for events. /// </summary> /// <returns>The notification channel</returns> /// <remarks>The channel may not be active on return.</remarks> private HttpNotificationChannel EstablishChannel() { HttpNotificationChannel httpChannel = null; try { // // First, try to pick up existing channel // httpChannel = HttpNotificationChannel.Find(ChannelName); if (httpChannel != null) { Trace("Channel Exists - no need to create a new one"); // // Unconditionally subscribe to all the events, inactive events will be ignored. // Service subscriptions occur when checkboxes selected // SubscribeToChannelEvents(httpChannel); if (httpChannel.IsShellTileBound) { NotificationFlag |= NotificationFlagType.Tile; } if (httpChannel.IsShellToastBound) { NotificationFlag |= NotificationFlagType.Toast; } } else { Trace("Trying to create a new channel..."); // // Create the channel // httpChannel = new HttpNotificationChannel(ChannelName, ServiceName); Trace("New Push Notification channel created successfully"); // // Unconditionally subscribe to all the events, inactive events will be ignored. // Service subscriptions occur when checkboxes selected // SubscribeToChannelEvents(httpChannel); Trace("Trying to open the channel"); httpChannel.Open(); } } catch (Exception ex) { UpdateStatus("Channel error: " + ex.Message); } return(httpChannel); }
/// <summary> /// Clear the Tile notification request /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void TileCheckBox_Unchecked() { NotificationFlag &= ~NotificationFlagType.Tile; UnSubscribeToTileNotifications(HttpChannel); }
/// <summary> /// Clear the Toast notification request /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void ToastCheckBox_Unchecked() { NotificationFlag &= ~NotificationFlagType.Toast; UnSubscribeToToastNotifications(HttpChannel); }
/// <summary> /// Clear the Raw notification request /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> public void RawCheckBox_Unchecked() { NotificationFlag &= ~NotificationFlagType.Raw; UnSubscribeToRawNotifications(HttpChannel); }