private void ConfigureServerInfoConrol(ServerInformationControl serverInfoControl)
        {
            ConnectionStringSettings logging;
            ConnectionStringSettings storage;
            ConnectionStringSettings options;
            ConnectionStringSettings userManagement;
            ConnectionStringSettings userPermissions;
            ConnectionStringSettings aeManagement;
            ConnectionStringSettings aePermissions;
            ConnectionStringSettings forwarding;

            System.Configuration.Configuration configPacs = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

            // Machine.config file
            System.Configuration.Configuration configMachine = ConfigurationManager.OpenMachineConfiguration();

#if TUTORIAL_CUSTOM_DATABASE
            // To use a custom database schema with the Database Manager, you must define a connection string in the 'globalPacs.config' for your database.
            // You must use your 'MyStorageDataAccessConfigurationView' class to retrieve the connection string.
            // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.

            storage = GetConnectionString(configPacs, configMachine, new MyStorageDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
#else
            storage = GetConnectionString(configPacs, configMachine, new StorageDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
#endif
            logging         = GetConnectionString(configPacs, configMachine, new LoggingDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
            options         = GetConnectionString(configPacs, configMachine, new OptionsDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
            userManagement  = GetConnectionString(configPacs, configMachine, new UserManagementDataAccessConfigurationView(configPacs, ProductName, null).DataAccessSettingsSectionName);
            userPermissions = GetConnectionString(configPacs, configMachine, new PermissionManagementDataAccessConfigurationView(configPacs, ProductName, null).DataAccessSettingsSectionName);
            aeManagement    = GetConnectionString(configPacs, configMachine, new AeManagementDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
            aePermissions   = GetConnectionString(configPacs, configMachine, new AePermissionManagementDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
            forwarding      = GetConnectionString(configPacs, configMachine, new ForwardDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);


            Dictionary <string, string> connections = new Dictionary <string, string>();
            string storageDatabaseName = "Storage Database";
            connections.Add(storageDatabaseName, storage.ConnectionString);
            connections.Add("Logging Database", logging.ConnectionString);
            connections.Add("Server Configuration Database", options.ConnectionString);
            connections.Add("User Management Database", userManagement.ConnectionString);
            connections.Add("User Permissions Database", userPermissions.ConnectionString);
            connections.Add("Client Management Database", aeManagement.ConnectionString);
            connections.Add("Client Permissions Database", aePermissions.ConnectionString);
            connections.Add("Forwarding Database", forwarding.ConnectionString);

            serverInfoControl.SqlDatabaseList                      = connections;
            serverInfoControl.StorageDatabaseName                  = storageDatabaseName;
            serverInfoControl.MaximumClientConnectionCount         = ServerState.Instance.ServerService == null?5:ServerState.Instance.ServerService.Settings.MaxClients;
            serverInfoControl.RequestCurrentClientConnectionCount += new EventHandler <CurrentClientConnectionCountEventArgs>(serverInfoControl_RequestCurrentClientConnectionCount);
            serverInfoControl.ServiceName      = ServerState.Instance.ServerService == null ? string.Empty : ServerState.Instance.ServiceName;
            _serverInfoControl                 = serverInfoControl;
            _serverInfoControl.HideUserDetails = Program.ShouldHideUserDetails();

            if (ServerState.Instance.ServerService != null)
            {
                ServerState.Instance.ServerService.Message      += new EventHandler <Leadtools.Dicom.Server.Admin.MessageEventArgs>(ServerService_Message);
                ServerState.Instance.ServerService.StatusChange += new EventHandler(ServerService_StatusChange);
                if (ServerState.Instance.ServerService.Status == System.ServiceProcess.ServiceControllerStatus.Running)
                {
                    _serverInfoControl.SetStartTime();
                }
            }

            ServerState.Instance.ServerServiceChanged += new EventHandler(Instance_ServerServiceChanged);
            EventBroker.Instance.Subscribe <ServerSettingsAppliedEventArgs>(new EventHandler <ServerSettingsAppliedEventArgs>(OnSettingsChanged));
        }
        private void CreateContainerPages( )
        {
            ControlPanelView         controlPanelView  = new ControlPanelView( );
            ServerInformationView    serverInfoView    = new ServerInformationView( );
            ServerAddinsView         serverAddInView   = new ServerAddinsView( );
            ServerSettingsDialog     serverSettingsDlg = new ServerSettingsDialog( );
            ServerInformationControl serverInfoControl = new ServerInformationControl();

            ControlPanelPresenter      controlPanelPresenter   = new ControlPanelPresenter( );
            ServerInformationPresenter serverInfoPresenter     = new ServerInformationPresenter( );
            ServerAddinPresenter       serverAddInPresenter    = new ServerAddinPresenter( );
            ServerSettingsPresenter    serverSettingsPresenter = new ServerSettingsPresenter( );

#if LEADTOOLS_V19_OR_LATER
            RealTimeViewPresenter realTimePresenter = new RealTimeViewPresenter();
#endif

            StorageDatabaseManager dbManager = new StorageDatabaseManager( );
#if TUTORIAL_CUSTOM_DATABASE
            // To use a custom database schema with the Database Manager, you must define a custom MyPrepareSearch method
            // and assign it to the StorageDatabaseManager.PrepareSearch delegate.
            // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.

            dbManager.PrepareSearch = new PrepareSearchDelegate(MyPrepareSearch);
#endif
            EventLogViewer logViewer = new EventLogViewer( );

#if LEADTOOLS_V19_OR_LATER
            RealTimeViewerControl realTimeView = new RealTimeViewerControl()
            {
                Visible = false
            };
#endif

            dbManager.BackColor         = Color.FromArgb(75, 75, 75);
            logViewer.BackColor         = Color.White;
            logViewer.PathLogDump       = this.PathLogDump;
            serverInfoControl.BackColor = Color.White;

            ThemesManager.ApplyTheme(controlPanelView);
            ThemesManager.ApplyTheme(logViewer);
            ThemesManager.ApplyTheme(dbManager);
            ThemesManager.ApplyTheme(serverInfoControl);

#if LEADTOOLS_V19_OR_LATER
            ThemesManager.ApplyTheme(realTimeView);
#endif

            ConfigureServerInfoConrol(serverInfoControl);

            View.SetHeader(serverInfoView);

            AddPage(new PageData(controlPanelView, "Control Panel", null));

            //AddPage ( new PageData ( new Control ( ), "Security", null ) ) ;
            AddPage(new PageData(logViewer, "Event Log", null));
            AddPage(new PageData(serverInfoControl, "System Information", null));

            dbManager.MergeImportDicom = true;

#if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)
            dbManager.EnableExport = true;
#endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)

            dbManager.Enabled = ServerState.Instance.ServerService != null;

            if (ServerState.Instance.ServerService != null)
            {
                dbManager.AETitle = ServerState.Instance.ServerService.Settings.AETitle;
            }

            AddPage(new PageData(dbManager, "Database Manager", null));

            dbManager.Enabled = true;

#if LEADTOOLS_V19_OR_LATER
            AddPage(new PageData(realTimeView, "Live View", null));
#endif
            InitializeLicenseView();

            serverAddInView.Enabled = UserManager.User.IsAdmin();
            AddPage(new PageData(serverAddInView, "Add-ons", null));

            controlPanelPresenter.RunView(controlPanelView);
            serverInfoPresenter.RunView(serverInfoView);
            serverAddInPresenter.RunView(serverAddInView);
            serverSettingsPresenter.RunView(serverSettingsDlg);

#if LEADTOOLS_V19_OR_LATER
            realTimePresenter.RunView(realTimeView);
#endif

            if (DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                _AccessAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }

            dbManager.CancelStore           += new EventHandler <CancelStoreEventArgs>  (dbManager_CancelStore);
            dbManager.ConfigureStoreCommand += new EventHandler <StoreCommandEventArgs> (dbManager_ConfigureStoreCommand);

#if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)
            dbManager.ConfigureStoreExportCommand += new EventHandler <StoreCommandEventArgs> (dbManager_ConfigureStoreCommandExport);
#endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)


#if TUTORIAL_CUSTOM_DATABASE
            // To use a custom database schema with the Database Manager, you must define a custom MyPrepareSearch method
            // and assign it to the StorageDatabaseManager.PrepareSearch delegate. After doing this, the search fields in the Database Manager
            //will properly refine any database manager search.  The MyPrepareSearch() method gets the search fields specified in the database manager
            // by calling StorageDatabaseManager.GetDicomQueryParams().  This returns any query parameters specified.
            // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.

            dbManager.GetDicomQueryParams();
#endif
            __DbManager      = dbManager;
            __ServerInfoView = serverInfoView;

            ApplyPermissions( );

            ApplyStorageSettingsPermissions( );

            Instance_LicenseChanged(this, EventArgs.Empty);
            ServerState.Instance.LicenseChanged += new EventHandler(Instance_LicenseChanged);
        }