/// <summary> /// Handle default behavior of event "IterationInitialized" /// </summary> /// <param name="sender">Object that raised the event</param> /// <param name="e">Arguments of event</param> private void OnIterationInitialized(object sender, MeasuringEventRaisedEventArgs e) { //Compongo il messaggio da mandare in uscita sulla console string feedback = $"[{e.Data.StartDate.ToString("yyyy/MM/dd HH:mm:ss")}] Iteration {e.Data.IterationNumber}/{e.Data.TotalIterations} initialized...\r\n"; //Emetto il messaggio sulla console applicativa if (IsConsoleFeedbackEnabled) { ConsoleUtils.WriteColorLine(ConsoleColor.Green, feedback); } //Se è abilitato il log su file di testo if (IsLogFeedbackEnabled) { File.AppendAllText(LogFilePath, feedback); } }
/// <summary> /// Handle default behavior of event "TracingCompleted" /// </summary> /// <param name="sender">Object that raised the event</param> /// <param name="e">Arguments of event</param> private void OnTracingCompleted(object sender, MeasuringEventRaisedEventArgs e) { //Aggiungo il pacchetto alla lista TracingMeasures.Add(e.Data); //Compongo il messaggio da mandare in uscita sulla console string feedback = $"[{e.Data.StartDate.ToString("yyyy/MM/dd HH:mm:ss")}] Tracing of '{e.Data.Message}' completed.\n" + $"Duration : {e.Data.Duration}. Sleeping for {DelayBetweenIterations}...\r\n"; //Emetto il messaggio sulla console applicativa if (IsConsoleFeedbackEnabled) { ConsoleUtils.WriteColorLine(ConsoleColor.Yellow, feedback); } //Se è abilitato il log su file di testo if (IsLogFeedbackEnabled) { File.AppendAllText(LogFilePath, feedback); } }