コード例 #1
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            bool flag = true;

            if (!this._isInitialized)
            {
                IDictionary <string, string> queryString = this.NavigationContext.QueryString;
                this._ownerId   = long.Parse(queryString["OwnerId"]);
                this._productId = long.Parse(queryString["ProductId"]);
                Product product = ParametersRepository.GetParameterForIdAndReset("Product") as Product;
                this.InitializeCommentVM();
                this._viewModel = product != null ? new ProductViewModel(product) : new ProductViewModel(this._ownerId, this._productId);
                this._viewModel.PageLoadInfoViewModel.LoadingStateChangedCallback = new Action(this.OnLoadedStateChanged);
                this.DataContext = (object)this._viewModel;
                this._viewModel.Reload();
                this.RestoreUnboundState();
                this._isInitialized = true;
                flag = false;
            }
            if (!flag && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New))
            {
                WallPostVMCacheManager.TryDeserializeInstance(this._commentVM);
            }
            this.ProcessInputData();
        }
コード例 #2
0
ファイル: MenuUC.cs プロジェクト: Makzz90/VKClient_re
        private void NavigateOnMenuClick(Action navigateAction, bool needClearStack = true)
        {
            if ((DateTime.Now - this._lastMenuNavigationDateTime).TotalMilliseconds < 700.0 || this._isNavigating)
            {
                return;
            }
            this._isNavigating = true;
            this._lastMenuNavigationDateTime = DateTime.Now;
            PageBase parentPage = this.ParentPage;

            parentPage.PrepareForMenuNavigation((Action)(() =>
            {
                this._isNavigating = false;
                if (needClearStack)
                {
                    WallPostVMCacheManager.ResetInstance();
                }
                navigateAction();
                if (needClearStack)
                {
                    return;
                }
                Execute.ExecuteOnUIThread((Action)(async() =>
                {
                    await Task.Delay(1);
                    this.HandleSamePageNavigation(parentPage, true);
                }));
            }), needClearStack);
        }
コード例 #3
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            bool flag = true;

            if (!this._isInitialized)
            {
                this._ownerId = long.Parse(((Page)this).NavigationContext.QueryString["OwnerId"]);
                this._videoId = long.Parse(((Page)this).NavigationContext.QueryString["VideoId"]);
                string accessKey    = ((Page)this).NavigationContext.QueryString["AccessKey"];
                string videoContext = "";
                if (((Page)this).NavigationContext.QueryString.ContainsKey("VideoContext"))
                {
                    videoContext = ((Page)this).NavigationContext.QueryString["VideoContext"];
                }
                VKClient.Common.Backend.DataObjects.Video parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("Video") as VKClient.Common.Backend.DataObjects.Video;
                StatisticsActionSource actionSource = (StatisticsActionSource)Enum.Parse(typeof(StatisticsActionSource), ((Page)this).NavigationContext.QueryString["VideoSource"]);
                this.InitializeCommentVM();
                VideoCommentsViewModel commentsViewModel = new VideoCommentsViewModel(this._ownerId, this._videoId, accessKey, parameterForIdAndReset, actionSource, videoContext);
                commentsViewModel.PageLoadInfoViewModel.LoadingStateChangedCallback = new Action(this.OnLoadingStateChanged);
                base.DataContext = (commentsViewModel);
                commentsViewModel.Reload(true);
                this.RestoreUnboundState();
                this._isInitialized = true;
                flag = false;
            }
            if (!flag && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New))
            {
                WallPostVMCacheManager.TryDeserializeInstance(this._commentVM);
            }
            this.ProcessInputData();
            this.UpdateAppBar();
        }
コード例 #4
0
ファイル: NewPost.cs プロジェクト: Makzz90/VKClient_re
 protected override void HandleOnNavigatedFrom(NavigationEventArgs e)
 {
     if (this._published)
     {
         return;
     }
     WallPostVMCacheManager.TrySerializeVM(this.WallPostVM);
 }
コード例 #5
0
 protected override void HandleOnNavigatedFrom(NavigationEventArgs e)
 {
     base.HandleOnNavigatedFrom(e);
     if (e.NavigationMode != NavigationMode.Back)
     {
         WallPostVMCacheManager.RegisterForDelayedSerialization(this._commentVM);
     }
     if (e.NavigationMode == NavigationMode.Back)
     {
         WallPostVMCacheManager.ResetInstance();
     }
     this.SaveUnboundState();
 }
