private static void NewInstanceOnEventOccured(object o, ProcessHelperEvent e) { if (e.Type == ProcessHelperEventType.InstanceDisposed) { lock (ManagerSync) { // remove instances that are disposed from the manager automatically, we don't want to have anyone sending "Start" to a disposed instance var record = ProcessList.FirstOrDefault(x => ReferenceEquals(o, x.Value)); if (ProcessList.ContainsKey(record.Key)) { Log.Information($"removed process {record.Key} from manager after dispose"); TraceMessage(TraceLevel.Info, $"removed process {record.Key} from manager after dispose"); ProcessList.Remove(record.Key); } } } }
private void OnEventOccurred(ProcessHelperEvent args) { processEvents.Enqueue(args); EventOccured?.Invoke(this, args); }
private void CurrentProcessOnEventOccured(object sender, ProcessHelperEvent e) { Invoke(new Action(() => consoleOutputList.Items.Add(e))); consoleOutputList.SelectedIndex = consoleOutputList.Items.Count - 1; }