コード例 #1
0
 public void ChangeTitle(string newTitle, Action errorAction)
 {
     if (string.IsNullOrWhiteSpace(newTitle) || newTitle.Length < 2)
     {
         errorAction();
     }
     else
     {
         this.SetInProgress(true, "");
         this.IsTitleBoxEnabled = false;
         BackendServices.ChatService.EditChat(this._chatId, newTitle, (Action<BackendResult<VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode>>)(result => Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (result.ResultCode == ResultCode.Succeeded)
             {
                 this._chatInformation.chat.title = newTitle;
                 this.NotifyPropertyChanged<string>((Expression<Func<string>>)(() => this.Title));
             }
             else
             {
                 errorAction();
                 GenericInfoUC.ShowBasedOnResult(result.ResultCode, "", (VKRequestsDispatcher.Error)null);
             }
             this.SetInProgress(false, "");
             this.IsTitleBoxEnabled = true;
         }))));
     }
 }
コード例 #2
0
 private void PerformLogin(Action <bool> resultCallback)
 {
     if (this.IsInProgress)
     {
         return;
     }
     this.SetInProgress(true, "");
     LoginService.Instance.GetAccessToken(this._registrationPhoneNumberVM.PhoneNumberString, this._registrationPasswordVM.PasswordStr, (Action <BackendResult <AutorizationData, ResultCode> >)(result =>
     {
         this.SetInProgress(false, "");
         Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (result.ResultCode == ResultCode.Succeeded)
             {
                 this.HandleLogin(result);
                 resultCallback(true);
             }
             else
             {
                 GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", (VKRequestsDispatcher.Error)null);
                 resultCallback(false);
             }
         }));
     }));
 }
コード例 #3
0
 public void Save()
 {
     if (!this.CanSave)
     {
         return;
     }
     this.IsSaving = true;
     this.SetInProgress(true, "");
     AccountService.Instance.SaveSettingsAccountInfo(this._updateDictionary, (Action <BackendResult <SaveProfileResponse, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
     {
         this.IsSaving = false;
         this.SetInProgress(false, "");
         if (res.ResultCode == ResultCode.Succeeded)
         {
             if (this._updateDictionary.ContainsKey("first_name") || this._updateDictionary.ContainsKey("last_name"))
             {
                 int num = (int)MessageBox.Show(CommonResources.Settings_EditProfile_ChangeNameRequestDesc, CommonResources.Settings_EditProfile_ChangeNameRequest, MessageBoxButton.OK);
             }
             EventAggregator.Current.Publish((object)new BaseDataChangedEvent()
             {
                 IsProfileUpdateRequired = true
             });
             Navigator.Current.GoBack();
         }
         else
         {
             GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
         }
     }))) /*, this._uploadResponseData*/);
 }
コード例 #4
0
        internal void CancelNameRequest()
        {
            if (this._profileInfo == null || this._profileInfo.name_request == null || (this._profileInfo.name_request.id == 0L || this.IsSaving))
            {
                return;
            }
            this.IsSaving = true;
            this.SetInProgress(true, "");
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["cancel_request_id"] = this._profileInfo.name_request.id.ToString();
            AccountService.Instance.SaveSettingsAccountInfo(parameters, (Action <BackendResult <SaveProfileResponse, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                this.IsSaving = false;
                this.SetInProgress(false, "");
                if (res.ResultCode == ResultCode.Succeeded)
                {
                    this._profileInfo.name_request = (NameChangeRequest)null;
                    this.NotifyPropertyChanged <bool>((System.Linq.Expressions.Expression <Func <bool> >)(() => this.HaveNameRequestInProgress));
                }
                else
                {
                    GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
                }
            }))), (UploadPhotoResponseData)null);
        }
コード例 #5
0
 public void LoadData()
 {
     if (this._isLoading)
     {
         return;
     }
     this._isLoading = true;
     base.SetInProgress(true, "");
     AccountService.Instance.GetSettingsAccountInfo(delegate(BackendResult <SettingsAccountInfo, ResultCode> res)
     {
         base.SetInProgress(false, "");
         if (res.ResultCode != ResultCode.Succeeded)
         {
             GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", null);
         }
         else
         {
             Execute.ExecuteOnUIThread(delegate
             {
                 this.ReadData(res.ResultData);
             });
         }
         this._isLoading = false;
     });
 }
