예제 #1
0
        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));
        }
        private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StorageModuleConfigurationManager configurationManager;
            AddInsConfigurationDialog         addinsConfiguration;
            StorageSettingsPresenter          storageSettingsPresenter;
            StorageClassesPresenter           storageClassesPresenter;

            if (ServiceLocator.IsRegistered <StorageModuleConfigurationManager> ( ))
            {
                configurationManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( );
            }
            else
            {
                return;
            }

            addinsConfiguration      = new AddInsConfigurationDialog( );
            storageSettingsPresenter = new StorageSettingsPresenter(configurationManager);
            storageClassesPresenter  = new StorageClassesPresenter( );

#if (LEADTOOLS_V19_OR_LATER)
            DatabaseManagerOptionsPresenter databaseManagerOptionsPresenter = new DatabaseManagerOptionsPresenter();
            databaseManagerOptionsPresenter.RunView(addinsConfiguration.AddInsConfiguration.DatabaseManagerOptionsView);

            AnonymizeOptionsPresenter anonymizePresenter = new AnonymizeOptionsPresenter();
            anonymizePresenter.RunView(addinsConfiguration.AddInsConfiguration.AnonymizeOptionsView);
#endif // #if (LEADTOOLS_V19_OR_LATER)

            storageSettingsPresenter.RunViews(addinsConfiguration.AddInsConfiguration.StorageOptionsView,
                                              addinsConfiguration.AddInsConfiguration.QueryOptionsView,
                                              false);


            storageClassesPresenter.RunView(addinsConfiguration.AddInsConfiguration.StorageClassesTabControl);

            addinsConfiguration.CanViewIodClasses = storageClassesPresenter.IsOptionsAgentRegistered();

            if (DialogResult.OK == addinsConfiguration.ShowDialog(this))
            {
                storageSettingsPresenter.UpdateState();

                // Fix for 11446IDT -- StorageAddin for the CSLeadtools.Server.Manager.exe is not persisting IOD values for the LEADTOOLS Storage Server service
                storageClassesPresenter.UpdateSettings();

                databaseManager1.DeleteAnnotationsOnImageDelete = addInsSettings.StoreAddIn.DeleteAnnotationsOnImageDelete;

                AddInsSettings = storageSettingsPresenter.Settings;

#if (LEADTOOLS_V19_OR_LATER)
                databaseManagerOptionsPresenter.SaveOptions();
                DatabaseManagerOptionsAppliedEventArgs args = new DatabaseManagerOptionsAppliedEventArgs();
                EventBroker.Instance.PublishEvent <DatabaseManagerOptionsAppliedEventArgs> (this, args);
                anonymizePresenter.UpdateSettings();
#endif // #if (LEADTOOLS_V19_OR_LATER)

                storageSettingsPresenter.SaveSettings( );
            }
            else
            {
                storageSettingsPresenter.ResetView( );
            }
        }