Пример #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;
            });
        }