Beispiel #1
0
 private void GoPrevious()
 {
     _viewCycler.GoPrevious();
     regionManager.Regions[RegionNames.WorkspaceRegion].Activate(_viewCycler.CurrentPage.View);
     //_vmStateContext = _viewCycler.CurrentPage.VmStateContext;
     ButtonVisibilty = _viewCycler.CurrentPage.ButtonState;
     GoPreviousCommand.RaiseCanExecuteChanged();
     GoNextCommand.RaiseCanExecuteChanged();
     UpdateButtonState();
 }
Beispiel #2
0
        private void ShowView()
        {
            var container = ServiceLocator.Current.GetInstance <IUnityContainer>();
            var formArgs  = container.Resolve <IViewService>();
            var mode      = formArgs.ViewMode.Peek();

            if (!formArgs.ViewExistsFlag)
            {
                var inx = regionManager.Regions[RegionNames.WorkspaceRegion].Views.Count() - 1;
                //var pageDegtails = new PageDetails(formArgs.ViewName, page, pageType, mode, inx, _vmStateContext);
                var singleView   = regionManager.Regions[RegionNames.WorkspaceRegion].ActiveViews.FirstOrDefault();
                var pageDegtails = new PageDetails(inx, singleView, _vmStateContext.ButtonVisibilty);

                _vmStateContext.CurrentPageDetail = pageDegtails;
                _viewCycler.Add(_vmStateContext.CurrentPageDetail);
            }

            var region = regionManager.Regions[RegionNames.RibbonRegion];

            //var tbr = ServiceLocator.Current.GetInstance<object>(formArgs.ToolbarName);
            //Type T = tbr.GetType();
            //foreach (var view in region.Views)
            //{
            //    if (view != null)
            //    {
            //       if (view.GetType() == T)
            //        {
            //            region.Activate(view);
            //            Type type = this.GetType();

            //            PropertyInfo prop = type.GetProperty(formArgs.ToolbarName + "IsSelected");
            //            IsSearchEnabled = true;
            //            prop.SetValue(this, true, null);
            //            break;
            //        }
            //    }
            //}

            IsSearchEnabled = true;
            // regionManager.Regions[RegionNames.RibbonRegion].Activate(tbr);
            formArgs.ViewExistsFlag = false;
            // ButtonVisibilty = _vmStateContext.ButtonVisibilty;

            GoPreviousCommand.RaiseCanExecuteChanged();
            GoNextCommand.RaiseCanExecuteChanged();
            UpdateButtonState();
        }
Beispiel #3
0
        private void CloseView(string obj)
        {
            current = regionManager.Regions[RegionNames.WorkspaceRegion].Views.Count();
            var ix = _viewCycler.CurrentPage == null ? 1 : _viewCycler.CurrentPage.PageIndex + 1;

            if (ix < current)
            {
                return;
            }

            var singleView = regionManager.Regions[RegionNames.WorkspaceRegion].ActiveViews.FirstOrDefault();
            var mode       = FormArgs.ViewMode.Peek();



            if (singleView != null)
            {
                regionManager.Regions[RegionNames.WorkspaceRegion].Deactivate(singleView);

                regionManager.Regions[RegionNames.WorkspaceRegion].Remove(singleView);

                var msg = new CloseViewMessage();


                eventAggregator.GetEvent <CloseViewEvent>().Publish(msg);

                if (mode == FormMode.SAVED)
                {
                    FormArgs.ViewMode.Pop();
                }
                if (mode == FormMode.VALIDATION)
                {
                    FormArgs.ViewMode.Pop();
                }
                if (mode == FormMode.ADDMODE | mode == FormMode.EDITMODE)
                {
                    FormArgs.ViewMode.Pop();
                }


                _viewCycler.Remove(_viewCycler.CurrentPage);

                if (_viewCycler.CurrentPage != null)
                {
                    regionManager.Regions[RegionNames.WorkspaceRegion].Activate(_viewCycler.CurrentPage.View);
                    ButtonVisibilty = _viewCycler.CurrentPage.ButtonState;

                    GoPreviousCommand.RaiseCanExecuteChanged();
                    GoNextCommand.RaiseCanExecuteChanged();
                }
                if (null == _viewCycler.CurrentPage)
                {
                    if (mode == FormMode.UNCHANGED)
                    {
                        if (FormArgs.HasPendingCommits)
                        {
                            var m = new NotificationMessage();
                            m.Message = "Uncommitted transactions Please Review";
                            m.Title   = "Uncommitted transactions";
                            RaiseNotification(m);
                            return;
                        }
                        //else
                        //   // FormArgs.ViewMode.Pop();
                    }
                    LastView();
                    StartViewMode();

                    return;
                }

                //ButtonVisibilty = _viewCycler.CurrentPage.VmStateContext.ButtonVisibilty;

                //eventAggregator.GetEvent<NavigationMessageEvent>()
                //    .Publish(new NavigationMessage(_viewCycler.CurrentPage.PageTitle));
            }

            else
            {
                Application.Current.Shutdown();
                ;
            }
        }