示例#1
0
        private void SetThreadNavCommands(ViewModels.ThreadViewModel viewmodel)
        {
            viewmodel.FirstPageCommand = new ActionCommand((state) =>
            {
                GoToFirstPage(null, null);
                this.ModalWindow.IsOpen = false;
            });

            viewmodel.LastPageCommand = new ActionCommand((state) =>
            {
                GoToLastPage(null, null);
                this.ModalWindow.IsOpen = false;
            });

            viewmodel.CustomPageCommand = new ActionCommand((state) =>
            {
                int page = -1;
                if (!int.TryParse(state.ToString(), out page))
                {
                    GoToIndex(0);
                }
                else
                {
                    GoToIndex(page - 1);
                }
                this.ModalWindow.IsOpen = false;
            });
        }
示例#2
0
        private void LoadViewmodel(ViewModels.ThreadViewModel threadViewModel)
        {
            this.pagePresenter.ClearHtml();
            this.SetThreadNavCommands(threadViewModel);
            this.DataContext = threadViewModel;

            VisualStateManager.GoToState(this, "Reading", true);
        }
示例#3
0
        public ThreadViewPage()
        {
            InitializeComponent();

            viewmodel = new ViewModels.ThreadViewModel();
            SetThreadNavCommands(viewmodel);

            _threadStack = new Stack <ViewModels.ThreadViewModel>();

            Commands.EditPostCommand.EditRequested   += new ThreadPostRequestEventHandler(OpenEditWindow);
            Commands.ViewSAThreadCommand.ViewThread  += OnSAUriLinkSelected;
            Commands.ViewSAThreadCommand.ViewLoading += ViewSAThreadCommand_ViewLoading;
            Commands.ViewSAThreadCommand.ViewFailed  += ViewSAThreadCommand_ViewFailed;

            viewmodel.ReadyToBind  += OnViewModelReadyToBind;
            viewmodel.UpdateFailed += OnViewModelUpdateFailed;
            Loaded += ThreadViewPage_Loaded;
            threadReplyControl.Loaded += WireThreadReplyControl;
        }