コード例 #6
0
ファイル: NewPost.cs プロジェクト: Makzz90/VKClient_re
        private void _appBarButtonSend_Click(object sender, EventArgs e)
        {
            this._isPublishing = true;
            this.UpdateViewState();
            this.WallPostVM.Publish(delegate(ResultCode res)
            {
                Execute.ExecuteOnUIThread(delegate
                {
                    this._isPublishing = false;
                    if (res == ResultCode.Succeeded)
                    {
                        this._published = true;
                        WallPostVMCacheManager.ResetVM(this.WallPostVM);
                        if (this._shareContentDataProvider is ShareExternalContentDataProvider)
                        {
                            ((ShareExternalContentDataProvider)this._shareContentDataProvider).ShareOperation.ReportCompleted();
                            return;
                        }
                        if (this.WallPostVM.WMMode == WallPostViewModel.Mode.PublishWallPost && this._isFromWallPostPage && Enumerable.Any <JournalEntry>(this.NavigationService.BackStack))
                        {
                            this.NavigationService.RemoveBackEntrySafe();
                        }
                        Navigator.Current.GoBack();
                        return;
                    }
                    else
                    {
                        if (res != ResultCode.PostsLimitOrAlreadyScheduled)
                        {
                            this.UpdateViewState();
                            new GenericInfoUC().ShowAndHideLater(CommonResources.Error, null);
                            return;
                        }
                        IEnumerable <IOutboundAttachment> arg_EF_0 = this.WallPostVM.OutboundAttachments;
                        Func <IOutboundAttachment, bool> arg_EF_1  = new Func <IOutboundAttachment, bool>((a) => { return(a.AttachmentId == "timestamp"); });

                        if (Enumerable.FirstOrDefault <IOutboundAttachment>(arg_EF_0, arg_EF_1) != null)
                        {
                            this.UpdateViewState();
                            new GenericInfoUC(2000).ShowAndHideLater(CommonResources.ScheduledForExistingTime, null);
                            return;
                        }
                        this.UpdateViewState();
                        new GenericInfoUC(2000).ShowAndHideLater(CommonResources.PostsLimitReached, null);
                        return;
                    }
                });
            });
        }
コード例 #7
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            bool flag = true;

            if (!this._isInitialized)
            {
                this._ownerId = long.Parse(((Page)this).NavigationContext.QueryString["ownerId"]);
                this._pid     = long.Parse(((Page)this).NavigationContext.QueryString["pid"]);
                string            accessKey = ((Page)this).NavigationContext.QueryString["accessKey"];
                Photo             parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("Photo") as Photo;
                PhotoWithFullInfo parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("PhotoWithFullInfo") as PhotoWithFullInfo;
                this._friendsOnly = ((Page)this).NavigationContext.QueryString["FriendsOnly"] == bool.TrueString;
                this._fromDialog  = ((Page)this).NavigationContext.QueryString["FromDialog"] == bool.TrueString;
                PhotoViewModel photoViewModel;
                if (parameterForIdAndReset1 == null)
                {
                    photoViewModel = new PhotoViewModel(this._ownerId, this._pid, accessKey);
                }
                else
                {
                    if (string.IsNullOrEmpty(parameterForIdAndReset1.access_key))
                    {
                        parameterForIdAndReset1.access_key = accessKey;
                    }
                    photoViewModel = new PhotoViewModel(parameterForIdAndReset1, parameterForIdAndReset2);
                }
                this.InitializeCommentVM();
                base.DataContext = photoViewModel;
                // ISSUE: method pointer
                photoViewModel.LoadInfoWithComments(new Action <bool, int>(this.OnPhotoInfoLoaded));
                this.RestoreUnboundState();
                this._isInitialized = true;
                flag = false;
            }
            if (!flag && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New))
            {
                WallPostVMCacheManager.TryDeserializeInstance(this._commentVM);
            }
            this.ProcessInputData();
            this.UpdateAppBar();
        }
