private void DeActivate()
 {
     SavePageData();
     EventAggregator.GetEvent <SaveDataChangeEvent>().Unsubscribe(SavePageData);
     EventAggregator.GetEvent <QueryExistenceWellboresRootGridViewModel>().Unsubscribe(RootPublish);
     ButtonsEventCommandService.UnSubscribe(CommandNames.RefreshPageData, RefreshPageData);
     ButtonsEventCommandService.UnSubscribe(CommandNames.SavePageData, RefreshPageData);
     ButtonsEventCommandService.UnSubscribe(CommandNames.ImportPageData, ImportPageData);
     RegionContextManager.UnsubscribeChangeRegionContext(RegionName, ChangeRegionContext);
     Root = null;
 }
        private void ChageWellboresRootGridViewModel(WellboresRootGridViewModel wellboresRootGridViewModel)
        {
            if (currentWellboresRootGridViewModel != null && currentWellboresRootGridViewModel.Equals(wellboresRootGridViewModel))
            {
                return;
            }

            currentWellboresRootGridViewModel = wellboresRootGridViewModel;
            if (currentWellboresRootGridViewModel != null)
            {
                currentWellboresRootGridViewModel.MainItems.AnyCollectionChanged += MainItemsAnyCollectionChanged;
            }

            FillDisplayText();
        }
Example #3
0
        private void ChageWellboresRootGridViewModel(WellboresRootGridViewModel wellboresRootGridViewModel)
        {
            if (currentWellboresRootGridViewModel != null && currentWellboresRootGridViewModel.Equals(wellboresRootGridViewModel))
            {
                return;
            }

            currentWellboresRootGridViewModel = wellboresRootGridViewModel;
            if (currentWellboresRootGridViewModel != null)
            {
                currentWellboresRootGridViewModel.MainItems.AnyCollectionChanged += MainItemsAnyCollectionChanged;
            }

            RefreshData();
            ReDraw();
        }
Example #4
0
        public bool IsValidate(object parentObject, out string message)
        {
            message = String.Empty;
            if (String.IsNullOrEmpty(Name))
            {
                message = "Имя свола не может быть пустым!";
                return(false);
            }
            WellboresRootGridViewModel wellboresRootGridViewModel = (WellboresRootGridViewModel)parentObject;
            int count = wellboresRootGridViewModel.MainItems.ToList().FindAll(item => item.Name.Equals(Name)).Count;

            if (count > 1)
            {
                message = String.Format("Имя ствола должно быть уникальным для скважины {0}!", wellboresRootGridViewModel.Root.Name);
                return(false);
            }
            return(true);
        }
        private void RefreshPageData()
        {
            if (SaveChangeIfNeeded())
            {
                Save();
            }

            if (EntityId.HasValue)
            {
                Root = MapperViewModel.GetWellboreRootGridViewModel(DataGatewayService.GetWellAndWellboreProfilePaths(EntityId.Value));
                Root.MainItems.AnyCollectionChanged += MainItemsAnyCollectionChanged;
                Root.ChangeCurrentItem += RootChangeCurrentItem;
                ButtonsEventCommandService.DeActivate(CommandNames.SavePageData);
                ButtonsEventCommandService.DeActivate(CommandNames.ImportPageData);
                Root.SetDefaultCurrentItem();
            }
            else
            {
                Root = null;
            }
            RootPublish();
        }