/// <summary> /// Extension method for adding the Process watcher to the the WardenConfiguration with the default name of Process Watcher. /// </summary> /// <param name="builder">Instance of the Warden configuration builder.</param> /// <param name="configuration">Configuration of ProcessWatcher.</param> /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param> /// <returns>Instance of fluent builder for the WardenConfiguration.</returns> public static WardenConfiguration.Builder AddProcessWatcher( this WardenConfiguration.Builder builder, ProcessWatcherConfiguration configuration, Action <WatcherHooksConfiguration.Builder> hooks = null) { builder.AddWatcher(ProcessWatcher.Create(configuration), hooks); return(builder); }
/// <summary> /// Extension method for adding the Process watcher to the the WardenConfiguration with the default name of Process Watcher. /// </summary> /// <param name="builder">Instance of the Warden configuration builder.</param> /// <param name="configuration">Configuration of ProcessWatcher.</param> /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param> /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param> /// <param name="group">Optional name of the group that ProcessWatcher belongs to.</param> /// <returns>Instance of fluent builder for the WardenConfiguration.</returns> public static WardenConfiguration.Builder AddProcessWatcher( this WardenConfiguration.Builder builder, ProcessWatcherConfiguration configuration, Action <WatcherHooksConfiguration.Builder> hooks = null, TimeSpan?interval = null, string group = null) { builder.AddWatcher(ProcessWatcher.Create(configuration, group), hooks, interval); return(builder); }
protected ProcessWatcher(string name, ProcessWatcherConfiguration configuration) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Watcher name can not be empty."); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration), "Process Watcher configuration has not been provided."); } Name = name; _configuration = configuration; }
/// <summary> /// Factory method for creating a new instance of ProcessWatcher with default name of Process Watcher. /// </summary> /// <param name="configuration">Configuration of ProcessWatcher.</param> /// <param name="group">Optional name of the group that ProcessWatcher belongs to.</param> /// <returns>Instance of ProcessWatcher.</returns> public static ProcessWatcher Create(ProcessWatcherConfiguration configuration, string group = null) => Create(DefaultName, configuration, group);
/// <summary> /// Factory method for creating a new instance of ProcessWatcher. /// </summary> /// <param name="name">Name of the ProcessWatcher.</param> /// <param name="configuration">Configuration of ProcessWatcher.</param> /// <param name="group">Optional name of the group that ProcessWatcher belongs to.</param> /// <returns>Instance of ProcessWatcher.</returns> public static ProcessWatcher Create(string name, ProcessWatcherConfiguration configuration, string group = null) => new ProcessWatcher(name, configuration, group);
protected Configurator(ProcessWatcherConfiguration configuration) : base(configuration) { }
protected Configurator(string name, string machineName) { Configuration = new ProcessWatcherConfiguration(name, machineName); }
public Default(ProcessWatcherConfiguration configuration) : base(configuration) { SetInstance(this); }
/// <summary> /// Factory method for creating a new instance of ProcessWatcher. /// </summary> /// <param name="name">Name of the ProcessWatcher.</param> /// <param name="configuration">Configuration of ProcessWatcher.</param> /// <returns>Instance of ProcessWatcher.</returns> public static ProcessWatcher Create(string name, ProcessWatcherConfiguration configuration) => new ProcessWatcher(name, configuration);
/// <summary> /// Factory method for creating a new instance of ProcessWatcher with default name of Process Watcher. /// </summary> /// <param name="configuration">Configuration of ProcessWatcher.</param> /// <returns>Instance of ProcessWatcher.</returns> public static ProcessWatcher Create(ProcessWatcherConfiguration configuration) => Create(DefaultName, configuration);