List <CommandViewModel> CreateToolbarCommands()
        {
            var newProjectRelayCommand = DelegateCommandFactory.Create <object>(OnNewFileExecuted);
            var addNewItemRelayCommand = DelegateCommandFactory.Create <object>(OnNewFileExecuted);
            var openRelayCommand       = DelegateCommandFactory.Create <object>(OnNewFileExecuted);

            CommandViewModel newProject = new CommandViewModel("New Project", newProjectRelayCommand)
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/NewProject_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.N, ModifierKeys.Control | ModifierKeys.Shift)
            };
            CommandViewModel newFile = new CommandViewModel("Add New Item", addNewItemRelayCommand)
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/File_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.N, ModifierKeys.Control)
            };
            CommandViewModel openFile = new CommandViewModel("Open File", openRelayCommand)
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/OpenFile_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.O, ModifierKeys.Control)
            };

            CommandViewModel save = new CommandViewModel("Save")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/Save_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control)
            };
            CommandViewModel saveAll = new CommandViewModel("Save All")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/SaveAll_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control | ModifierKeys.Shift)
            };

            CommandViewModel cut = new CommandViewModel("Cut")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/Cut_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control | ModifierKeys.Shift)
            };
            CommandViewModel copy = new CommandViewModel("Copy")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/Copy_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control | ModifierKeys.Shift)
            };
            CommandViewModel paste = new CommandViewModel("Paste")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/Paste_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control | ModifierKeys.Shift)
            };

            CommandViewModel undo = new CommandViewModel("Undo")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/Undo_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control | ModifierKeys.Shift)
            };
            CommandViewModel redo = new CommandViewModel("Redo")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/Redo_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control | ModifierKeys.Shift)
            };

            return(new List <CommandViewModel>()
            {
                newProject, newFile, openFile, save, saveAll, GetSeparator(), cut, copy, paste, GetSeparator(), undo, redo
            });
        }
        List <CommandViewModel> CreateCommands()
        {
            List <CommandViewModel> fileCommands = CreateFileCommands();
            List <CommandViewModel> viewCommands = CreateViewCommands();
            var file = new CommandViewModel("File", fileCommands);
            var view = new CommandViewModel("View", viewCommands);

            return(new List <CommandViewModel> {
                file, view
            });
        }
        protected virtual List <CommandViewModel> CreateFileCommands()
        {
            var openDocumentRelayCommand  = DelegateCommandFactory.Create <object>(OnOpenDocument);
            CommandViewModel openDocument = new CommandViewModel("Open...", openDocumentRelayCommand)
            {
                Glyph = GlyphHelper.GetGlyph("/Images/Open_16x16.png"), IsEnabled = true
            };

            return(new List <CommandViewModel>()
            {
                openDocument
            });
        }
        protected virtual List <CommandViewModel> CreateViewCommands()
        {
            var showToolboxPanelRelayCommand          = DelegateCommandFactory.Create <object>(OnShowToolboxPanel);
            var showSolutionExplorerPanelRelayCommand = DelegateCommandFactory.Create <object>(OnShowSolutionExplorerPanel);
            var showPropertiesPanelRelayCommand       = DelegateCommandFactory.Create <object>(OnShowPropertiesPanel);
            var showErrorListPanelRelayCommand        = DelegateCommandFactory.Create <object>(OnShowErrorListPanel);
            var showOutputPanelRelayCommand           = DelegateCommandFactory.Create <object>(OnShowOutputPanel);
            var showSearchResultsPanelRelayCommand    = DelegateCommandFactory.Create <object>(OnShowSearchResultsPanel);
            CommandViewModel toolbox          = new CommandViewModel(_ToolboxViewModel, showToolboxPanelRelayCommand);
            CommandViewModel solutionExplorer = new CommandViewModel(_SolutionExplorerViewModel, showSolutionExplorerPanelRelayCommand);
            CommandViewModel properties       = new CommandViewModel(_PropertiesViewModel, showPropertiesPanelRelayCommand);
            CommandViewModel errorList        = new CommandViewModel(_ErrorListViewModel, showErrorListPanelRelayCommand);
            CommandViewModel output           = new CommandViewModel(_OutputViewModel, showOutputPanelRelayCommand);
            CommandViewModel searchResults    = new CommandViewModel(_SearchResultsViewModel, showSearchResultsPanelRelayCommand);

            return(new List <CommandViewModel>()
            {
                toolbox, solutionExplorer, properties, errorList, output, searchResults
            });
        }
