public EditorUIApplication(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;

            dispatcher = mainWindow.Dispatcher;

            Search = new SearchBindingProvider(this);

            NewFile = new GenericCommand((p) => ActionNewFile(p));

            OpenFile = new GenericCommand((p) => ActionOpenFile(p));

            SaveAsFile = new GenericCommand((p) => ActionSaveAsFile(p));
            SaveFile = new GenericCommand((p) => ActionSaveFile(p));

            Quit = new GenericCommand((p) => ActionQuit(p));

            About = new GenericCommand((p) => ActionAbout(p));

            LoadContextCommands();

            Builder.PropertyChanged += new PropertyChangedEventHandler(Builder_PropertyChanged);

            Build = new GenericCommand((p) => { Builder.ActionBuild(); }, (p) => Builder.CanBuild);
            Rebuild = new GenericCommand((p) => { Builder.ActionRebuildAll(); }, (p) => Builder.CanBuild);
            CancelBuild = new GenericCommand((p) => { Builder.ActionCancelBuild(); }, (p) => !Builder.CanBuild);

            OpenRecent = new GenericCommand(ActionOpenRecent);

            LoadApplicationSettings();

            Build_OutputCommands = new ObservableCollection<GenericCommand>();
            Build_OutputCommands.Add(new GenericCommand(Build_Action_CopySelection, (item) => SelectedBuildMessage != null) { DisplayName = "Copy Selection" });
            Build_OutputCommands.Add(new GenericCommand(Build_Action_CopyAll) { DisplayName = "Copy All" });
            Build_OutputCommands.Add(new GenericCommand(Build_Action_SaveAll) { DisplayName = "Save to file" });

            SelectedBuildMessage = new BuildMessage();
            Builder.BuildOutput.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(BuildOutput_CollectionChanged);
        }
 void BuildOutput_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
         case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
         case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
             {
                 SelectedBuildMessage = null;
                 break;
             }
     }
 }