Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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);
Ejemplo n.º 6
0
 protected Configurator(ProcessWatcherConfiguration configuration) : base(configuration)
 {
 }
Ejemplo n.º 7
0
 protected Configurator(string name, string machineName)
 {
     Configuration = new ProcessWatcherConfiguration(name, machineName);
 }
Ejemplo n.º 8
0
 public Default(ProcessWatcherConfiguration configuration) : base(configuration)
 {
     SetInstance(this);
 }
Ejemplo n.º 9
0
 /// <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);
Ejemplo n.º 10
0
 /// <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);