private void Activate()
 {
     EventAggregator.GetEvent <SaveDataChangeEvent>().Subscribe(SavePageData);
     EventAggregator.GetEvent <QueryExistenceWellboresRootGridViewModel>().Subscribe(RootPublish);
     RegionContextManager.ActionSubscribeChangeRegionContext(RegionName, ChangeRegionContext);
     ButtonsEventCommandService.Subscribe(CommandNames.RefreshPageData, RefreshPageData, true);
     ButtonsEventCommandService.Subscribe(CommandNames.SavePageData, RefreshPageData, false);
     ButtonsEventCommandService.Subscribe(CommandNames.ImportPageData, ImportPageData, false);
 }
        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();
        }
 private void RootChangeCurrentItem(object currentItem)
 {
     ButtonsEventCommandService.SetExecute(CommandNames.ImportPageData, currentItem != null && currentItem is WellboreGridViewModel);
 }
 private void MainItemsAnyCollectionChanged()
 {
     ButtonsEventCommandService.Activate(CommandNames.SavePageData);
 }
 private void DeActivate()
 {
     ButtonsEventCommandService.UnSubscribe(CommandNames.RefreshTreeViewDCommand, RefreshTreeView);
     SaveCurrenTreeViewModel();
     Root = null;
 }
 private void Activate()
 {
     ButtonsEventCommandService.Subscribe(CommandNames.RefreshTreeViewDCommand, RefreshTreeView, true);
     InitializeRootTreeView();
     InitializeCurrenTreeViewModel();
 }