private void InitializeExternalStore(ExternalStoreConfigurationView externalStoreView, ExternalStorePresenter externalStorePresenter) { if (ServerState.Instance.ServerService != null) { AdvancedSettings settings = AdvancedSettings.Open(ServerState.Instance.ServerService.ServiceDirectory); externalStorePresenter.ServiceDirectory = ServerState.Instance.ServerService.ServiceDirectory; externalStorePresenter.RunView(externalStoreView, settings); } else { externalStorePresenter.RunView(externalStoreView, null); } __ExternalStorePresenter = externalStorePresenter; __ExternalStorePresenter.ExternalStore += new EventHandler <ExternalStoreMessageEventArgs>(ExternalStorePresenter_ExternalStore); __ExternalStorePresenter.CancelExternalStore += new EventHandler <EventArgs>(ExternalStorePresenter_CancelExternalStore); __ExternalStorePresenter.Clean += new EventHandler <Leadtools.Medical.Winforms.ExternalStore.CleanMessageEventArgs>(ExternalStorePresenter_Clean); __ExternalStorePresenter.Restore += new EventHandler <RestoreMessageEventArgs>(ExternalStorePresenter_Restore); __ExternalStorePresenter.CancelRestore += new EventHandler <EventArgs>(ExternalStorePresenter_CancelRestore); __ExternalStorePresenter.Reset += new EventHandler <Leadtools.Medical.Winforms.ExternalStore.ResetEventArgs>(ExternalStorePresenter_Reset); ConfigureExternalStore(); //ServerState.Instance.IsRemoteServerChanged += new EventHandler(OnConfigurerFowarder); //ServerState.Instance.RemoteServerInformationChanged += new EventHandler(OnConfigurerFowarder); }
public static void ExternalStoreSettingsChanged() { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Azure Module.ExternalStoreSettingsChanged()"); Settings.RefreshSettings(); Type[] extraTypes = new Type[] { typeof(AzureConfiguration) }; Options = Settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", extraTypes); ExternalStorePresenter.MyDumpExternalStoreOptions("Azure ExternalStoreSettingsChanged() -- options about to be saved", Options); ExternalStore.Addin.Module.StartExternalStoreJobs(AzureExternalStoreAddinConfig, "Azure"); }
public static void StartExternalStoreJobs(ExternalStoreAddinConfigAbstract addinExternalStoreAddinConfig, string addinFriendlyName) { ExternalStoreItem item = null; if (Options != null) { item = Options.GetCurrentOption(); } if ((item != null) && (addinExternalStoreAddinConfig != null) && (item.ExternalStoreAddinConfig.Equals(addinExternalStoreAddinConfig))) { ICrud crud = item.ExternalStoreAddinConfig.GetCrudInterface(); crud.Initialize(); DataAccessServiceLocator.Register <ICrud>(crud); DataAccessServiceLocator.Register <ICrud>(crud, crud.ExternalStoreGuid); StorageConfigManager = new StorageModuleConfigurationManager(true); StorageConfigManager.Load(ServiceDirectory); System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(_serviceDirectory); IExternalStoreDataAccessAgent externalStoreAgent; if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>()) { externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, _displayName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent); } else { externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>(); } IStorageDataAccessAgent storageAgent; if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>()) { storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, _displayName)).CreateDataAccessAgent <IStorageDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent); } else { storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>(); } string sDebug = string.Format("{0}: Module.StartOrStopAddin() -- new JobManager()", addinFriendlyName); ExternalStorePresenter.MyDumpExternalStoreOptions(sDebug, Options); JobManager = new JobManager(Options, externalStoreAgent, storageAgent, ServiceName, StorageConfigManager.GetStorageAddInsSettings()); JobManager.ExternalStoreGuid = item.ExternalStoreAddinConfig.Guid; if (IsLicenseValid()) { sDebug = string.Format("{0}: Module.StartOrStopAddin() -- JobManager.Start", addinFriendlyName); DicomUtilities.DebugString(DebugStringOptions.ShowCounter, sDebug); JobManager.Start(); } } }
public override void Load(string serviceDirectory, string displayName) { string msg = string.Format("serviceDirectory:{0} displayName:{1}", serviceDirectory, displayName); DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Module.Load() -- JobManager.Start" + msg); AdvancedSettings settings = AdvancedSettings.Open(serviceDirectory); _serviceDirectory = serviceDirectory; DicomServer server = ServiceLocator.Retrieve <DicomServer>(); ServiceName = server.Name; try { Type[] extraTypes = new Type[] { typeof(AzureConfiguration) }; Options = settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", extraTypes); ExternalStorePresenter.MyDumpExternalStoreOptions("Module.Load() -- settings.GetAddInCustomData()", Options); if (Options == null) { Options = new ExternalStoreOptions(); } ICrud thisCrud = Options.GetCrud(AzureGuid); if (thisCrud != null) { DataAccessServiceLocator.Register <ICrud>(thisCrud, thisCrud.ExternalStoreGuid); } } catch (Exception e) { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "*** Exception: Module.Load() settings.GetAddInCustomData" + e.Message); if (Options == null) { Options = new ExternalStoreOptions(); } Logger.Global.Error(Source, e.Message); } ExternalStore.Addin.Module.StartExternalStoreJobs(AzureExternalStoreAddinConfig, "Azure"); }
public static void StopExternalStoreJobs() { if (JobManager != null) { string sDebug = string.Format("Module.StopExternalStoreJobs -- JobManager.Stop"); DicomUtilities.DebugString(DebugStringOptions.ShowCounter, sDebug); JobManager.Stop(); } // No cloud storage Settings.RefreshSettings(); Options = Settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", null); string s = string.Format("{0}: Module.StopExternalStoreJobs()", ExternalStorePresenter._Name); ExternalStorePresenter.MyDumpExternalStoreOptions(s, Options); if (Options.ExternalStoreIndex == -1) { DataAccessServiceLocator.Register <ICrud>(new DefaultCrud()); } }
private void CreateViews( ) { StorageModuleConfigurationManager configManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( ); GeneralSettingsPresenter generalPresenter = new GeneralSettingsPresenter( ); ServerOptionsPresenter optionsPresenter = new ServerOptionsPresenter( ); GeneralSettingsView generalView = new GeneralSettingsView( ); ServerOptionsView optionsView = new ServerOptionsView( ); ServerNetworkingPresenter networkPresenter = new ServerNetworkingPresenter( ); ServerNetworkingView networkView = new ServerNetworkingView( ); StorageOptionsView storeOptionsView = new StorageOptionsView( ); QueryOptionsView queryOptionsView = new QueryOptionsView( ); StorageSettingsPresenter storagePresenter = new StorageSettingsPresenter(configManager); #if LEADTOOLS_V19_OR_LATER StorageCommitView storageCommitView = new StorageCommitView(); StorageCommitPresenter storageCommitPresenter = new StorageCommitPresenter(); #endif SecurityOptionsPresenter securityOptionsPresenter = new SecurityOptionsPresenter(); EventLogConfigurationView loggingConfigView = new EventLogConfigurationView( ); ClientViewerPresenter clientConfigPresenter = new ClientViewerPresenter(); ClientViewerControl clientConfigView = new ClientViewerControl(); EventLogConfigurationPresenter loggingConfigPresenter = new EventLogConfigurationPresenter( ); PatientUpdaterConfigurationView patientUpdaterView = new PatientUpdaterConfigurationView( ); PatientUpdaterPresenter patientUpdaterPresenter = new PatientUpdaterPresenter( ); AutoCopyView autoCopyView = new AutoCopyView( ); AutoCopyPresenter autoCopyPresenter = new AutoCopyPresenter( ); StorageClassesTabControl storageClassesView = new StorageClassesTabControl(); StorageClassesPresenter storageClassesPresenter = new StorageClassesPresenter(); ForwardManagerConfigurationView forwardView = new ForwardManagerConfigurationView() { Visible = false }; ForwardManagerPresenter forwardPresenter = new ForwardManagerPresenter(); GatewaySettingsPresenter gatewayPresenter = new GatewaySettingsPresenter( ); GatewaySettingsView gatewayView = new GatewaySettingsView( ); SecurityOptionsView securityOptionsView = new SecurityOptionsView(); #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) AnonymizeOptionsPresenter anonymizeOptionsPresenter = new AnonymizeOptionsPresenter(); AnonymizeOptionsView anonymizeOptionsView = new AnonymizeOptionsView { SaveButtonVisible = false }; #endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER) ExternalStoreConfigurationView externalStoreView = new ExternalStoreConfigurationView(); ExternalStorePresenter externalStorePresenter = new ExternalStorePresenter(); InitializeExternalStore(externalStoreView, externalStorePresenter); #endif InitializeForwarding(forwardView, forwardPresenter); InitializeAutoCopy(autoCopyView, autoCopyPresenter); #if LEADTOOLS_V19_OR_LATER InitializeStorageCommit(storageCommitView, storageCommitPresenter); #endif InitializeSecurityOptionsView(securityOptionsView, securityOptionsPresenter); generalPresenter.RunView(generalView); optionsPresenter.RunView(optionsView); networkPresenter.RunView(networkView); patientUpdaterPresenter.RunView(patientUpdaterView, ServerState.Instance.ServerService != null?ServerState.Instance.ServerService.ServiceDirectory:string.Empty); clientConfigPresenter.RunView(clientConfigView); storageClassesPresenter.RunView(storageClassesView); #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) anonymizeOptionsPresenter.RunView(anonymizeOptionsView); #endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) gatewayPresenter.RunView(gatewayView); loggingConfigPresenter.RunView(loggingConfigView, ServerState.Instance.LoggingState); loggingConfigPresenter.EnableView = ServerState.Instance.ServerService != null; storeOptionsView.ShowDeleteAnnotationOption = false; storagePresenter.RunViews(storeOptionsView, queryOptionsView); View.AddFeatureControl(FeatureNames.ServerParentFeature, generalView, null); View.AddFeatureControl(FeatureNames.ServerSettings, generalView, FeatureNames.ServerParentFeature); View.AddFeatureControl(FeatureNames.ClientConfig, clientConfigView, FeatureNames.ServerParentFeature); View.AddFeatureControl(FeatureNames.ServerOptions, optionsView, FeatureNames.ServerParentFeature); View.AddFeatureControl(FeatureNames.ServerNetworking, networkView, FeatureNames.ServerParentFeature); // // Storage Settings // View.AddFeatureControl(FeatureNames.StoreSettingsParentFeature, storeOptionsView, null); View.AddFeatureControl(FeatureNames.StoreSettings, storeOptionsView, FeatureNames.StoreSettingsParentFeature); View.AddFeatureControl(FeatureNames.QuerySettings, queryOptionsView, FeatureNames.StoreSettingsParentFeature); #if LEADTOOLS_V19_OR_LATER View.AddFeatureControl(FeatureNames.StorageCommit, storageCommitView, FeatureNames.StoreSettingsParentFeature); #endif View.AddFeatureControl(FeatureNames.IodClasses, storageClassesView, FeatureNames.StoreSettingsParentFeature); if (UserManager.User.IsAdmin( )) { PasswordOptionsPresenter passwordOptionsPresenter = new PasswordOptionsPresenter( ); PasswordOptionsView passwordOptions = new PasswordOptionsView( ); UserViewPresenter userViewPresenter = new UserViewPresenter( ); RolesViewPresenter rolesViewPresenter = new RolesViewPresenter(); UserView userView = new UserView(); RolesView rolesView = new RolesView(); DatabaseManagerOptionsView databaseManagerOptionsView = new DatabaseManagerOptionsView(); DatabaseManagerOptionsPresenter databaseManagerOptionsPresenter = new DatabaseManagerOptionsPresenter(); #if LEADTOOLS_V20_OR_LATER ClientConfigurationOptionsView clientConfigurationOptionsView = new ClientConfigurationOptionsView(); ClientConfigurationOptionsPresenter clientConfigurationOptionsPresenter = new ClientConfigurationOptionsPresenter(); __ClientConfigurationOptionsPresenter = clientConfigurationOptionsPresenter; #endif // #if LEADTOOLS_V20_OR_LATER __UserViewPresenter = userViewPresenter; __RolesViewPresenter = rolesViewPresenter; __DatabaseManagerOptionsPresenter = databaseManagerOptionsPresenter; passwordOptionsPresenter.RunView(passwordOptions); userViewPresenter.RunView(userView); rolesViewPresenter.RunView(rolesView); databaseManagerOptionsPresenter.RunView(databaseManagerOptionsView); #if LEADTOOLS_V20_OR_LATER clientConfigurationOptionsPresenter.RunView(clientConfigurationOptionsView); #endif #if LEADTOOLS_V19_OR_LATER CardUserViewPresenter cardUserViewPresenter = new CardUserViewPresenter(); CardUserView cardUserView = new CardUserView(); __CardUserViewPresenter = cardUserViewPresenter; cardUserViewPresenter.RunView(cardUserView); #endif // // Administrative Settings // View.AddFeatureControl(FeatureNames.AdministrationParentFeature, passwordOptions, null); View.AddFeatureControl(FeatureNames.PasswordOptions, passwordOptions, FeatureNames.AdministrationParentFeature); View.AddFeatureControl(FeatureNames.Users, userView, FeatureNames.AdministrationParentFeature); #if LEADTOOLS_V19_OR_LATER View.AddFeatureControl(FeatureNames.CardUsers, cardUserView, FeatureNames.AdministrationParentFeature); #endif View.AddFeatureControl(FeatureNames.Roles, rolesView, FeatureNames.AdministrationParentFeature); View.AddFeatureControl(FeatureNames.DatabaseManagerOptions, databaseManagerOptionsView, FeatureNames.AdministrationParentFeature); #if LEADTOOLS_V20_OR_LATER View.AddFeatureControl(FeatureNames.ClientConfigurationOptions, clientConfigurationOptionsView, FeatureNames.AdministrationParentFeature); #endif #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) View.AddFeatureControl(FeatureNames.AnonymizeOptions, anonymizeOptionsView, FeatureNames.AdministrationParentFeature); #endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) __PasswordOptionsPresenter = passwordOptionsPresenter; __PasswordOptionsPresenter.IdleTimeout += new EventHandler(passwordOptionsPresenter_IdleTimeout); } View.AddFeatureControl(FeatureNames.PatientUpdater, patientUpdaterView, null); View.AddFeatureControl(FeatureNames.AutoCopy, autoCopyView, null); View.AddFeatureControl(FeatureNames.LoggingConfig, loggingConfigView, null); View.AddFeatureControl(FeatureNames.Forwarder, forwardView, null); View.AddFeatureControl(FeatureNames.Gateway, gatewayView, null); #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER) View.AddFeatureControl(FeatureNames.ExternalStore, externalStoreView, null); #endif View.AddFeatureControl(FeatureNames.SecurityOptions, securityOptionsView, null); __SecurityOptionsPresenter = securityOptionsPresenter; #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER) __ExternalStorePresenter = externalStorePresenter; #endif __LoggingConfigPresenter = loggingConfigPresenter; __PatientUpdaterPresenter = patientUpdaterPresenter; __AutoCopyPresenter = autoCopyPresenter; __StorageClassesPresenter = storageClassesPresenter; __StorageSettingsPresenter = storagePresenter; __ClientConfigPresenter = clientConfigPresenter; __GatewaySettingsPresenter = gatewayPresenter; __GeneralSettingsPresenter = generalPresenter; __ServerOptionsPresenter = optionsPresenter; __ServerNetworkingPresenter = networkPresenter; #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) __AnonymizeOptionsPresenter = anonymizeOptionsPresenter; #endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) SetClientConfigLicense(); SetGatewayLicense(); // Subscribe to SettingsChanged events __LoggingConfigPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __PatientUpdaterPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __AutoCopyPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __StorageClassesPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __StorageSettingsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __ClientConfigPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __GeneralSettingsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __ServerOptionsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __ServerNetworkingPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); __ForwardPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER) __ExternalStorePresenter.SettingsChanged += new EventHandler(OnSettingsChanged); #endif #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) __AnonymizeOptionsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); #endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) #if LEADTOOLS_V19_OR_LATER if (__StorageCommitPresenter != null) { __StorageCommitPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } #endif if (__SecurityOptionsPresenter != null) { __SecurityOptionsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } if (__PasswordOptionsPresenter != null) { __PasswordOptionsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } if (__UserViewPresenter != null) { __UserViewPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } #if LEADTOOLS_V19_OR_LATER if (__CardUserViewPresenter != null) { __CardUserViewPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } #endif if (__RolesViewPresenter != null) { __RolesViewPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } if (__DatabaseManagerOptionsPresenter != null) { __DatabaseManagerOptionsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } #if LEADTOOLS_V20_OR_LATER if (__ClientConfigurationOptionsPresenter != null) { __ClientConfigurationOptionsPresenter.SettingsChanged += new EventHandler(OnSettingsChanged); } #endif // #if LEADTOOLS_V20_OR_LATER EventBroker.Instance.Subscribe <ActivateIdleMonitorEventArgs>(new EventHandler <ActivateIdleMonitorEventArgs>(OnActivateIdle)); EventBroker.Instance.Subscribe <ExitMinimizedStateEventArgs>(new EventHandler <ExitMinimizedStateEventArgs>(OnExitMinimizedState)); }