Пример #1
0
 public void Handle(VideoAlbumAddedDeletedEvent message)
 {
     if (!message.IsAdded || message.OwnerId != this.TargetId)
     {
         return;
     }
     this.AlbumsVM.LoadData(true, false, (Action <BackendResult <VKList <VideoAlbum>, ResultCode> >)null, false);
 }
 public void Save(Action <bool> resultCallback)
 {
     this._isSaving = true;
     this.SetInProgress(true, "");
     if (this.IsNewAlbum)
     {
         VideoService.Instance.AddAlbum(this.Name, this.AlbumPrivacyVM.GetAsPrivacyInfo(), (Action <BackendResult <VideoAlbum, ResultCode> >)(res =>
         {
             this._isSaving = false;
             this.SetInProgress(false, "");
             if (res.ResultCode != ResultCode.Succeeded)
             {
                 Execute.ExecuteOnUIThread((Action)(() => GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", null)));
             }
             else
             {
                 EventAggregator current = EventAggregator.Current;
                 VideoAlbumAddedDeletedEvent addedDeletedEvent = new VideoAlbumAddedDeletedEvent();
                 addedDeletedEvent.AlbumId = this._albumId;
                 addedDeletedEvent.OwnerId = this._groupId > 0L ? -this._groupId : AppGlobalStateManager.Current.LoggedInUserId;
                 int num = 1;
                 addedDeletedEvent.IsAdded = num != 0;
                 current.Publish((object)addedDeletedEvent);
             }
             resultCallback(res.ResultCode == ResultCode.Succeeded);
         }), new long?(this._groupId));
     }
     else
     {
         VideoService.Instance.EditAlbum(this.Name, this._albumId, this.AlbumPrivacyVM.GetAsPrivacyInfo(), (Action <BackendResult <object, ResultCode> >)(res =>
         {
             this._isSaving = false;
             this.SetInProgress(false, "");
             if (res.ResultCode != ResultCode.Succeeded)
             {
                 Execute.ExecuteOnUIThread((Action)(() => GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", null)));
             }
             else
             {
                 EventAggregator.Current.Publish((object)new VideoAlbumEditedEvent()
                 {
                     AlbumId = this._albumId,
                     OwnerId = (this._groupId > 0L ? -this._groupId : AppGlobalStateManager.Current.LoggedInUserId),
                     Name    = this.Name,
                     Privacy = this.AlbumPrivacyVM.GetAsPrivacyInfo()
                 });
             }
             resultCallback(res.ResultCode == ResultCode.Succeeded);
         }), new long?(this._groupId));
     }
 }
Пример #3
0
 internal void HandleDelete()
 {
     if (MessageBox.Show(CommonResources.GenericConfirmation, CommonResources.VideoCatalog_DeleteAlbum, MessageBoxButton.OKCancel) != MessageBoxResult.OK)
     {
         return;
     }
     VideoService.Instance.DeleteAlbum(this._va.album_id, (Action <BackendResult <object, ResultCode> >)(res =>
     {
         if (res.ResultCode == ResultCode.Succeeded)
         {
             EventAggregator current = EventAggregator.Current;
             VideoAlbumAddedDeletedEvent addedDeletedEvent = new VideoAlbumAddedDeletedEvent();
             addedDeletedEvent.AlbumId = this._va.album_id;
             addedDeletedEvent.OwnerId = this._va.owner_id;
             int num = 0;
             addedDeletedEvent.IsAdded = num != 0;
             current.Publish(addedDeletedEvent);
         }
         else
         {
             GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
         }
     }), new long?(this._va.owner_id < 0L ? -this._va.owner_id : 0L));
 }