コード例 #8
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            bool flag = true;

            if (!this._isInitialized)
            {
                ((UIElement)this.ucNewMessage).Opacity = 0.0;
                NewsItemDataWithUsersAndGroupsInfo parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("WallPost") as NewsItemDataWithUsersAndGroupsInfo;
                long num1 = long.Parse(((Page)this).NavigationContext.QueryString["PollId"]);
                long num2 = long.Parse(((Page)this).NavigationContext.QueryString["PollOwnerId"]);
                if (this.FocusComments)
                {
                    this.panel.OnlyPartialLoad = true;
                }
                long postId  = this.CommonParameters.PostId;
                long ownerId = this.CommonParameters.OwnerId;
                MyVirtualizingPanel2 panel = this.panel;
                Action loadedCallback      = new Action(this.ViewModelIsLoaded);
                Action <CommentItem> replyCommentAction = new Action <CommentItem>(this.ReplyToComment);
                long knownPollId      = num1;
                long knownPollOwnerId = num2;
                PostCommentsViewModel commentsViewModel = new PostCommentsViewModel(parameterForIdAndReset, postId, ownerId, panel, loadedCallback, replyCommentAction, knownPollId, knownPollOwnerId);
                this.InitializeCommentVM();
                base.DataContext = commentsViewModel;
                commentsViewModel.LoadMoreCommentsInUI();
                this.UpdateAppBar();
                this.RestoreUnboundState();
                this.ucPullToRefresh.TrackListBox((ISupportPullToRefresh)this.panel);
                this.panel.OnRefresh = new Action(this.Refresh);
                this._isInitialized  = true;
                flag = false;
            }
            if (!flag && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New))
            {
                WallPostVMCacheManager.TryDeserializeInstance(this._commentVM);
            }
            this.ProcessInputData();
            PostCommentsPage.HandleInputParams(this._commentVM);
            this.UpdateAppBar();
        }
コード例 #9
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            bool flag1 = true;

            if (!this._isInitialized)
            {
                long   gid                 = long.Parse(((Page)this).NavigationContext.QueryString["GroupId"]);
                long   num1                = long.Parse(((Page)this).NavigationContext.QueryString["TopicId"]);
                string str                 = ((Page)this).NavigationContext.QueryString["TopicName"];
                int    num2                = int.Parse(((Page)this).NavigationContext.QueryString["KnownCommentsCount"]);
                bool   flag2               = ((Page)this).NavigationContext.QueryString["LoadFromTheEnd"] == bool.TrueString;
                bool   flag3               = ((Page)this).NavigationContext.QueryString["CanComment"] == bool.TrueString;
                long   tid                 = num1;
                string topicName           = str;
                int    knownCommentsCount  = num2;
                int    num3                = flag3 ? 1 : 0;
                MyVirtualizingPanel2 panel = this.panel;
                int num4 = flag2 ? 1 : 0;
                Action <CommentItem>     replyCallback       = new Action <CommentItem>(this.replyCallback);
                GroupDiscussionViewModel discussionViewModel = new GroupDiscussionViewModel(gid, tid, topicName, knownCommentsCount, num3 != 0, panel, num4 != 0, replyCallback);
                this.InitializeCommentVM();
                base.DataContext = ((object)discussionViewModel);
                discussionViewModel.LoadData(false, new Action <bool>(this.LoadedCallback));
                this.UpdateAppBar();
                this.RestoreUnboundState();
                this._isInitialized = true;
                flag1 = false;
            }
            if (!flag1 && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New))
            {
                WallPostVMCacheManager.TryDeserializeInstance(this._commentVM);
            }
            this.ProcessInputData();
            this.UpdateAppBar();
        }
