Beispiel #1
0
        // Protected methods

        /// <summary>
        /// Raises the Transitioned event.
        /// </summary>
        protected virtual void OnTransitioned(TransitionedEventArgs eventArgs)
        {
            if (Transitioned != null)
            {
                Transitioned(this, eventArgs);
            }
        }
 /// <summary>
 /// This method is called when the wizard has changed state.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="eventArgs"></param>
 private void StateMachineOnTransitioned(object sender, TransitionedEventArgs eventArgs)
 {
     if (!InvokeRequired)
     {
         // Back button should only be available if there are states to go back to
         btnBack.Enabled = _sm.StateHistory.Length > 0;
         // The Next button is only available if its valid in the state machine configuration
         btnNext.Enabled = _sm.ValidTriggers.Contains(WizardTrigger.Next);
         // Cancel/Finish button also changes according to which triggers are valid
         if (_sm.ValidTriggers.Contains(WizardTrigger.Cancel))
         {
             btnCancel.Text = "Cancel";
             btnCancel.Enabled = true;
         }
         else if (_sm.ValidTriggers.Contains(WizardTrigger.Finish))
         {
             btnCancel.Text = "Finish";
             btnCancel.Enabled = true;
         }
         else
             btnCancel.Enabled = false;
     }
 }
        /// <summary>
        /// This method is called when the state machine has transitioned between states.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="eventArgs"></param>
        private void StateMachineOnTransitioned(object sender, TransitionedEventArgs eventArgs)
        {
            UpdateAvailableTriggers();

            UpdateStateLabel(eventArgs.TargetState);
        }