private void RegisterServices() { IConfigurationService configuration = new ConfigurationService(); Container.RegisterInstance(configuration); IDataGatewayService dataGatewayService = new DataGatewayService(configuration.ConnectionString); string errorConnection; if (!dataGatewayService.ConnectionExists(out errorConnection)) { throw new ApplicationException(errorConnection); } Container.RegisterInstance(dataGatewayService); Container.RegisterType <ISettingServices, RegistryServices>(); Container.RegisterType <IDialogService, Services.DialogService>(); Container.RegisterInstance <IControlViewManager>(new ControlViewManager(Container.Resolve <IRegionManager>(), Container.Resolve <IModuleManager>())); Container.RegisterType <IRegionContextManager, RegionContextManager>(); //обязательно регистрируем как экземпляр, так как сервис работает со свой коллекцией комманд Container.RegisterInstance <IButtonsEventCommandService>(new ButtonsEventCommandService()); Container.RegisterType <IImportService, ExcelImportService>(); Container.RegisterType <ICalculationTrajectoryService, CalculationTrajectoryService>(); }
private void Save() { Root.FixParentRootId(); IEnumerable <ProfilePath> removeProfilePath = MapperViewModel.GetRemoveProfilePaths(Root); IEnumerable <Wellbore> removeWellbores = MapperViewModel.GetRemoveWellbores(Root); IEnumerable <Wellbore> updateWellbores = MapperViewModel.GetUpdateWellbores(Root); DataGatewayService.RemoveProfilePaths(removeProfilePath); DataGatewayService.RemoveAndUpdateWellbores(removeWellbores, updateWellbores); }
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 InitializeRootTreeView() { Root = MapperViewModel.GetAreaRootTreeView(DataGatewayService.GetAllAreaAndWellOrderByName()); Root.SelectedItemChanged += RootSelectedItemChanged; }