コード例 #6
0
        public void LeaveChat()
        {
            this.IsChatLeaving = true;
            this.SetInProgress(true, "");
            IChatService chatService      = BackendServices.ChatService;
            long         chatId           = this._chatId;
            List <long>  usersToBeRemoved = new List <long>();

            usersToBeRemoved.Add(AppGlobalStateManager.Current.LoggedInUserId);
            Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> > callback = (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    this._navigationService.RemoveBackEntrySafe();
                    this._navigationService.GoBackSafe();
                }
                else
                {
                    GenericInfoUC.ShowBasedOnResult(result.ResultCode, "", (VKRequestsDispatcher.Error)null);
                }
                this.SetInProgress(false, "");
                this.IsChatLeaving = false;
            })));

            chatService.RemoveChatUsers(chatId, usersToBeRemoved, callback);
        }
コード例 #7
0
        public void ExcludeMember(ChatMember member)
        {
            this.SetInProgress(true, "");
            member.ExcludeButtonVisibility = Visibility.Collapsed;
            IChatService chatService      = BackendServices.ChatService;
            long         chatId           = this._chatId;
            List <long>  usersToBeRemoved = new List <long>();

            usersToBeRemoved.Add(member.Id);
            Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> > callback = (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    this.Members.Remove(member);
                }
                else
                {
                    member.ExcludeButtonVisibility = Visibility.Visible;
                    GenericInfoUC.ShowBasedOnResult(result.ResultCode, "", (VKRequestsDispatcher.Error)null);
                }
                this.SetInProgress(false, "");
            })));

            chatService.RemoveChatUsers(chatId, usersToBeRemoved, callback);
        }
コード例 #8
0
 internal void DeletePhoto()
 {
     this.SetInProgress(true, "");
     AccountService.Instance.DeleteProfilePhoto((Action <BackendResult <User, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
     {
         this.SetInProgress(false, "");
         if (res.ResultCode != ResultCode.Succeeded)
         {
             return;
         }
         if (this._profileInfo != null)
         {
             if (AppGlobalStateManager.Current.GlobalState.LoggedInUser == null)
             {
                 return;
             }
             AppGlobalStateManager.Current.GlobalState.LoggedInUser.photo_max = res.ResultData.photo_max;
             EventAggregator.Current.Publish((object)new BaseDataChangedEvent()
             {
                 IsProfileUpdateRequired = true
             });
         }
         else
         {
             GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
         }
     }))));
 }
コード例 #9
0
        public void CancelTransfer(Action callback = null)
        {
            FullscreenLoader loader = new FullscreenLoader();

            loader.Show(null, true);
            MoneyTransfersService.DeclineTransfer(this.Transfer.id, (Action <BackendResult <int, ResultCode> >)(result =>
            {
                loader.Hide(false);
                ResultCode resultCode = result.ResultCode;
                if (resultCode == ResultCode.Succeeded)
                {
                    this.Transfer.status = 2;
                    EventAggregator.Current.Publish(new MoneyTransferDeclinedEvent(this.Transfer));
                    Action action = callback;
                    if (action == null)
                    {
                        return;
                    }
                    action.Invoke();
                }
                else
                {
                    GenericInfoUC.ShowBasedOnResult(resultCode, "", (VKRequestsDispatcher.Error)null);
                }
            }));
        }
