static string GetDefaultCacheStorage() { try { string storageLocation = string.Empty; using (StorageModuleConfigurationManager configManager = new StorageModuleConfigurationManager(false)) { var serviceDirectory = ConfigurationManager.AppSettings.Get("storageServerServicePath"); if (!string.IsNullOrEmpty(serviceDirectory)) { configManager.Load(serviceDirectory); StorageAddInsConfiguration storageSettings = configManager.GetStorageAddInsSettings(); storageLocation = storageSettings.StoreAddIn.StorageLocation; return(Path.Combine(storageLocation, @"LTCache")); } } } catch { } return(string.Empty); }
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(); } } }
private void CreateConfigurationServices(DicomService service) { StorageModuleConfigurationManager storageConfigMnager = new StorageModuleConfigurationManager(false); LoggingModuleConfigurationManager loggingConfigManager = new LoggingModuleConfigurationManager(false); if (null != service) { storageConfigMnager.Load(service.ServiceDirectory); loggingConfigManager.Load(service.ServiceDirectory); } ServiceLocator.Register <StorageModuleConfigurationManager> (storageConfigMnager); ServiceLocator.Register <LoggingModuleConfigurationManager> (loggingConfigManager); }
private void ConfigureDataAccessLayers( ) { IStorageDataAccessAgent storageDataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent> ( ); if (storageDataAccess != null && storageDataAccess is StorageDbDataAccessAgent) { StorageModuleConfigurationManager storageConfig = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( ); if (storageConfig.IsLoaded) { ((StorageDbDataAccessAgent)storageDataAccess).AutoTruncateData = storageConfig.GetStorageAddInsSettings(ServerState.Instance.ServiceName).StoreAddIn.AutoTruncateData; } } }
void View_DeleteServer(object sender, EventArgs e) { if (null != ServerState.Instance.ServerService) { using (ConfirmWithReasonDialog confirmDlg = new ConfirmWithReasonDialog()) { confirmDlg.Text = "Confirm Delete"; confirmDlg.Message = string.Format("Are you sure you want to delete {0}?\n\nType the reason for deleting {0}.", ServerState.Instance.ServerService.Settings.AETitle); confirmDlg.ConfirmIcon = Resources.Warning_128; confirmDlg.ConfirmCheckBoxVisible = false; if (confirmDlg.ShowDialog(View) != DialogResult.OK) { return; } string serviceName = ServerState.Instance.ServerService.ServiceName; string additionalInfo = string.Format("\n\nReason for deleting: {0}", confirmDlg.Reason); GlobalPacsUpdater.ModifyGlobalPacsConfiguration(DicomDemoSettingsManager.ProductNameStorageServer, serviceName, GlobalPacsUpdater.ModifyConfigurationType.Remove); #if (LEADTOOLS_V19_OR_LATER_MEDICAL_VERIFY_ADDINS) || (LEADTOOLS_V19_OR_LATER) ServerState.Instance.ServerService.Message -= new EventHandler <MessageEventArgs>(Shell.ServerService_Message); #endif ServerState.Instance.ServiceAdmin.UnInstallService(ServerState.Instance.ServerService); ServerState.Instance.ServerService.Dispose(); StorageModuleConfigurationManager sotrageConfigManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager>(); LoggingModuleConfigurationManager loggingConfigManager = ServiceLocator.Retrieve <LoggingModuleConfigurationManager>(); sotrageConfigManager.Unload(); loggingConfigManager.Unload(); ServerState.Instance.ServerService = null; LocalAuditLogQueue.AddAuditMessage(AuditMessages.ServerServiceDeleted.Key, string.Format(AuditMessages.ServerServiceDeleted.Message, serviceName) + additionalInfo); } } }
void dbManager_ConfigureStoreCommand(object sender, StoreCommandEventArgs e) { try { if (ServerState.Instance.ServerService != null) { StorageModuleConfigurationManager configManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( ); if (configManager.IsLoaded) { StorageAddInsConfiguration storageSettings = configManager.GetStorageAddInsSettings( ); StoreCommandInitializationService.ConfigureCStoreCommand(e.Command, storageSettings.StoreAddIn); StoreCommandInitializationService.ConfigureInstanceCStoreCommand(e.Command, storageSettings.StoreAddIn); } } } catch {} }
private void ApplyStorageSettingsPermissions() { if (null != __DbManager) { StorageModuleConfigurationManager configManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager>(); if (configManager.IsLoaded) { StorageAddInsConfiguration storageSettings = configManager.GetStorageAddInsSettings(); if (storageSettings != null) { __DbManager.DeleteFilesOnDatabaseDelete = storageSettings.StoreAddIn.DeleteFiles; __DbManager.BackupFilesOnDatabaseDelete = storageSettings.StoreAddIn.BackupFilesOnDelete; __DbManager.BackupFilesOnDeleteFolder = storageSettings.StoreAddIn.DeleteBackupLocation; #if LEADTOOLS_V20_OR_LATER __DbManager.MetadataOptions = storageSettings.StoreAddIn.GetMetadataOptions(); #endif } } } }
public override void Load(string serviceDirectory, string displayName) { _serviceDirectory = serviceDirectory; _displayName = displayName; DicomServer server = ServiceLocator.Retrieve <DicomServer>(); if (server != null) { _serverAE = server.AETitle; _serviceName = server.Name; } _settings = AdvancedSettings.Open(serviceDirectory); Type[] extraTypes = null;// Options = Settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", extraTypes); StorageConfigManager = new StorageModuleConfigurationManager(true); StorageConfigManager.Load(ServiceDirectory); }
static void dbManager_ConfigureStoreCommandExport(object sender, StoreCommandEventArgs e) { try { if (ServerState.Instance.ServerService != null) { StorageModuleConfigurationManager configManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager>(); if (configManager.IsLoaded) { StorageAddInsConfiguration storageSettings = configManager.GetStorageAddInsSettings(); StoreCommandInitializationService.ConfigureCStoreCommand(e.Command, storageSettings.StoreAddIn); // StoreCommandInitializationService.ConfigureInstanceCStoreCommand ( e.Command, storageSettings.StoreAddIn ) ; InstanceCStoreCommand instanceStoreCommand = e.Command as InstanceCStoreCommand; if (instanceStoreCommand != null) { instanceStoreCommand.InstanceConfiguration.CreateBackupForDuplicateSop = false; instanceStoreCommand.InstanceConfiguration.UpdateInstanceData = false; instanceStoreCommand.InstanceConfiguration.UpdatePatientData = false; instanceStoreCommand.InstanceConfiguration.UpdateSeriesData = false; instanceStoreCommand.InstanceConfiguration.UpdateStudyData = false; instanceStoreCommand.InstanceConfiguration.ValidateDuplicateSopInstanceUID = false; } CStoreCommand storeCommand = e.Command as CStoreCommand; if (storeCommand != null && storeCommand.Configuration != null) { storeCommand.Configuration.OtherImageFormat.Clear(); storeCommand.Configuration.SaveThumbnail = false; } } } } catch { } }
public virtual DicomDataSet GetDicomDataSet(DataRow instanceData, out string referencedFileLocation) { lock (_lockObject) { referencedFileLocation = string.Empty; DicomDataSet ds = RegisteredDataRows.InstanceInfo.LoadDicomDataSet(instanceData, Flags); if (CacheLocal) { bool exists = false; Exception ex = DefaultCrud.ExistsDicom(instanceData, out exists); if (!exists) { StorageModuleConfigurationManager StorageConfigManager = new StorageModuleConfigurationManager(true); StorageConfigManager.Load(ServiceDirectory); StorageAddInsConfiguration storageSettings = StorageConfigManager.GetStorageAddInsSettings(); CStoreCommandConfiguration storeConfig = new CStoreCommandConfiguration(); storeConfig.DicomFileExtension = storageSettings.StoreAddIn.StoreFileExtension; FillStoreCommandDefaultSettings(storeConfig, storageSettings); string storageLocation = CStoreCommand.GetStorageLocation(storeConfig, ds); string sopInstanceUid = RegisteredDataRows.InstanceInfo.GetElementValue(instanceData, DicomTag.SOPInstanceUID); string dicomInstancePath = Path.Combine(storageLocation, sopInstanceUid + "." + storeConfig.DicomFileExtension); ICrud crud = DefaultInstanceInfo.GetRetrieveCrud(instanceData); if (crud != null) { ex = crud.RetrieveFile(instanceData, dicomInstancePath); if (ex == null) { ExternalStoreAgent.SetReferencedFile(sopInstanceUid, dicomInstancePath); referencedFileLocation = dicomInstancePath; } } } } return(ds); } }
private void InitializeStorageAddinsSettings() { IStorageDataAccessAgent storageDataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>(); if (storageDataAccess != null && storageDataAccess is StorageDbDataAccessAgent) { StorageModuleConfigurationManager storageConfig = ServiceLocator.Retrieve <StorageModuleConfigurationManager>(); if (storageConfig.IsLoaded) { StorageAddInsConfiguration settings = storageConfig.GetStorageAddInsSettings(ServerState.Instance.ServiceName); if (settings != null) { if (settings.StoreAddIn.AutoCreateFolderLocations != AutoCreateLocationsDefault) { settings.StoreAddIn.AutoCreateFolderLocations = AutoCreateLocationsDefault; storageConfig.SetStorageAddinsSettings(settings); storageConfig.Save(); } } } } }
public override void Load(string serviceDirectory, string displayName) { System.Configuration.Configuration configuration; DicomServer server = ServiceLocator.Retrieve <DicomServer>(); ServiceDirectory = serviceDirectory; ServiceName = server.Name; ServerAE = server.AETitle; server.ServerSettingsChanged += new EventHandler(server_ServerSettingsChanged); StorageConfigManager = new StorageModuleConfigurationManager(true); StorageConfigManager.Load(serviceDirectory); configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory); if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>()) { StorageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IStorageDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(StorageAgent); } else { StorageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>(); } try { AdvancedSettings settings = AdvancedSettings.Open(ServiceDirectory); string name = Assembly.GetExecutingAssembly().GetName().Name; RegisterServerEvents(settings); Options = settings.GetAddInCustomData <PatientUpdaterOptions>(_AddIn, _Name); if (Options == null) { Options = new PatientUpdaterOptions(); } if (Options.EnableAutoUpdate) { UpdateQueue = new AutoUpdateQueue(Options.AutoUpdateThreads); UpdateQueue.InitializeDatabase(); } } catch (Exception e) { if (Options == null) { Options = new PatientUpdaterOptions(); } Logger.Global.Error(Source, e.Message); } if (Options.EnableRetry) { if (string.IsNullOrEmpty(Module.Options.RetryDirectory)) { Module.Options.RetryDirectory = Path.Combine(ServiceDirectory, @"AutoUpdate\"); } RetryProcessor = new AutoRetryProcessor(Options.RetryDirectory); RetryProcessor.Start(Options.RetrySeconds, Options.RetryDays); } }
void View_AddServer(object sender, EventArgs e) { ServerSettings settings; DicomService service; if (null == ServerState.Instance.ServiceAdmin) { CreateServiceAdmin(ServerState.Instance.ServiceName); } settings = new ServerSettings( ); UpdateServerSettings(settings); string[] addIns = GetAddIns(); //string [] addIns = new string [] { // "Leadtools.Medical.AutoCopy.AddIn.dll", // "Leadtools.Medical.PatientUpdater.AddIn.dll", // "Leadtools.Medical.Storage.Addins.dll", // "Leadtools.Medical.Forwarder.AddIn.dll", //}; string[] configurationAddIns = GetConfigurationAddIns(); //string[] configurationAddIns = new string[] { // "Leadtools.Medical.Ae.Configuration.dll", // "Leadtools.Medical.Logging.Addin.dll", // "Leadtools.Medical.License.Configuration.dll", //}; InstallAddIns(addIns, configurationAddIns, settings.AETitle); // Delete the advanced.config if it exsists // It might be left over from a previous uninstall string configLocation = Path.Combine(Path.Combine(ServerState.Instance.ServiceAdmin.BaseDirectory, settings.AETitle), "advanced.config"); try { if (File.Exists(configLocation)) { File.Delete(configLocation); } } catch (Exception) { } service = ServerState.Instance.ServiceAdmin.InstallService(settings); StorageModuleConfigurationManager sotrageConfigManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( ); LoggingModuleConfigurationManager loggingConfigManager = ServiceLocator.Retrieve <LoggingModuleConfigurationManager> ( ); sotrageConfigManager.Load(service.ServiceDirectory); loggingConfigManager.Load(service.ServiceDirectory); ServerState.Instance.ServerService = service; #if (LEADTOOLS_V19_OR_LATER_MEDICAL_VERIFY_ADDINS) || (LEADTOOLS_V19_OR_LATER) ServerState.Instance.ServerService.Message += new EventHandler <MessageEventArgs>(Shell.ServerService_Message); #endif InitializeStorageAddinsSettings(); AddConfigAssemblies(service.ServiceDirectory, "Leadtools.Medical.Logging.Addin.dll"); GlobalPacsUpdater.ModifyGlobalPacsConfiguration(DicomDemoSettingsManager.ProductNameStorageServer, settings.AETitle, GlobalPacsUpdater.ModifyConfigurationType.Add); LocalAuditLogQueue.AddAuditMessage(AuditMessages.ServerServiceCreated.Key, string.Format(AuditMessages.ServerServiceCreated.Message, service.ServiceName, service.Settings.AETitle, service.Settings.IpAddress, service.Settings.Port)); }
public override void Load(string serviceDirectory, string displayName) { IForwardDataAccessAgent forwardAgent; IAeManagementDataAccessAgent aeAgent; IStorageDataAccessAgent storageAgent; AdvancedSettings settings = AdvancedSettings.Open(serviceDirectory); RegisterServerEvents(settings); _serviceDirectory = serviceDirectory; DicomServer server = ServiceLocator.Retrieve <DicomServer>(); ServiceName = server.Name; _Timeout = server.ClientTimeout <= 0 ? 30 : server.ClientTimeout; try { Options = settings.GetAddInCustomData <ForwardOptions>(ForwardManagerPresenter._addinName, "ForwardOptions"); if (Options == null) { Options = new ForwardOptions(); } } catch (Exception e) { if (Options == null) { Options = new ForwardOptions(); } Logger.Global.Error(Source, e.Message); } StorageConfigManager = new StorageModuleConfigurationManager(true); StorageConfigManager.Load(ServiceDirectory); System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory); if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>()) { forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IForwardDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardAgent); } else { forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>(); } if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>()) { aeAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeAgent); } else { aeAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>(); } _aeManagementAgent = aeAgent; if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>()) { storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IStorageDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent); } else { storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>(); } JobManager = new JobManager(Options, forwardAgent, aeAgent, storageAgent); JobManager.ServerAE = _ServerAE; if (IsLicenseValid()) { JobManager.Start(); } }
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)); }
void View_ConfirmChanges(object sender, EventArgs e) { // Code below prevents the "configuration file has been changed by another program' exception // This happens when an addin that the server manager does not know about (i.e. Leadtools.Medical.Rules.Addin) saves its settings into 'advanced.config', which occurs in a different process // When the main process (server manager UI) saves the advanced.config without doing a RefreshSettings first, the exception occurs // // To prevent this: // Get a reference to the global copy of 'advanced.config' and refresh from disk (RefreshSettings) // All the presenters (i.e. _PatientUpdaterPresenter) have a reference to this, but it is the same reference // Now copy all settings into the reference to 'advanced.config' and save if (ServerState.Instance.ServerService != null) { AdvancedSettings settings = AdvancedSettings.Open(ServerState.Instance.ServerService.ServiceDirectory); settings.RefreshSettings(); } // These live in Leadtools.Medical.Winforms.dll __LoggingConfigPresenter.UpdateState( ); __PatientUpdaterPresenter.SaveOptions( ); __AutoCopyPresenter.SaveOptions( ); __ForwardPresenter.SaveOptions(); if (__SecurityOptionsPresenter.IsDirty) { __SecurityOptionsPresenter.SaveOptions(); } #if LEADTOOLS_V19_OR_LATER bool isStorageCommitDirty = __StorageCommitPresenter.IsDirty; if (isStorageCommitDirty) { __StorageCommitPresenter.SaveOptions(); // This fails if the service is not running // This is not a problem, because once the service starts it will read the options try { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "SendMessage(ExternalStoreMessage.SettingsChanged)"); // ServerState.Instance.ServerService.SendMessage(ExternalStoreMessage.SettingsChanged); } catch (Exception ex) { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Exception: SendMessage(ExternalStoreMessage.SettingsChanged)" + ex.Message); } } #endif bool isSecurityOptionsDirty = __SecurityOptionsPresenter.IsDirty; if (isSecurityOptionsDirty) { __SecurityOptionsPresenter.SaveOptions(); // This fails if the service is not running // This is not a problem, because once the service starts it will read the options try { // DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "SendMessage(SecurityOptionsMessage.SettingsChanged)"); // ServerState.Instance.ServerService.SendMessage(SecurityOptionsMessage.SettingsChanged); } catch (Exception) { // DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Exception: SendMessage(SecurityOptionsMessage.SettingsChanged)" + ex.Message); } } #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER) bool isExternalStoreDirty = __ExternalStorePresenter.IsDirty; DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "__ExternalStorePresenter.IsDirty : " + isExternalStoreDirty.ToString()); if (isExternalStoreDirty) { __ExternalStorePresenter.SaveOptions(); // This fails if the service is not running // This is not a problem, because once the service starts it will read the options try { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "SendMessage(ExternalStoreMessage.SettingsChanged)"); ServerState.Instance.ServerService.SendMessage(ExternalStoreMessage.SettingsChanged); } catch (Exception ex) { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Exception: SendMessage(ExternalStoreMessage.SettingsChanged)" + ex.Message); } } #endif // #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER) if (__StorageClassesPresenter.IsDirty) { StorageModuleConfigurationManager configManager; configManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( ); __StorageClassesPresenter.UpdateSettings(); if (configManager.IsLoaded) { configManager.SetPresentationContextsTimestamp( ); } } #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) if (__AnonymizeOptionsPresenter.IsDirty) { StorageModuleConfigurationManager configManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( ); __AnonymizeOptionsPresenter.UpdateSettings(); } #endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER) if (null != __StorageSettingsPresenter) { if (__StorageSettingsPresenter.IsDirty) { __StorageSettingsPresenter.UpdateState(); __StorageSettingsPresenter.SaveSettings(); } } if (__DatabaseManagerOptionsPresenter.IsDirty) { __DatabaseManagerOptionsPresenter.SaveOptions(); DatabaseManagerOptionsAppliedEventArgs args = new DatabaseManagerOptionsAppliedEventArgs(); EventBroker.Instance.PublishEvent <DatabaseManagerOptionsAppliedEventArgs> (this, args); } #if LEADTOOLS_V20_OR_LATER if (__ClientConfigurationOptionsPresenter.IsDirty) { __ClientConfigurationOptionsPresenter.SaveOptions(); ClientConfigurationOptionsAppliedEventArgs args = new ClientConfigurationOptionsAppliedEventArgs(); EventBroker.Instance.PublishEvent <ClientConfigurationOptionsAppliedEventArgs> (this, args); } #endif // #if LEADTOOLS_V20_OR_LATER // These live in the EXE EventBroker.Instance.PublishEvent <ApplyServerSettingsEventArgs> (this, new ApplyServerSettingsEventArgs( )); EventBroker.Instance.PublishEvent <ServerSettingsAppliedEventArgs> (this, new ServerSettingsAppliedEventArgs( )); if (null != __PasswordOptionsPresenter) { __PasswordOptionsPresenter.SaveOptions(); } LocalAuditLogQueue.FlushLogs(Logger.Global, UserManager.User.Name); View.CanApply = false; }