/// <summary>
        ///   Initializes a new instance of the <see cref="MainWindow" /> class.
        /// </summary>
        public MainWindow()
        {
            this.NewCommand = new RelayCommand(this.ExecuteNew);
            this.LoadCommand = new RelayCommand(this.ExecuteLoad, this.CanExecuteLoad);
            this.OpenCommand = new RelayCommand(this.ExecuteOpen);
            this.ClearCommand = new RelayCommand(this.ExecuteClear, this.CanExecuteClear);
            this.UnloadCommand = new RelayCommand(this.ExecuteUnload, this.CanExecuteUnload);
            this.TriggerCommand = new RelayCommand<StateTrigger>(this.ExecuteTrigger, this.CanExecuteTrigger);

            this.Loaded += this.MainWindowLoaded;
            this.TrackingBuilder = new StringBuilder();
            var textListener = new TextListener(this);

            // Trace.Listeners.Add(textListener);
            Trace.Listeners.Add(textListener);
            WorkflowTrace.Source.Listeners.Add(textListener);

            this.model = new WorkflowModel(this);
            this.Closing += this.ViewClosing;
            this.Closed += this.ViewClosed;

            this.InitializeComponent();
        }
 /// <summary>
 ///   Initializes a new instance of the <see cref="WorkflowInstance" /> class.
 /// </summary>
 /// <param name="model"> The view. </param>
 /// <param name="stateTracker"> The StateTracker (optional) </param>
 public WorkflowInstance(WorkflowModel model, StateTracker stateTracker = null)
 {
     this.model = model;
     this.StateTracker = stateTracker ?? new StateTracker();
 }