public void Initialize(PatientUpdaterOptions options, IAeManagementDataAccessAgent accessAgent) { _Options = options; // Request Dataset Validation checkBoxStation.Checked = _Options.ValidateStationName; checkBoxOperator.Checked = _Options.ValidateOperatorsName; checkBoxTransaction.Checked = _Options.ValidateTransactionUID; checkBoxDate.Checked = _Options.ValidateDate; checkBoxTime.Checked = _Options.ValidateTime; checkBoxDescription.Checked = _Options.ValidateDescription; checkBoxReason.Checked = _Options.ValidateReason; // AutoUpdate checkBoxAutoUpdate.Checked = _Options.EnableAutoUpdate; // AutoUpdate Retry checkBoxRetry.Checked = _Options.EnableRetry; numericUpDownDays.Value = Convert.ToDecimal(_Options.RetryDays); numericUpDownsSecs.Value = Convert.ToDecimal(_Options.RetrySeconds); textBoxDir.Text = _Options.RetryDirectory; // AutoUpdate Messages GetAddAutoUpdateOptions(listViewPatientUpdaterMessages, _Options.AutoUpdateOptions); // AutoUpdate Advanced checkBoxCustomAE.Checked = _Options.UseCustomAE; textBoxCustomAE.Text = _Options.AutoUpdateAE; numericUpDownThreads.Value = Convert.ToDecimal(_Options.AutoUpdateThreads); _AccessAgent = accessAgent; EnableAutoUpdate(); }
private void InitializeView() { PatientUpdaterOptions clonedOptions; if (!string.IsNullOrEmpty(_ServiceDirectory)) { _Settings = AdvancedSettings.Open(_ServiceDirectory); _options = _Settings.GetAddInCustomData <PatientUpdaterOptions>(_AddIn, _Name); if (_options == null) { _options = new PatientUpdaterOptions(); } } else { _Settings = null; _options = new PatientUpdaterOptions(); } if (string.IsNullOrEmpty(_options.RetryDirectory)) { _options.RetryDirectory = Path.Combine(_ServiceDirectory, @"AutoUpdate\"); } clonedOptions = Clone(_options); _view.Initialize(clonedOptions, _aeAccessAgent); }
public PatientUpdaterOptions Clone(PatientUpdaterOptions options) { try { // // Don't serialize a null object, simply return the default for that object // if (Object.ReferenceEquals(options, null)) { return(null); } if (!options.GetType().IsSerializable) { throw new ArgumentException("The type must be serializable.", "source"); } AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(); using (stream) { formatter.Serialize(stream, options); stream.Seek(0, SeekOrigin.Begin); return((PatientUpdaterOptions)formatter.Deserialize(stream)); } } finally { AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; } }
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); } }