internal void Appand(StepNotificationState notificationStateItem) { lock (_statesLog) { _statesLog.Add(notificationStateItem); } }
public void WaitForStepNotificationStateChangesComplete() { StepNotificationState endDummyStepNotificationState = new StepNotificationState("EndProcessDummyStepNotificationState"); _stepsNotificationStateChangedQueue.Add(endDummyStepNotificationState); _riseStepNotificationStateChangesTask.Wait(); }
private void RiseStepNotificationStateChanges() { _riseStepNotificationStateChangesTask = Task.Run(() => { try { while (true) { StepNotificationState snapshotNotificationState = _stepsNotificationStateChangedQueue.Take(); if (snapshotNotificationState.StepName != "EndProcessDummyStepNotificationState") { try { _onStepNotificationStateChanged?.Invoke(ProcessTrace, snapshotNotificationState); } catch (Exception ex) { StepError("OnStepNotificationStateChanged", ex.ToString(), "Error occured on your OnStepNotificationStateChanged callback method", NotificationErrorType.Error); } } else { break; } } } catch (Exception ex) { Console.WriteLine($"ProcessTraceHandler.RiseStepNotificationStateChanges() >>> {ex}"); } }); }
public StepNotificationState Clone() { StepNotificationState outItem = MemberwiseClone() as StepNotificationState; if (InternalStepNotificationState != null) { outItem.InternalStepNotificationState = InternalStepNotificationState.Clone(); } return(outItem); }
internal void StartProcess(string processName, Action <ProcessTrace, StepNotificationState> onStepNotificationStateChanged) { ProcessTrace = new ProcessTrace(); _onStepNotificationStateChanged = onStepNotificationStateChanged; _rootStepNotificationState = new StepNotificationState(processName); _stepsNotificationStateChangedQueue = new BlockingCollection <StepNotificationState>(); RiseStepNotificationStateChanges(); }
private void SaveNotificationStateSnapshot() { StepNotificationState snapshotNotificationState = _rootStepNotificationState.Clone(); snapshotNotificationState.SnapshotTimeStemp = DateTime.Now; ProcessTrace.Appand(snapshotNotificationState); if (_stepsNotificationStateChangedQueue.IsCompleted) { } _stepsNotificationStateChangedQueue.Add(snapshotNotificationState); }