コード例 #10
0
ファイル: NewPost.cs プロジェクト: Makzz90/VKClient_re
 protected override void HandleOnNavigatedTo(NavigationEventArgs e)
 {
     base.HandleOnNavigatedTo(e);
     this._fromPhotoPicker = false;
     this._isForwardNav    = e.NavigationMode == 0;
     if (ParametersRepository.Contains("FromPhotoPicker"))
     {
         this._fromPhotoPicker = (bool)ParametersRepository.GetParameterForIdAndReset("FromPhotoPicker");
     }
     if (!this._isInitialized)
     {
         this._adminLevel = int.Parse(((Page)this).NavigationContext.QueryString["AdminLevel"]);
         bool isPublicPage   = ((Page)this).NavigationContext.QueryString["IsPublicPage"] == bool.TrueString;
         bool isNewTopicMode = ((Page)this).NavigationContext.QueryString["IsNewTopicMode"] == bool.TrueString;
         this._isFromWallPostPage = ((Page)this).NavigationContext.QueryString["FromWallPostPage"] == bool.TrueString;
         WallPostViewModel.Mode mode;
         // ISSUE: explicit reference operation
         // ISSUE: cast to a reference type
         Enum.TryParse <WallPostViewModel.Mode>(((Page)this).NavigationContext.QueryString["Mode"], out mode);
         WallPost parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("PublishWallPost") as WallPost;
         WallPost parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("EditWallPost") as WallPost;
         Comment  parameterForIdAndReset3 = ParametersRepository.GetParameterForIdAndReset("EditWallComment") as Comment;
         Comment  parameterForIdAndReset4 = ParametersRepository.GetParameterForIdAndReset("EditPhotoComment") as Comment;
         Comment  parameterForIdAndReset5 = ParametersRepository.GetParameterForIdAndReset("EditVideoComment") as Comment;
         Comment  parameterForIdAndReset6 = ParametersRepository.GetParameterForIdAndReset("EditProductComment") as Comment;
         Comment  parameterForIdAndReset7 = ParametersRepository.GetParameterForIdAndReset("EditDiscussionComment") as Comment;
         Dictionary <long, long> parameterForIdAndReset8  = ParametersRepository.GetParameterForIdAndReset("CidToAuthorIdDict") as Dictionary <long, long>;
         WallRepostInfo          parameterForIdAndReset9  = ParametersRepository.GetParameterForIdAndReset("WallRepostInfo") as WallRepostInfo;
         WallPostViewModel       parameterForIdAndReset10 = ParametersRepository.GetParameterForIdAndReset("NewCommentVM") as WallPostViewModel;
         this._shareContentDataProvider = ShareContentDataProviderManager.RetrieveDataProvider();
         if (this._shareContentDataProvider is ShareExternalContentDataProvider)
         {
             ((Page)this).NavigationService.ClearBackStack();
             this.ucHeader.HideSandwitchButton = true;
             this.SuppressMenu = true;
         }
         WallPostViewModel vm;
         if (parameterForIdAndReset1 != null)
         {
             vm = new WallPostViewModel(parameterForIdAndReset1, this._adminLevel, null)
             {
                 WMMode = WallPostViewModel.Mode.PublishWallPost
             }
         }
         ;
         else if (parameterForIdAndReset2 != null)
         {
             vm = new WallPostViewModel(parameterForIdAndReset2, this._adminLevel, parameterForIdAndReset9)
             {
                 WMMode = WallPostViewModel.Mode.EditWallPost
             };
             if (vm.WallRepostInfo != null)
             {
                 RepostHeaderUC repostHeaderUc1 = new RepostHeaderUC();
                 Thickness      thickness       = new Thickness(0.0, 14.0, 0.0, 14.0);
                 ((FrameworkElement)repostHeaderUc1).Margin = thickness;
                 RepostHeaderUC repostHeaderUc2 = repostHeaderUc1;
                 repostHeaderUc2.Configure(vm.WallRepostInfo, null);
                 this.wallRepostContainer.Child = ((UIElement)repostHeaderUc2);
             }
         }
         else
         {
             vm = parameterForIdAndReset3 == null ? (parameterForIdAndReset4 == null ? (parameterForIdAndReset5 == null ? (parameterForIdAndReset6 == null ? (parameterForIdAndReset7 == null ? (parameterForIdAndReset10 == null ? new WallPostViewModel(this.CommonParameters.UserOrGroupId, this.CommonParameters.IsGroup, this._adminLevel, isPublicPage, isNewTopicMode) : parameterForIdAndReset10) : WallPostViewModel.CreateEditDiscussionCommentVM(parameterForIdAndReset7, parameterForIdAndReset8)) : WallPostViewModel.CreateEditProductCommentVM(parameterForIdAndReset6)) : WallPostViewModel.CreateEditVideoCommentVM(parameterForIdAndReset5)) : WallPostViewModel.CreateEditPhotoCommentVM(parameterForIdAndReset4)) : WallPostViewModel.CreateEditWallCommentVM(parameterForIdAndReset3);
         }
         vm.IsOnPostPage = true;
         vm.WMMode       = mode;
         if (!this._fromPhotoPicker && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New || (mode == WallPostViewModel.Mode.NewTopic || mode == WallPostViewModel.Mode.NewWallPost)))
         {
             WallPostVMCacheManager.TryDeserializeVM(vm);
         }
         vm.PropertyChanged += new PropertyChangedEventHandler(this.vm_PropertyChanged);
         base.DataContext    = vm;
         this._isInitialized = true;
     }
     if (this.HandleInputParams(e))
     {
         return;
     }
     this.UpdateViewState();
     ListExtensions.ForEach <IOutboundAttachment>(this.WallPostVM.OutboundAttachments, (Action <IOutboundAttachment>)(a => a.SetRetryFlag()));
     if (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New)
     {
         return;
     }
     if (this.WallPostVM.IsInNewWallPostMode || this.WallPostVM.EditWallRepost)
     {
         this.FocusTextBox();
     }
     else
     {
         if (!this.WallPostVM.IsInNewTopicMode)
         {
             return;
         }
         this.FocusTitleTextBox();
     }
 }