예제 #1
0
        public void NextStep(int optProg = -1)
        {
            StepChangeRequest?.Invoke(this, new EventArgs());

            int pFrom = CurrentIndex;

            if (optProg < 0 || optProg >= Current.Progressions.Count)       // Default Progression
            {
                CurrentIndex = Current.ProgressTo >= 0
                    ? Current.ProgressTo
                    : System.Math.Min(CurrentIndex + 1, Steps.Count - 1);
            }
            else                                                            // Optional Progression
            {
                CurrentIndex = Current.Progressions [optProg].DestinationIndex;
            }

            if (pFrom != CurrentIndex)                                      // If the actual step Index changed
            {
                Current.ProgressFrom = pFrom;
                CopyDeviceStatus(Steps [pFrom].Patient, Current.Patient);
                Steps [pFrom].Patient.Deactivate();                         // Additional unlinking of events and timers!
            }

            // Init step regardless of whether step Index changed; step may have been deactivated by StepChangeRequest()
            SetTimer();
            Current.Patient.Activate();

            // Trigger events for loading current Patient, and trigger propagation to devices
            StepChanged?.Invoke(this, new EventArgs());
            Current.Patient.OnPatientEvent(Patient.PatientEventTypes.Vitals_Change);
        }
예제 #2
0
        public void UnsubscribeEvents()
        {
            if (StepChangeRequest != null)
            {
                foreach (Delegate d in StepChangeRequest?.GetInvocationList())
                {
                    StepChangeRequest -= (EventHandler <EventArgs>)d;
                }
            }

            if (StepChanged != null)
            {
                foreach (Delegate d in StepChanged?.GetInvocationList())
                {
                    StepChanged -= (EventHandler <EventArgs>)d;
                }
            }
        }
예제 #3
0
        public void SetStep(int incIndex)
        {
            StepChangeRequest?.Invoke(this, new EventArgs());

            int pFrom = CurrentIndex;

            CurrentIndex = II.Math.Clamp(incIndex, 0, Steps.Count - 1);

            if (pFrom != CurrentIndex)                                      // If the actual step Index changed
            {
                CopyDeviceStatus(Steps [pFrom].Patient, Current.Patient);
                Steps [pFrom].Patient.Deactivate();                         // Additional unlinking of events and timers!
            }

            // Init step regardless of whether step Index changed; step may have been deactivated by StepChangeRequest()
            SetTimer();
            Current.Patient.Activate();

            // Trigger events for loading current Patient, and trigger propagation to devices
            StepChanged?.Invoke(this, new EventArgs());
            Current.Patient.OnPatientEvent(Patient.PatientEventTypes.Vitals_Change);
        }
예제 #4
0
        private object Execute(Actions.Action action, object data)
        {
            object ret = null;

            if (action.Skip)
            {
                return(null);
            }
            CurrentAction = action;
            var count = action.GetItemCount(this, data);
            var sea   = new StepEventArgs(action, count);

            for (int i = 0; i < count; i++)
            {
                sea.Index = i;
                Manager.UIThreadCall(() => StepChanged?.Invoke(this, sea));
                if (State == ContextState.Stop)
                {
                    return(null);
                }
                else if (State == ContextState.Pause)
                {
                    _continueEvent.WaitOne();
                }
                ret = action.Execute(this, i, data);
                if (ret is BreakValue)
                {
                    return(ret);
                }
                if (action is Actions.ParentAction pa && !(action is Actions.Window))
                {
                    ExecuteChildren(pa, ret);
                }
            }
            return(ret);
        }
예제 #5
0
 protected virtual void OnStepChanged(StepChangeEventArgs e)
 {
     StepChanged?.Invoke(this, e);
 }
예제 #6
0
 private void InvokeStep(int step)
 {
     _appSettings.OnboardingStep = step;
     StepChanged?.Invoke(this, step);
 }
예제 #7
0
        public void OnUserLoggedIn()
        {
            var step = _appSettings.OnboardingStep;

            StepChanged?.Invoke(this, step >= 0 ? step : 0);
        }
예제 #8
0
 public void Finish()
 {
     _appSettings.OnboardingStep = -1;
     StepChanged?.Invoke(this, 0);
 }
예제 #9
0
 /// <summary>
 /// Invoked whenever the current <see cref="Step"/> changes, to fire the <see cref="StepChanged"/> event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnStepChanged(EventArgs e)
 {
     StepChanged?.Invoke(this, EventArgs.Empty);
 }
예제 #10
0
 public void StepChange(EngineData.Step step)
 {
     Step = step;
     StepChanged?.Invoke(step.ToString().Replace("State_", ""));
 }
예제 #11
0
 /// <summary>
 /// Raises the FancyControls.Counter.ValueChanged event.
 /// </summary>
 /// <param name="e">
 /// A FancyControls.ValueEventArgs that contains the event data.
 /// </param>
 protected void OnStepChanged(ValueEventArgs <int> e)
 {
     StepChanged?.Invoke(this, e);
 }
예제 #12
0
 protected virtual void OnStepChanged(Step step)
 {
     StepChanged?.Invoke(this, step);
 }