Exemplo n.º 1
0
 internal void Appand(StepNotificationState notificationStateItem)
 {
     lock (_statesLog)
     {
         _statesLog.Add(notificationStateItem);
     }
 }
Exemplo n.º 2
0
        public void WaitForStepNotificationStateChangesComplete()
        {
            StepNotificationState endDummyStepNotificationState = new StepNotificationState("EndProcessDummyStepNotificationState");

            _stepsNotificationStateChangedQueue.Add(endDummyStepNotificationState);
            _riseStepNotificationStateChangesTask.Wait();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 5
0
        internal void StartProcess(string processName, Action <ProcessTrace, StepNotificationState> onStepNotificationStateChanged)
        {
            ProcessTrace = new ProcessTrace();

            _onStepNotificationStateChanged = onStepNotificationStateChanged;

            _rootStepNotificationState = new StepNotificationState(processName);

            _stepsNotificationStateChangedQueue = new BlockingCollection <StepNotificationState>();

            RiseStepNotificationStateChanges();
        }
Exemplo n.º 6
0
        private void SaveNotificationStateSnapshot()
        {
            StepNotificationState snapshotNotificationState = _rootStepNotificationState.Clone();

            snapshotNotificationState.SnapshotTimeStemp = DateTime.Now;

            ProcessTrace.Appand(snapshotNotificationState);

            if (_stepsNotificationStateChangedQueue.IsCompleted)
            {
            }
            _stepsNotificationStateChangedQueue.Add(snapshotNotificationState);
        }