/// <summary> /// On subscription change, reset the subscriber tile counter if exist. /// </summary> protected override void OnSubscribed(SubscriptionEventArgs e) { // Create a tile message to reset tile count. var tileMsg = new TilePushNotificationMessage(MessageSendPriority.High) { Count = 0, BackgroundImageUri = BackgroundImageUri, Title = Title }; tileMsg.SendAsync(e.Subscription.ChannelUri, Log, Log); ResetCounter(e.Subscription.UserName); }
/// <summary> /// Once an application is activated again (the client side phone application /// has subscription logic on startup), try to update the tile again. /// In case that the application is not pinned, send raw notification message /// to the client, asking to pin the application. This raw notification message /// has to be well-known and handled by the client side phone application. /// In our case the raw message is AskToPin. /// </summary> protected override void OnSubscribed(SubscriptionEventArgs args) { // Asynchronously try to send Tile message to the relevant subscriber // with data already sent before so the tile won't change. var tileMsg = GetOrCreateMessage(args.Subscription.UserName, false); tileMsg.SendAsync( args.Subscription.ChannelUri, result => { Log(result); OnMessageSent(args.Subscription.UserName, result); }, Log); }
private void PushService_Subscribed(object sender, SubscriptionEventArgs args) { OnSubscribed(args); }
/// <summary> /// Override this to add logic when clients login. /// </summary> protected virtual void OnSubscribed(SubscriptionEventArgs args) { }
private void OnSubscribed(SubscriptionEventArgs args) { if (Subscribed != null) { Subscribed(this, args); } }