public void RunView(StorageServerContainerView view) { View = view; CreateContainerPages( ); EventBroker.Instance.Subscribe <CurrentUserPemissionsChangedEventArgs> (OnCurrentUserPermissionChanged); EventBroker.Instance.Subscribe <ServerSettingsAppliedEventArgs> (OnServerSettingsApplied); }
public void Run( ) { try { StorageServerContainerView containerPanel = new StorageServerContainerView( ); StorageServerContainerPresenter containerPresenter = new StorageServerContainerPresenter(); RegisterDataAccessLayers( ); _Form = new MainForm( ); _Form.Text = Shell.storageServerName; containerPanel.Dock = DockStyle.Fill; containerPanel.GradientMode = LinearGradientMode.Vertical; _Form.Controls.Add(containerPanel); using (ServiceAdministrator serverAdmin = new ServiceAdministrator(Application.StartupPath)) { DicomService service = null; string serviceName = InitializeServiceAdmin(serverAdmin); if (serverAdmin.Services.Count > 0) { service = serverAdmin.Services [serviceName]; } CreateConfigurationServices(service); #if TUTORIAL_CUSTOM_DATABASE // To use a custom database schema, you must create and register your CatalogEntity classes (MyPatient, MyStudy, MySeries, MyInstance). // Also, you must register your classes to extract DICOM data from a System.Data.DataRow (MyPatientInfo, MyStudyInfo, MySeriesInfo, MyInstanceInfo // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial. DataAccessServiceLocator.Register <IPatientInfo>(new MyPatientInfo()); DataAccessServiceLocator.Register <IStudyInfo>(new MyStudyInfo()); DataAccessServiceLocator.Register <ISeriesInfo>(new MySeriesInfo()); DataAccessServiceLocator.Register <IInstanceInfo>(new MyInstanceInfo()); RegisteredEntities.Items.Add(RegisteredEntities.PatientEntityName, typeof(MyPatient)); RegisteredEntities.Items.Add(RegisteredEntities.StudyEntityName, typeof(MyStudy)); RegisteredEntities.Items.Add(RegisteredEntities.SeriesEntityName, typeof(MySeries)); RegisteredEntities.Items.Add(RegisteredEntities.InstanceEntityName, typeof(MyInstance)); #endif ServerState.Instance.ServerService = service; #if (LEADTOOLS_V19_OR_LATER_MEDICAL_VERIFY_ADDINS) || (LEADTOOLS_V19_OR_LATER) if (ServerState.Instance.ServerService != null) { ServerState.Instance.ServerService.Message += new EventHandler <MessageEventArgs>(ServerService_Message); } #endif ServerState.Instance.ServiceAdmin = serverAdmin; ServerState.Instance.BaseDirectory = Application.StartupPath; ServerState.Instance.ServiceName = serviceName; ConfigureDataAccessLayers( ); LoadLoggingState(service); InitializeLogger( ); #if LEADTOOLS_V18_OR_LATER CheckLicenseFile(); #endif // #if LEADTOOLS_V18_OR_LATER string csPathLogDump = ServerState.Instance.LoggingState.AutoSaveDirectory; containerPresenter.PathLogDump = csPathLogDump; containerPresenter.RunView(containerPanel); SubscribeToEvents( ); new AuditLogSubscriber( ).Start( ); new CStoreAddIn().Start(); LogAudit(string.Format(AuditMessages.UserLogIn.Message, UserManager.User.FriendlyName)); Start(_Form); if (UserManager.User != null) { LogAudit(string.Format(AuditMessages.UserLogOff.Message, UserManager.User.FriendlyName)); } else { LogAudit("Canceled idle timer re-login"); } } } catch (Exception) { // Console.WriteLine ( ex.Message ) ; throw; } }