/// <summary> /// Функция для создания контекстного меню /// </summary> /// <param name="sol"></param> /// <returns></returns> protected static ContextMenu CreateContextMenu(ProjectElement elem, ProjectExplorerControl control) { ContextMenu res = new ContextMenu(); MenuItem itemRename = new MenuItem(); itemRename.Header = "Rename"; itemRename.Click += new System.Windows.RoutedEventHandler(elem.itemRename_Click); res.Items.Add(itemRename); MenuItem itemRemove = new MenuItem(); itemRemove.Header = "Remove"; itemRemove.Command = control.CommandRemove; itemRemove.CommandBindings.Add(control.BindingRemoveCommand); res.Items.Add(itemRemove); MenuItem itemPaste = new MenuItem(); itemPaste.Header = "Paste"; itemPaste.Icon = CreateImageByPath("/HDL_Light;component/Images/Paste.png"); itemPaste.Command = control.CommandPaste; itemPaste.CommandBindings.Add(control.BindingPasteCommand); res.Items.Add(itemPaste); MenuItem itemСut = new MenuItem(); itemСut.Header = "Cut"; itemСut.Icon = CreateImageByPath("/HDL_Light;component/Images/Cut.png"); itemСut.Command = control.CommandCut; itemСut.CommandBindings.Add(control.BindingCutCommand); res.Items.Add(itemСut); MenuItem itemCopy = new MenuItem(); itemCopy.Header = "Copy"; itemCopy.Icon = CreateImageByPath("/HDL_Light;component/Images/Copy.png");; itemCopy.Command = control.CommandCopy; itemCopy.CommandBindings.Add(control.BindingCopyCommand); res.Items.Add(itemCopy); MenuItem itemOpenFolderInExplorer = new MenuItem(); itemOpenFolderInExplorer.Header = "Open Folder In Explorer"; itemOpenFolderInExplorer.Click += new System.Windows.RoutedEventHandler(elem.itemOpenFolderInExplorer_Click); res.Items.Add(itemOpenFolderInExplorer); return(res); }
/// <summary> /// Функция для создания контекстного меню /// </summary> /// <param name="sol"></param> /// <returns></returns> private static ContextMenu CreateContextMenu(Solution sol, ProjectExplorerControl control) { ContextMenu res = new ContextMenu(); MenuItem itemNew = new MenuItem(); itemNew.Header = "New"; res.Items.Add(itemNew); MenuItem itemNewSolutionFolder = new MenuItem(); itemNewSolutionFolder.Header = "New Solution Folder"; itemNewSolutionFolder.Click += new System.Windows.RoutedEventHandler(sol.itemNewSolutionFolder_Click); itemNew.Items.Add(itemNewSolutionFolder); MenuItem itemNewProject = new MenuItem(); itemNewProject.Header = "New Project"; itemNewProject.Click += new System.Windows.RoutedEventHandler(sol.itemNewProject_Click); itemNew.Items.Add(itemNewProject); MenuItem itemAddExistingProject = new MenuItem(); itemAddExistingProject.Header = "Add Existing Project"; itemAddExistingProject.Click += new System.Windows.RoutedEventHandler(sol.itemAddExistingProject_Click); res.Items.Add(itemAddExistingProject); MenuItem itemRename = new MenuItem(); itemRename.Header = "Rename"; itemRename.Click += new System.Windows.RoutedEventHandler(sol.itemRename_Click); res.Items.Add(itemRename); MenuItem itemPaste = new MenuItem(); itemPaste.Header = "Paste"; itemPaste.Icon = CreateImageByPath("/HDL_Light;component/Images/Paste.png"); itemPaste.Command = control.CommandPaste; itemPaste.CommandBindings.Add(control.BindingPasteCommand); res.Items.Add(itemPaste); MenuItem itemOpenFolderInExplorer = new MenuItem(); itemOpenFolderInExplorer.Header = "Open Folder In Explorer"; itemOpenFolderInExplorer.Click += new System.Windows.RoutedEventHandler(sol.itemOpenFolderInExplorer_Click); res.Items.Add(itemOpenFolderInExplorer); return(res); }
/// <summary> /// Контекстное меню /// </summary> public override ContextMenu CreateElementContextMenu(ProjectExplorerControl control) { return(CreateContextMenu(this, control)); }
/// <summary> /// Контекстное меню элемента /// </summary> public abstract ContextMenu CreateElementContextMenu(ProjectExplorerControl control);