Ejemplo n.º 1
0
 protected virtual void OnStateChanging(IState state)
 {
     if (StateChanging != null)
     {
         StateChanging.Invoke(this, new StateEventArgs(state));
     }
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 5
0
        private void SetIsStateChanging(bool isStartedStateChange)
        {
            if (IsStateChanging == isStartedStateChange)
            {
                return;
            }

            IsStateChanging = isStartedStateChange;
            if (isStartedStateChange)
            {
                StateChanging?.Invoke();
            }
            else
            {
                StateChanged?.Invoke();
            }
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 9
0
 //---------------------------------------------------------------------
 private void _onStateChanging(T oldState, T newState)
 {
     StateChanging?.Invoke(this, new StateEventArgs <T>(oldState, newState));
 }
Ejemplo n.º 10
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 MDBResultCode Commit()
 {
     State = LightningTransactionState.Commited;
     StateChanging?.Invoke(State);
     return(mdb_txn_commit(_handle));
 }
Ejemplo n.º 11
0
 private void _stateMachineOnStateChanging(object sender, StateEventArgs <ConnectorState> e)
 {
     StateChanging?.Invoke(this, e);
 }
Ejemplo n.º 12
0
 protected virtual void OnStateChanging(object sender, PortState e)
 {
     StateChanging?.Invoke(sender, e);
 }
Ejemplo n.º 13
0
 protected virtual void EndedPrint() => StateChanging?.Invoke(this, new PrinterEventArgs(this, "Ended"));