コード例 #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);
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: vishalishere/Warden
        /// <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);
        }
コード例 #3
0
ファイル: ProcessWatcher.cs プロジェクト: serbrech/Warden
        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;
        }
コード例 #4
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>
 /// <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);
コード例 #5
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>
 /// <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);
コード例 #6
0
 protected Configurator(ProcessWatcherConfiguration configuration) : base(configuration)
 {
 }
コード例 #7
0
 protected Configurator(string name, string machineName)
 {
     Configuration = new ProcessWatcherConfiguration(name, machineName);
 }
コード例 #8
0
 public Default(ProcessWatcherConfiguration configuration) : base(configuration)
 {
     SetInstance(this);
 }
コード例 #9
0
ファイル: ProcessWatcher.cs プロジェクト: serbrech/Warden
 /// <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);
コード例 #10
0
ファイル: ProcessWatcher.cs プロジェクト: serbrech/Warden
 /// <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);