/// <summary> /// Führt die Aktionen einer Eingabe aus. /// </summary> /// <param name="list">Die Liste der Aktionen.</param> /// <exception cref="ArgumentNullException">Es wurde keine Liste angegeben.</exception> internal void Execute(KeyActionList list) { // Validate if (list == null) { throw new ArgumentNullException("list"); } // Report if (TransitionConfiguration.KeyLogger.Enabled) { Trace.TraceInformation(Properties.Resources.Trace_LogInput_ActionList, list); } // Process the list foreach (var action in list.Actions) { if (!CallAction(action)) { // Report if (TransitionConfiguration.KeyLogger.Enabled) { Trace.TraceInformation(Properties.Resources.Trace_LogInput_Aborted, action); } // Done return; } } // Did it if (string.IsNullOrEmpty(list.NextState)) { return; } // Report if (TransitionConfiguration.KeyLogger.Enabled) { Trace.TraceInformation(Properties.Resources.Trace_LogInput_LeaveState, m_Current); } // Process leave action if (!string.IsNullOrEmpty(m_Current.ExitAction)) { if (!CallAction(m_Current.ExitAction)) { // Report if (TransitionConfiguration.KeyLogger.Enabled) { Trace.TraceInformation(Properties.Resources.Trace_LogInput_Aborted, m_Current.ExitAction); } // Done return; } } // Find next state TransitionState nextState; if (!m_States.TryGetValue(list.NextState, out nextState)) { throw new ArgumentException(string.Format("{0} {1}", list, list.NextState), "NextState"); } // Report if (TransitionConfiguration.KeyLogger.Enabled) { Trace.TraceInformation(Properties.Resources.Trace_LogInput_EnterState, nextState); } // Process enter action if (!string.IsNullOrEmpty(nextState.EnterAction)) { if (!CallAction(nextState.EnterAction)) { // Report if (TransitionConfiguration.KeyLogger.Enabled) { Trace.TraceInformation(Properties.Resources.Trace_LogInput_Aborted, nextState.EnterAction); } // Re-enter current state if (!string.IsNullOrEmpty(m_Current.EnterAction)) { CallAction(m_Current.EnterAction); } // Done return; } } // Activate it m_Current = nextState; // Fire var onState = OnNewState; if (onState != null) { onState(m_Current); } }
/// <summary> /// Führt die Aktionen einer Eingabe aus. /// </summary> /// <param name="list">Die Liste der Aktionen.</param> /// <exception cref="ArgumentNullException">Es wurde keine Liste angegeben.</exception> internal void Execute( KeyActionList list ) { // Validate if (list == null) throw new ArgumentNullException( "list" ); // Report if (TransitionConfiguration.KeyLogger.Enabled) Trace.TraceInformation( Properties.Resources.Trace_LogInput_ActionList, list ); // Process the list foreach (var action in list.Actions) if (!CallAction( action )) { // Report if (TransitionConfiguration.KeyLogger.Enabled) Trace.TraceInformation( Properties.Resources.Trace_LogInput_Aborted, action ); // Done return; } // Did it if (string.IsNullOrEmpty( list.NextState )) return; // Report if (TransitionConfiguration.KeyLogger.Enabled) Trace.TraceInformation( Properties.Resources.Trace_LogInput_LeaveState, m_Current ); // Process leave action if (!string.IsNullOrEmpty( m_Current.ExitAction )) if (!CallAction( m_Current.ExitAction )) { // Report if (TransitionConfiguration.KeyLogger.Enabled) Trace.TraceInformation( Properties.Resources.Trace_LogInput_Aborted, m_Current.ExitAction ); // Done return; } // Find next state TransitionState nextState; if (!m_States.TryGetValue( list.NextState, out nextState )) throw new ArgumentException( string.Format( "{0} {1}", list, list.NextState ), "NextState" ); // Report if (TransitionConfiguration.KeyLogger.Enabled) Trace.TraceInformation( Properties.Resources.Trace_LogInput_EnterState, nextState ); // Process enter action if (!string.IsNullOrEmpty( nextState.EnterAction )) if (!CallAction( nextState.EnterAction )) { // Report if (TransitionConfiguration.KeyLogger.Enabled) Trace.TraceInformation( Properties.Resources.Trace_LogInput_Aborted, nextState.EnterAction ); // Re-enter current state if (!string.IsNullOrEmpty( m_Current.EnterAction )) CallAction( m_Current.EnterAction ); // Done return; } // Activate it m_Current = nextState; // Fire var onState = OnNewState; if (onState != null) onState( m_Current ); }