コード例 #10
0
 public void UpdatePhoto(Stream photoStream, Rect crop)
 {
     this.IsPhotoChanging = true;
     this.SetInProgress(true, "");
     ImagePreprocessor.PreprocessImage(photoStream, VKConstants.ResizedImageSize, true, (Action<ImagePreprocessResult>)(resized =>
     {
         Stream stream = resized.Stream;
         byte[] photoData = ImagePreprocessor.ReadFully(stream);
         stream.Close();
         BackendServices.MessagesService.UpdateChatPhoto(this.ChatId, photoData, ImagePreprocessor.GetThumbnailRect((double)resized.Width, (double)resized.Height, crop), (Action<BackendResult<ChatInfoWithMessageId, ResultCode>>)(result => Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (result.ResultCode == ResultCode.Succeeded)
             {
                 this._chatInformation.chat.photo_200 = result.ResultData.chat.photo_200;
                 this.NotifyPropertyChanged<string>((Expression<Func<string>>)(() => this.Photo));
                 this.NotifyPropertyChanged<Visibility>((Expression<Func<Visibility>>)(() => this.PhotoPlaceholderVisibility));
                 this.NotifyPropertyChanged<bool>((Expression<Func<bool>>)(() => this.IsPhotoMenuEnabled));
             }
             else
                 GenericInfoUC.ShowBasedOnResult(result.ResultCode, "", (VKRequestsDispatcher.Error)null);
             this.SetInProgress(false, "");
             this.IsPhotoChanging = false;
         }))));
     }));
 }
コード例 #11
0
        private static void HandleStorePurchaseError(BackendResult <StorePurchaseResult, ResultCode> result, Action callback = null)
        {
            ResultCode resultCode = result.ResultCode;

            switch (resultCode)
            {
            case ResultCode.Succeeded:
                if (result.ResultData != null && result.ResultData.state < 0)
                {
                    Execute.ExecuteOnUIThread((Action)(() => new GenericInfoUC(2000).ShowAndHideLater(result.ResultData.error_message ?? CommonResources.UnableToCompletePurchase, null)));
                    break;
                }
                break;

            case ResultCode.ValidationCancelledOrFailed:
                return;

            case ResultCode.ConfirmationCancelled:
                return;

            case ResultCode.BalanceRefillCancelled:
                return;

            default:
                GenericInfoUC.ShowBasedOnResult((int)resultCode, "", (VKRequestsDispatcher.Error)null);
                break;
            }
            if (callback == null)
            {
                return;
            }
            callback();
        }
コード例 #12
0
        internal void AddRemoveToMyVideos()
        {
            if (this._isAddingRemoving)
            {
                return;
            }
            this._isAddingRemoving = false;
            bool add = this.CanAddToMyVideos;

            VideoService.Instance.AddRemovedToFromAlbum(add, AppGlobalStateManager.Current.LoggedInUserId, VideoAlbum.ADDED_ALBUM_ID, this.OwnerId, this.VideoId, (Action <BackendResult <ResponseWithId, ResultCode> >)(res =>
            {
                this._isAddingRemoving = false;
                string successString   = add ? CommonResources.VideoNew_VideoHasBeenAddedToMyVideos : CommonResources.VideoNew_VideoHasBeenRemovedFromMyVideos;
                GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, successString, null);
                if (res.ResultCode != ResultCode.Succeeded || this._likesCommentsData == null || this._likesCommentsData.Albums == null)
                {
                    return;
                }
                if (add)
                {
                    this._likesCommentsData.Albums.Add(VideoAlbum.ADDED_ALBUM_ID);
                }
                else
                {
                    this._likesCommentsData.Albums.Remove(VideoAlbum.ADDED_ALBUM_ID);
                }
            }));
        }
コード例 #13
0
ファイル: PhotoViewModel.cs プロジェクト: Makzz90/VKClient_re
 public void AddDocument()
 {
     if (this._doc == null || this._isGifAdded || this._isAddingDoc)
     {
         return;
     }
     this._isAddingDoc = true;
     this.SetInProgressMain(true, "");
     DocumentsService.Current.Add(this._doc.owner_id, this._doc.id, this._doc.access_key, (Action <BackendResult <VKClient.Audio.Base.ResponseWithId, ResultCode> >)(res =>
     {
         this._isAddingDoc = false;
         this.SetInProgressMain(false, "");
         if (res.ResultCode == ResultCode.Succeeded)
         {
             this._isGifAdded = true;
             // ISSUE: type reference
             // ISSUE: method reference
             this.NotifyPropertyChanged <Visibility>((System.Linq.Expressions.Expression <Func <Visibility> >)(() => this.CanAddVisibility));
             this.NotifyPropertyChanged <Visibility>((System.Linq.Expressions.Expression <Func <Visibility> >)(() => this.AddedVisibility));
             GenericInfoUC.ShowBasedOnResult(0, CommonResources.FileIsSavedInDocuments, (VKRequestsDispatcher.Error)null);
         }
         else if (res.ResultCode == ResultCode.WrongParameter && res.Error.error_msg.Contains("already added"))
         {
             GenericInfoUC.ShowBasedOnResult(0, CommonResources.FileIsAlreadySavedInDocuments, (VKRequestsDispatcher.Error)null);
         }
         else
         {
             GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", null);
         }
     }));
 }
