Exemplo n.º 1
0
 public void RunView(RealTimeViewerControl view)
 {
     _View = view;
     _View.VisibleChanged   += new EventHandler(_View_VisibleChanged);
     _View.DisconnectClient += new EventHandler <DisconnectClientEventArgs>(_View_DisconnectClient);
     ServerState.Instance.ServerServiceChanged += new EventHandler(Instance_ServerServiceChanged);
     HookEvents();
 }
        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);
        }