/// <summary>
 /// Handles process started event.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">Event data.</param>
 /// <exception cref="ArgumentNullException">e is null.</exception>
 protected virtual void OnProcessStarted(object sender,
     ControllerProcessStartedEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e",
                                         Resources.ArgumentNullException);
     }
     if (e.LogEvent)
     {
         _logger.Log(_formatter.Format(e));
     }
 }
Example #2
0
 /// <summary>
 /// Formats message.
 /// </summary>
 /// <param name="controllerProcessStartedEventArgs">Message.</param>
 /// <returns>Formatted message.</returns>
 /// <exception cref="ArgumentNullException">processStartedEventArgs is null.</exception>
 public string Format(ControllerProcessStartedEventArgs controllerProcessStartedEventArgs)
 {
     if (controllerProcessStartedEventArgs == null)
     {
         throw new ArgumentNullException("controllerProcessStartedEventArgs",
                                         Resources.ArgumentNullException);
     }
     return String.Format(CultureInfo.CurrentCulture,
                          @Resources.MessageProcessStarted,
                          @DateTime.Now,
                          @Resources.MessageTypeInfo,
                          @controllerProcessStartedEventArgs.DaemonName,
                          @controllerProcessStartedEventArgs.FileName,
                          @controllerProcessStartedEventArgs.ProcessId,
                          @controllerProcessStartedEventArgs.Arguments,
                          @controllerProcessStartedEventArgs.Verb,
                          @controllerProcessStartedEventArgs.QueuedProcesses.ToString(NumberFormatInfo.InvariantInfo));
 }
Example #3
0
        /// <summary>
        /// Handles process started event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event data.</param>
        /// <exception cref="ArgumentNullException">e is null.</exception>
        protected override void OnProcessStarted(object sender,
            ControllerProcessStartedEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e",
                                                Resources.ArgumentNullException);
            }

            base.OnProcessStarted(sender, e);
            UpdateRunningProcesses();
            UpdateProcessesToRun(e.QueuedProcesses);
        }
 /// <summary>
 /// Handles process started event.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">Event data.</param>
 private void OnProcessStarted(object sender,
                               ProcessStartedEventArgs e)
 {
     // Run threaded event in main thread.
     _synchronizationContext.Send(new SendOrPostCallback(delegate
     {
         EventHandler<ControllerProcessStartedEventArgs> handler = ProcessStarted;
         if (handler != null)
         {
             ControllerProcessStartedEventArgs controllerProcessStartedEventArgs =
                 new ControllerProcessStartedEventArgs(e.DaemonName,
                                                       e.ProcessId,
                                                       e.FileName,
                                                       e.Arguments,
                                                       e.Verb,
                                                       e.ProcessStartTime,
                                                       e.LogEvent,
                                                       GetProcessQueueCount());
             handler(this, controllerProcessStartedEventArgs);
         }
     }), null);
 }