コード例 #14
0
        public void DeletePhoto(Photo photo)
        {
            Func <AlbumPhoto, bool> func;

            PhotosService.Current.DeletePhoto(photo.pid, this.OwnerId, (Action <BackendResult <ResponseWithId, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (res.ResultCode == ResultCode.Succeeded)
                {
                    AlbumPhoto albumPhoto = this._albumPhotos.FirstOrDefault <AlbumPhoto>((func = (Func <AlbumPhoto, bool>)(ap => ap.Photo.pid == photo.pid)));
                    if (albumPhoto != null)
                    {
                        this._albumPhotos.Remove(albumPhoto);
                        this.RebindHeadersToAlbumPhotos();
                        this.PhotosCount = this.PhotosCount - 1;
                        --this._photosGenCol.TotalCount;
                    }
                    EventAggregator.Current.Publish((object)new PhotoDeletedFromAlbum()
                    {
                        OwnerId = this.OwnerId,
                        AlbumId = this._albumId,
                        PhotoId = photo.pid
                    });
                    this.UpdateThumbAfterPhotosMoving();
                }
                else
                {
                    GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", null);
                }
            }))));
        }
コード例 #15
0
        public void AddMember(User user)
        {
            this.IsMemberAdding = true;
            this.SetInProgress(true, "");
            IChatService chatService = BackendServices.ChatService;
            long         chatId      = this._chatId;
            List <long>  userIds     = new List <long>();

            userIds.Add(user.id);
            Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> > callback = (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    User loggedInUser = AppGlobalStateManager.Current.GlobalState.LoggedInUser;
                    this.Members.Add(new ChatMember(new ChatUser(user, loggedInUser.id), loggedInUser, long.Parse(this._chatInformation.chat.admin_id)));
                }
                else
                {
                    GenericInfoUC.ShowBasedOnResult(result.ResultCode, "", (VKRequestsDispatcher.Error)null);
                }
                this.SetInProgress(false, "");
                this.IsMemberAdding = false;
            })));

            chatService.AddChatUsers(chatId, userIds, callback);
        }
コード例 #16
0
        public void CreateCommunity()
        {
            string type               = "group";
            int    subtype            = 0;
            bool?  publicPageSelected = this.IsPublicPageSelected;
            bool   flag1              = true;

            if ((publicPageSelected.GetValueOrDefault() == flag1 ? (publicPageSelected.HasValue ? 1 : 0) : 0) != 0)
            {
                type = "public";
                bool?isPlaceSelected = this.IsPlaceSelected;
                bool flag2           = true;
                if ((isPlaceSelected.GetValueOrDefault() == flag2 ? (isPlaceSelected.HasValue ? 1 : 0) : 0) != 0)
                {
                    subtype = 1;
                }
                else
                {
                    bool?isCompanySelected = this.IsCompanySelected;
                    bool flag3             = true;
                    if ((isCompanySelected.GetValueOrDefault() == flag3 ? (isCompanySelected.HasValue ? 1 : 0) : 0) != 0)
                    {
                        subtype = 2;
                    }
                    else
                    {
                        bool?isPersonSelected = this.IsPersonSelected;
                        bool flag4            = true;
                        subtype = (isPersonSelected.GetValueOrDefault() == flag4 ? (isPersonSelected.HasValue ? 1 : 0) : 0) == 0 ? 4 : 3;
                    }
                }
            }
            else
            {
                bool?isEventSelected = this.IsEventSelected;
                bool flag2           = true;
                if ((isEventSelected.GetValueOrDefault() == flag2 ? (isEventSelected.HasValue ? 1 : 0) : 0) != 0)
                {
                    type = "event";
                }
            }
            this.SetInProgress(true, "");
            this.IsFormEnabled = false;
            GroupsService.Current.CreateCommunity(this.Name, type, subtype, (Action <BackendResult <Group, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    EventAggregator.Current.Publish((object)new GroupMembershipStatusUpdated(result.ResultData.id, true));
                    Navigator.Current.NavigateToGroup(result.ResultData.id, "", false);
                    this._navigationService.RemoveBackEntry();
                }
                else
                {
                    this.SetInProgress(false, "");
                    this.IsFormEnabled = true;
                    GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", null);
                }
            }))));
        }
