public void SubscribeUnsubscribe() { if (!this.IsSubscribed) { WallService.Current.WallSubscriptionsSubscribe(-this._gid, (Action <BackendResult <ResponseWithId, ResultCode> >)(res => { GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, CommonResources.NewsPostsNotificationsAreEnabled, (VKRequestsDispatcher.Error)null); if (res.ResultCode != ResultCode.Succeeded || this._group == null) { return; } this._group.IsSubscribed = !this._group.IsSubscribed; this.NotifyPropertyChanged <bool>((() => this.IsSubscribed)); EventAggregator current = EventAggregator.Current; GroupSubscribedUnsubscribedEvent unsubscribedEvent = new GroupSubscribedUnsubscribedEvent(); unsubscribedEvent.group = this._group; int num = this.IsSubscribed ? 1 : 0; unsubscribedEvent.IsSubscribed = num != 0; current.Publish(unsubscribedEvent); })); } else { WallService current1 = WallService.Current; List <long> ownerIds = new List <long>(); ownerIds.Add(-this._gid); Action <BackendResult <ResponseWithId, ResultCode> > callback = (Action <BackendResult <ResponseWithId, ResultCode> >)(res => { GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, CommonResources.NewsPostsNotificationsAreDisabled, (VKRequestsDispatcher.Error)null); if (res.ResultCode != ResultCode.Succeeded || this._group == null) { return; } this._group.IsSubscribed = !this._group.IsSubscribed; this.NotifyPropertyChanged <bool>((() => this.IsSubscribed)); EventAggregator current = EventAggregator.Current; GroupSubscribedUnsubscribedEvent unsubscribedEvent = new GroupSubscribedUnsubscribedEvent(); unsubscribedEvent.group = this._group; int num = this.IsSubscribed ? 1 : 0; unsubscribedEvent.IsSubscribed = num != 0; current.Publish(unsubscribedEvent); }); current1.WallSubscriptionsUnsubscribe(ownerIds, callback); } }
public void Handle(GroupSubscribedUnsubscribedEvent message) { if (this._manageSourcesMode != ManageSourcesMode.ManagePushNotificationsSources) { return; } if (message.IsSubscribed) { this.GroupsVM.LoadData(true, false, null, false); } else { GroupHeader groupHeader = (GroupHeader)Enumerable.FirstOrDefault <GroupHeader>(this.GroupsVM.Collection, (Func <GroupHeader, bool>)(fh => fh.Group.id == message.group.id)); if (groupHeader == null) { return; } this.GroupsVM.Delete(groupHeader); } }
public void Handle(GroupSubscribedUnsubscribedEvent message) { if (this._manageSourcesMode != ManageSourcesMode.ManagePushNotificationsSources) { return; } if (message.IsSubscribed) { this.GroupsVM.LoadData(true, false, (Action <BackendResult <ProfilesAndGroups, ResultCode> >)null, false); } else { GroupHeader groupHeader = this.GroupsVM.Collection.FirstOrDefault <GroupHeader>((Func <GroupHeader, bool>)(fh => fh.Group.id == message.group.id)); if (groupHeader == null) { return; } this.GroupsVM.Delete(groupHeader); } }