private void parameterizedRun(object obj) { double value = 0.0; ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(value, "Parameterized thread started with parameter : " + obj.ToString(), Colors.Green)); while (value <= 100) { value += 1; Thread.Sleep(100); ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(value, "Parameterized thread running with parameter : " + obj.ToString(), Colors.YellowGreen)); } ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(value, "Parameterized thread ended", Colors.Green)); }
private void parameterlessRun() { try { double value = 0.0; ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(value, "Parameterless thread started", Colors.DarkGray)); while (value <= 100) { value += 1; Thread.Sleep(100); ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(value, "Parameterless thread running", Colors.Orange)); } ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(value, "Parameterless thread ended", Colors.Green)); } catch (Exception ex) { Thread.ResetAbort(); } }
internal void ParameterlessThreadInterrupt() { _parameterlessThread.Interrupt(); ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(0, "Parameterless thread interrupt successful from ThreadExecuter", Colors.Yellow)); }
internal void ParameterlessThreadAbort() { _parameterlessThread.Abort(); //_parameterlessThread.Join(); ThreadProgressReportEvent?.Invoke(this, new ThreadProgressReportEventArgs(0, "Parameterless thread abort successful from ThreadExecuter", Colors.Red)); }