コード例 #17
0
        public void SavePoll(Action <Poll> successCallback)
        {
            if (this.IsInProgress)
            {
                return;
            }
            this.SetInProgress(true, "");
            this.NotifyPropertyChanged <bool>((Expression <Func <bool> >)(() => this.CanSave));
            if (this._mode == CreateEditPollViewModel.Mode.Create)
            {
                PollService.Current.CreatePoll(this.Question, this.IsAnonymous, this._ownerId, this.ValidPollOptions.Select <PollOption, string>((Func <PollOption, string>)(p => p.Text)).ToList <string>(), (Action <BackendResult <Poll, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
                {
                    this.SetInProgress(false, "");
                    this.NotifyPropertyChanged <bool>((Expression <Func <bool> >)(() => this.CanSave));
                    if (res.ResultCode == ResultCode.Succeeded)
                    {
                        successCallback(res.ResultData);
                    }
                    else
                    {
                        GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
                    }
                }))));
            }
            else
            {
                List <string>            list1  = this.ValidPollOptions.Where <PollOption>((Func <PollOption, bool>)(p => p.AnswerId == 0L)).Select <PollOption, string>((Func <PollOption, string>)(p => p.Text)).ToList <string>();
                IEnumerable <PollOption> source = this.ValidPollOptions.Where <PollOption>((Func <PollOption, bool>)(p =>
                {
                    if (p.AnswerId != 0L)
                    {
                        return(p.IsChanged);
                    }
                    return(false);
                }));
                Func <PollOption, string> func = (Func <PollOption, string>)(p => p.AnswerId.ToString());

                Func <PollOption, string> keySelector = new Func <PollOption, string>(p => p.Text);


                Dictionary <string, string> dictionary = source.ToDictionary <PollOption, string, string>(keySelector, (Func <PollOption, string>)(p => p.Text));
                List <long> list2 = this._initialPoll.answers.Select <Answer, long>((Func <Answer, long>)(a => a.id)).Except <long>(this.ValidPollOptions.Select <PollOption, long>((Func <PollOption, long>)(p => p.AnswerId))).ToList <long>();
                PollService.Current.EditPoll(this._ownerId, this._pollId, this.Question, list1, dictionary, list2, (Action <BackendResult <Poll, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
                {
                    this.SetInProgress(false, "");
                    this.NotifyPropertyChanged <bool>((Expression <Func <bool> >)(() => this.CanSave));
                    if (res.ResultCode == ResultCode.Succeeded)
                    {
                        successCallback(res.ResultData);
                    }
                    else
                    {
                        GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
                    }
                }))));
            }
        }
コード例 #18
0
 private static void ReportAdWallPost(string adData)
 {
     PickerUC.ShowPickerFor(ReportContentHelper.GetPredefinedAdReportReasons(), (PickableItem)null, (Action <PickableItem>)(pi => AdsIntService.ReportAd(adData, (ReportAdReason)pi.ID, (Action <BackendResult <VKClient.Audio.Base.ResponseWithId, ResultCode> >)(res =>
     {
         EventAggregator.Current.Publish((object)new AdReportedEvent()
         {
             AdData = adData
         });
         GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, CommonResources.ReportSent, (VKRequestsDispatcher.Error)null);
     }))), (Action <PickableItem>)null, null, CommonResources.PostContains);
 }
コード例 #19
0
 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));
     }
 }
コード例 #20
0
 private void RequestVoiceCall(Action <bool> resultCallback)
 {
     if (this.IsInProgress)
     {
         return;
     }
     this.SetInProgress(true, "");
     SignUpService.Instance.SignUp(this._registrationPhoneNumberVM.PhoneNumberString, this._registrationProfileVM.FirstName, this._registrationProfileVM.LastName, true, this._registrationProfileVM.IsMale, this._sid, (Action <BackendResult <string, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
     {
         this.SetInProgress(false, "");
         GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
         resultCallback(res.ResultCode == ResultCode.Succeeded);
     }))));
 }
