public override void Load(string serviceDirectory, string displayName) { bool isLicensed = false; ILicense license = null; if (ServiceLocator.IsRegistered <ILicense>()) { license = ServiceLocator.Retrieve <ILicense>(); } InitializeLicense(); isLicensed = IsLicenseValid(); try { AdvancedSettings settings = AdvancedSettings.Open(serviceDirectory); ServiceDirectory = serviceDirectory; DisplayName = displayName; DicomServer server = ServiceLocator.Retrieve <DicomServer>(); ServiceName = server.Name; GetService(serviceDirectory, displayName); if (!ServiceLocator.IsRegistered <SettingsChangedNotifier>()) { SettingsChangedNotifier configChangedNotifier = new SettingsChangedNotifier(settings); configChangedNotifier.SettingsChanged += new EventHandler(configChangedNotifier_SettingsChanged); configChangedNotifier.Enabled = true; ServiceLocator.Register <SettingsChangedNotifier>(configChangedNotifier); } else { ServiceLocator.Retrieve <SettingsChangedNotifier>().SettingsChanged += new EventHandler(configChangedNotifier_SettingsChanged); } if (isLicensed) { ConfigureRuleProcessor(settings); } } catch (Exception e) { if (_Options == null) { _Options = new RuleProcessorOptions(); } Logger.Global.Error(Source, e.Message); } ConfigureScriptProcessor(serviceDirectory, isLicensed); if (license != null) { license.LicenseChanged += new EventHandler(license_LicenseChanged); } }
public static void ConfigureRuleProcessor(AdvancedSettings settings) { string name = Assembly.GetExecutingAssembly().GetName().Name; settings.RefreshSettings(); _Options = settings.GetAddInCustomData <RuleProcessorOptions>(name, Source); if (_Options == null) { _Options = new RuleProcessorOptions(); _Options.RuleDirectory = Path.Combine(ServiceDirectory, @"AddIns\Rules"); } if (!Directory.Exists(_Options.RuleDirectory)) { Directory.CreateDirectory(_Options.RuleDirectory); } }
public RuleEditorPresenter(RuleProcessorOptions options, string serverDirectory) { _Options = options; _ServerDirectory = serverDirectory; }