예제 #5
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            CommandViewModel commandViewModel = item as CommandViewModel;

            if (commandViewModel != null)
            {
                DataTemplate template = null;
                if (commandViewModel.Owner != null)
                {
                    template = BarCheckItemTemplate;
                }
                if (commandViewModel.IsSubItem)
                {
                    template = BarSubItemTemplate;
                }
                if (commandViewModel.IsSeparator)
                {
                    template = BarItemSeparatorTemplate;
                }
                return(template == null ? BarItemTemplate : template);
            }
            return(base.SelectTemplate(item, container));
        }
        protected override List <CommandViewModel> CreateFileCommands()
        {
            var projectRelayCommand   = DelegateCommandFactory.Create <object>(OnNewFileExecuted);
            var fileRelayCommand      = DelegateCommandFactory.Create <object>(OnNewFileExecuted);
            var fileOpenRelayCommand  = DelegateCommandFactory.Create <object>(OnNewFileExecuted);
            var closeFileRelayCommand = DelegateCommandFactory.Create <object>(OnCloseFileExecuted);

            CommandViewModel newCommand = new CommandViewModel("New")
            {
                IsSubItem = true
            };
            CommandViewModel newProject = new CommandViewModel("Project...", projectRelayCommand)
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/NewProject_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.N, ModifierKeys.Control | ModifierKeys.Shift)
            };
            CommandViewModel newFile = new CommandViewModel("File...", fileRelayCommand)
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/File_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.N, ModifierKeys.Control)
            };

            newCommand.Commands = new List <CommandViewModel>()
            {
                newProject, newFile
            };

            CommandViewModel openCommand = new CommandViewModel("Open")
            {
                IsSubItem = true,
            };
            CommandViewModel openProject = new CommandViewModel("Project/Solution...")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/OpenSolution_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.O, ModifierKeys.Control | ModifierKeys.Shift), IsEnabled = false
            };
            CommandViewModel openFile = new CommandViewModel("File...", fileOpenRelayCommand)
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/OpenFile_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.O, ModifierKeys.Control)
            };

            openCommand.Commands = new List <CommandViewModel>()
            {
                openProject, openFile
            };

            CommandViewModel closeFile     = new CommandViewModel("Close", closeFileRelayCommand);
            CommandViewModel closeSolution = new CommandViewModel("Close Solution")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/CloseSolution_16x16.png")
            };
            CommandViewModel save = new CommandViewModel("Save")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/Save_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control)
            };
            CommandViewModel saveAll = new CommandViewModel("Save All")
            {
                Glyph = GlyphHelper.GetGlyph("/Images/VS2010Docking/SaveAll_16x16.png"), KeyGesture = KeyGestureHelper.GetKeyGesure(Key.S, ModifierKeys.Control | ModifierKeys.Shift)
            };

            CommandViewModel recentFilesCommand = new CommandViewModel("Recent files")
            {
                IsSubItem = true,
            };
            CommandViewModel recentProjectsCommand = new CommandViewModel("Recent projects and solutions")
            {
                IsSubItem = true,
            };

            return(new List <CommandViewModel>()
            {
                newCommand, openCommand, GetSeparator(), closeFile, closeSolution, GetSeparator(), save,
                saveAll, GetSeparator(), recentFilesCommand, recentProjectsCommand
            });
        }