/// <summary> /// Setzt den internen Zustand der Konfiguration zurück. /// </summary> /// <param name="site">Die zugehörige Arbeitsumgebung.</param> public void Reset(Control site) { // Get rid of timer et al Dispose(); // Report if (NumberLogger.Enabled) { if (m_Composer != null) { Trace.TraceInformation(Properties.Resources.Trace_Number_Off); } } // Back to initial state m_Current = m_States[InitialStateIdentifier]; m_Composer = null; m_Site = site; // Reinstall timer if (m_Site != null) { // Check mode if (m_Site.InvokeRequired) { throw new NotSupportedException(Properties.Resources.Exception_WrongThread); } // Create m_Timer = new Timer { Interval = 100 }; // Attach handler m_Timer.Tick += OnTimer; // Start up m_Timer.Enabled = true; } // Fire var onState = OnNewState; if (onState != null) { onState(m_Current); } }
/// <summary> /// Setzt den internen Zustand der Konfiguration zurück. /// </summary> /// <param name="site">Die zugehörige Arbeitsumgebung.</param> public void Reset( Control site ) { // Get rid of timer et al Dispose(); // Report if (NumberLogger.Enabled) if (m_Composer != null) Trace.TraceInformation( Properties.Resources.Trace_Number_Off ); // Back to initial state m_Current = m_States[InitialStateIdentifier]; m_Composer = null; m_Site = site; // Reinstall timer if (m_Site != null) { // Check mode if (m_Site.InvokeRequired) throw new NotSupportedException( Properties.Resources.Exception_WrongThread ); // Create m_Timer = new Timer { Interval = 100 }; // Attach handler m_Timer.Tick += OnTimer; // Start up m_Timer.Enabled = true; } // 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); } }
/// <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 ); }