コード例 #21
0
 internal void UpdatePrivacy(EditPrivacyViewModel vm, PrivacyInfo pi)
 {
     AccountService.Instance.SetPrivacy(vm.Key, pi.ToString(), (Action <BackendResult <ResponseWithId, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
     {
         if (res.ResultCode != ResultCode.Succeeded)
         {
             GenericInfoUC.ShowBasedOnResult((int)res.ResultCode, "", (VKRequestsDispatcher.Error)null);
         }
         else
         {
             vm.ReadFromPrivacyInfo(pi);
         }
     }))));
 }
コード例 #22
0
        public void AcceptTransfer()
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
//      MoneyTransferViewModel.<>c__DisplayClass61_1 cDisplayClass611_1 = new MoneyTransferViewModel.<>c__DisplayClass61_1();
            // ISSUE: reference to a compiler-generated field
//      cDisplayClass611_1.<>4__this = this;
            if (this.Transfer == null)
            {
                return;
            }
            // ISSUE: reference to a compiler-generated field
            string acceptUrl = this.Transfer.accept_url;

            // ISSUE: reference to a compiler-generated field
            if (!string.IsNullOrEmpty(acceptUrl))
            {
                // ISSUE: reference to a compiler-generated field
                this.AcceptTransfer(acceptUrl);
            }
            else
            {
                FullscreenLoader loader = new FullscreenLoader();
                loader.Show(null, true);
                MoneyTransfersService.CheckTransfer(this.Transfer.id, this.Transfer.from_id, this.Transfer.to_id, (Action <BackendResult <MoneyTransfer, ResultCode> >)(result =>
                {
                    loader.Hide(false);
                    ResultCode resultCode = result.ResultCode;
                    if (resultCode == ResultCode.Succeeded)
                    {
                        // ISSUE: variable of a compiler-generated type
//            MoneyTransferViewModel.<>c__DisplayClass61_1 cDisplayClass611_2 = cDisplayClass611_1;
                        MoneyTransfer resultData = result.ResultData;
                        string str = resultData != null ? resultData.accept_url :  null;
                        // ISSUE: reference to a compiler-generated field
                        acceptUrl = str;
                        if (string.IsNullOrEmpty(acceptUrl))
                        {
                            return;
                        }
                        this.AcceptTransfer(acceptUrl);
                    }
                    else
                    {
                        GenericInfoUC.ShowBasedOnResult(resultCode, "", null);
                    }
                }));
            }
        }
コード例 #23
0
        private void AddEditCallback(ResultCode resultCode, VKRequestsDispatcher.Error error, GroupLink resultData)
        {
            Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (resultCode == ResultCode.Succeeded)
                {
                    if (this._link != null)
                    {
                        if (this._link.edit_title == 1)
                        {
                            this._link.name = this.Description;
                        }
                        else
                        {
                            this._link.desc = this.Description;
                        }
                    }
                    EventAggregator current = EventAggregator.Current;
                    CommunityLinkAddedOrEdited linkAddedOrEdited = new CommunityLinkAddedOrEdited();
                    linkAddedOrEdited.CommunityId = this._communityId;
                    int num = this._link != null ? 1 : 0;
                    linkAddedOrEdited.IsEditing = num != 0;
                    GroupLink groupLink = this._link ?? resultData;
                    linkAddedOrEdited.Link = groupLink;
                    current.Publish((object)linkAddedOrEdited);
                    Navigator.Current.GoBack();
                }
                else
                {
                    this.SetInProgress(false, "");
                    this.IsFormEnabled = true;
                    VKRequestsDispatcher.Error error1 = error;
                    switch (error1 != null ? error1.error_text : (string)null)
                    {
                    case null:
                        GenericInfoUC.ShowBasedOnResult((int)resultCode, "", error);
                        break;

                    default:
                        error.error_text += ".";
                        goto case null;
                    }
                }
            }));
        }