Example #1
0
 protected virtual void OnStateChanging(IState state)
 {
     if (StateChanging != null)
     {
         StateChanging.Invoke(this, new StateEventArgs(state));
     }
 }
Example #2
0
 public void TransitionTo(TimeState state)
 {
     StateChanging.Invoke(this, new TimeChangedEventArgs(LeftTime, state));
     State = state;
     State.SetContext(this);
     StateChanged.Invoke(this, new TimeChangedEventArgs(LeftTime, state));
 }
Example #3
0
 protected override void OnStateChanged(TaskState oldValue, TaskState newValue)
 {
     TaskDebug.Verbose($"TA: Task[{Label}] State Changing: {oldValue} -> {newValue}");
     StateChanging?.Invoke(this, new PropertyUpdateEventArgs <TaskState>(nameof(ITask.State), oldValue, newValue));
     TaskDebug.Verbose($"TA: Task[{Label}] State Changed: {oldValue} -> {newValue}");
     base.OnStateChanged(oldValue, newValue);
 }
Example #4
0
        /// <summary>
        /// Switches the state.
        /// </summary>
        /// <param name="nextState">Then next state.</param>
        protected virtual void SwitchState(State nextState)
        {
            StateChanging?.Invoke();
            currentState?.OnExit(nextState);

            currentState = nextState;

            currentState?.OnEnter();
            StateChanged?.Invoke();
        }
Example #5
0
        private void SetIsStateChanging(bool isStartedStateChange)
        {
            if (IsStateChanging == isStartedStateChange)
            {
                return;
            }

            IsStateChanging = isStartedStateChange;
            if (isStartedStateChange)
            {
                StateChanging?.Invoke();
            }
            else
            {
                StateChanged?.Invoke();
            }
        }
Example #6
0
 /// <summary>
 /// Abandon all the operations of the transaction instead of saving them.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Abort()
 {
     State = LightningTransactionState.Aborted;
     StateChanging?.Invoke(State);
     Lmdb.mdb_txn_abort(_handle);
 }
Example #7
0
 /// <summary>
 /// Commit all the operations of a transaction into the database.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public void Commit()
 {
     State = LightningTransactionState.Commited;
     StateChanging?.Invoke(State);
     Lmdb.mdb_txn_commit(_handle);
 }
Example #8
0
 /// <summary>
 /// Raises the <see cref="E:StateChanging" /> event.
 /// </summary>
 /// <param name="e">The <see cref="StateChangingEventArgs{TState}" /> instance containing the event data.</param>
 protected void OnStateChanging(StateChangingEventArgs <TState> e)
 {
     StateChanging?.Invoke(this, e);
 }
Example #9
0
 //---------------------------------------------------------------------
 private void _onStateChanging(T oldState, T newState)
 {
     StateChanging?.Invoke(this, new StateEventArgs <T>(oldState, newState));
 }
 /// <summary>
 /// Commit all the operations of a transaction into the database.
 /// All cursors opened within the transaction will be closed by this call.
 /// The cursors and transaction handle will be freed and must not be used again after this call.
 /// </summary>
 public MDBResultCode Commit()
 {
     State = LightningTransactionState.Commited;
     StateChanging?.Invoke(State);
     return(mdb_txn_commit(_handle));
 }
Example #11
0
 private void _stateMachineOnStateChanging(object sender, StateEventArgs <ConnectorState> e)
 {
     StateChanging?.Invoke(this, e);
 }
Example #12
0
 protected virtual void OnStateChanging(object sender, PortState e)
 {
     StateChanging?.Invoke(sender, e);
 }
Example #13
0
 protected virtual void EndedPrint() => StateChanging?.Invoke(this, new PrinterEventArgs(this, "Ended"));