public override bool IsSettingSupported(ConfigSetting setting) { if (!(setting is CustomConfigSetting)) return false; ConfigSettingMetadata metadata = (ConfigSettingMetadata) setting.Metadata; return metadata.AdditionalData.ContainsKey("WorkflowState"); }
public void Initialize(ConfigSetting setting) { if (_setting != null) _setting.Changed -= OnSettingChanged; _setting = setting; if (_setting != null) { _setting.Changed += OnSettingChanged; _setting.Load(); } SettingChanged(); }
/// <summary> /// Override this to handle changes in other instances of ConfigBase. /// </summary> /// <param name="sender">Sender of the change notification.</param> protected virtual void ConfigChangedHandler(ConfigSetting sender) { // Needs to be overriden by the inheriting class. }
/// <summary> /// Registers this instance to the <see cref="Changed"/> of the <paramref name="other"/> /// setting. /// This object will be notified by the other object on a change. /// </summary> /// <param name="other">Other setting which should notify this setting when it changes.</param> public void ListenTo(ConfigSetting other) { other.Changed += ConfigChangedHandler; }
public abstract bool IsSettingSupported(ConfigSetting setting);
protected void OnSettingChanged(ConfigSetting sender) { SettingChanged(); }
/// <summary> /// Returns the information if the specified <paramref name="setting"/> is supported by this /// configuration plugin. /// </summary> /// <param name="setting">The setting to check.</param> /// <returns><c>true</c>, if the setting is supported, i.e. it can be displayed in the GUI, else /// <c>false</c>.</returns> protected bool IsSettingSupported(ConfigSetting setting) { ConfigurationController controller = FindConfigurationController(setting); return controller != null && controller.IsSettingSupported(setting); }
/// <summary> /// Returns the configuration controller class which is responsible for the specified /// <paramref name="setting"/>. /// </summary> /// <param name="setting">The setting to check.</param> /// <returns>Configuration controller class which is responsible for the specified /// <paramref name="setting"/>, or <c>null</c>, if the setting is not supported.</returns> protected ConfigurationController FindConfigurationController(ConfigSetting setting) { if (setting == null) return null; ConfigurationController result = null; // Check if a custom configuration controller is requested ConfigSettingMetadata metadata = (ConfigSettingMetadata) setting.Metadata; if (metadata.AdditionalTypes != null && metadata.AdditionalTypes.ContainsKey("CustomConfigController")) { Type controllerType = metadata.AdditionalTypes["CustomConfigController"]; if (controllerType == null) { ServiceRegistration.Get<ILogger>().Warn( "ConfigurationModel: Custom configuration controller could not be loaded (config setting at location '{0}')", metadata.Location); return null; } // Check if we already have the required controller available foreach (KeyValuePair<Type, ConfigurationController> registration in _registeredSettingTypes) if (registration.Value.GetType() == controllerType) { result = registration.Value; break; } if (result == null) { // FIXME Albert: Make configuration controllers to models; load them via the workflow manager. // This will make configuration controllers be managed correctly result = Activator.CreateInstance(controllerType) as ConfigurationController; if (result != null) // Lazily add the new controller type to our registered controllers Register(result); } if (result != null) return result; } // Check if the workflow configuration controller can handle the setting if (_workflowConfigurationController.IsSettingSupported(setting)) return _workflowConfigurationController; // Else try a default configuration controller return FindConfigurationController(setting.GetType()); }
public override bool IsSettingSupported(ConfigSetting setting) { return setting != null && setting is SkinConfigSetting; }
public override bool IsSettingSupported(ConfigSetting setting) { return setting == null ? false : setting is ThemeConfigSetting; }
public override bool IsSettingSupported(ConfigSetting setting) { return setting != null && setting is PathEntry; }
public override bool IsSettingSupported(ConfigSetting setting) { return setting != null && !string.IsNullOrEmpty(DialogScreen); }