private void CollectCommandItems(MergeableNodeCollection <ICommandItem> nodes) { if (nodes == null || nodes.Count == 0) { return; } // Recursively get all nodes (excluding separators). foreach (var node in nodes) { if (node.Content is CommandSeparator) { // Ignore } else if (node.Content is CommandGroup) { // Ignore } else { Debug.Assert(!CommandItems.Contains(node.Content), "Warning: Duplicate command items in toolbar."); CommandItems.Add(node.Content); } CollectCommandItems(node.Children); } }
public void CreateCommand(Command cmd) { if (cmd == null) { throw new ArgumentNullException(nameof(cmd)); } CommandItems.Add(cmd); }
private void AddCommandItems() { var testCommand = new DelegateCommand(OnTestItemExecute); CommandItems.Add(new DelegateCommandItem("Test", testCommand) { AlwaysShowText = false, Category = "Misc", InputGestures = new InputGestureCollection(new[] { new MultiKeyGesture(new[] { Key.A, Key.S }, ModifierKeys.Control) }), Icon = MultiColorGlyphs.SplitWindow, IsCheckable = true, IsChecked = false, Text = "Test Item", ToolTip = "This issues the Test command.", }); var visibilityCommand = new DelegateCommand(() => ((DelegateCommandItem)CommandItems[0]).IsVisible = !CommandItems[0].IsVisible); CommandItems.Add(new DelegateCommandItem("Visibility", visibilityCommand) { Category = "Misc", InputGestures = new InputGestureCollection(new[] { new KeyGesture(Key.V, ModifierKeys.Alt) }), IsCheckable = true, Text = "_Toggle Test Item Visibility", ToolTip = "Toggle Test Item Visibility", }); CommandItems.Add(new DelegateCommandItem("TestWindow", new DelegateCommand(OpenTestWindow)) { Text = "Test", ToolTip = "Show the test window", }); CommandItems.Add(new DelegateCommandItem("GC", new DelegateCommand(CollectGarbage)) { Text = "GC", ToolTip = "Full garbage collection", }); CommandItems.Add(new DelegateCommandItem("Throw", new DelegateCommand(Throw)) { Text = "Throw", ToolTip = "Throw an exception", }); CommandItems.Add(new DelegateCommandItem("Status1", new DelegateCommand(TestStatus1)) { Text = "Status #1", ToolTip = "Tests the status service.", }); CommandItems.Add(new DelegateCommandItem("Status2", new DelegateCommand(TestStatus2)) { Text = "Status #2", ToolTip = "Tests the status service.", }); }
private void AddCommands() { _quickFindCommandItem = new QuickFindCommandItem(this); CommandItems.Add( new RoutedCommandItem(ApplicationCommands.Find) { Category = CommandCategories.Search, Text = "Quick _find", ToolTip = "Go to Quick Find box.", }, _quickFindCommandItem, new DelegateCommandItem("FindAndReplace", new DelegateCommand(ShowFindAndReplace)) { Category = CommandCategories.Search, Icon = MultiColorGlyphs.Find, InputGestures = new InputGestureCollection { new KeyGesture(Key.F, ModifierKeys.Control | ModifierKeys.Shift) }, Text = "F_ind and replace...", ToolTip = "Show the Find and Replace window.", }, new DelegateCommandItem("FindPrevious", new DelegateCommand(FindPrevious, CanFind)) { Category = CommandCategories.Search, Icon = MultiColorGlyphs.FindPrevious, InputGestures = new InputGestureCollection { new KeyGesture(Key.F3, ModifierKeys.Shift) }, Text = "Find previous", ToolTip = "Jump to previous search result." }, new DelegateCommandItem("FindNext", new DelegateCommand(FindNext, CanFind)) { Category = CommandCategories.Search, Icon = MultiColorGlyphs.FindNext, InputGestures = new InputGestureCollection { new KeyGesture(Key.F3, ModifierKeys.None) }, Text = "_Find next", ToolTip = "Jump to next search result." }, new DelegateCommandItem("Replace", new DelegateCommand(Replace, CanFind)) { Category = CommandCategories.Search, Text = "_Replace", ToolTip = "Replace current search result." }, new DelegateCommandItem("ReplaceAll", new DelegateCommand(ReplaceAll, CanFind)) { Category = CommandCategories.Search, Text = "Replace _all", ToolTip = "Replace all search results." } ); }
private void AddCommands() { CommandItems.Add( new RoutedCommandItem(DockCommands.AutoHide) { Category = CommandCategories.Window, Text = "_Auto hide", ToolTip = "Move the current window to the auto-hide pane.", }, new RoutedCommandItem(DockCommands.Dock) { Category = CommandCategories.Window, Text = "_Dock", ToolTip = "Dock the current window.", }, new RoutedCommandItem(DockCommands.Float) { Category = CommandCategories.Window, Text = "_Float", ToolTip = "Undock the current window and move it into a floating window.", }, new RoutedCommandItem(ApplicationCommands.Close) { Category = CommandCategories.Window, Text = "_Close", ToolTip = "Close the current window.", }, new WindowLayoutItem(this), new DelegateCommandItem("SaveWindowLayout", new DelegateCommand(SavePreset, CanSavePreset)) { Category = CommandCategories.Window, Text = "_Save layout", ToolTip = "Save the current window layout." }, new DelegateCommandItem("SaveWindowLayoutAs", new DelegateCommand(SavePresetAs)) { Category = CommandCategories.Window, Text = "Save layout _as...", ToolTip = "Save the current window layout as a new preset." }, new DelegateCommandItem("ManageWindowLayouts", new DelegateCommand(ManageWindowLayouts)) { Category = CommandCategories.Window, Text = "_Manage layouts...", ToolTip = "Rename or delete the stored window layouts." }, new DelegateCommandItem("ResetWindowLayout", new DelegateCommand(ResetWindowLayout, CanResetWindowLayout)) { Category = CommandCategories.Window, Text = "_Reset layout", ToolTip = "Reset the active window layout." }); // Add input gestures to standard RoutedUICommands. ApplicationCommands.Close.InputGestures.Add(new KeyGesture(Key.W, ModifierKeys.Control)); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("QuickLaunch", new DelegateCommand(FocusQuickLaunchBox)) { Category = CommandCategories.Tools, InputGestures = new InputGestureCollection(new [] { new KeyGesture(Key.Q, ModifierKeys.Control) }), Text = "_Quick launch", ToolTip = "Go to the Quick Launch box." }); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("ColorPicker", new DelegateCommand(ShowColorPicker)) { Category = CommandCategories.View, Icon = MultiColorGlyphs.ColorPalette, Text = "_Color picker", ToolTip = "Show the Color Picker.", }); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("ShowOptions", new DelegateCommand(Show)) { Category = CommandCategories.Tools, Icon = MultiColorGlyphs.Options, Text = "_Options...", ToolTip = "Show a dialog where the application's options can be viewed and changed." }); }
private void AddCommands() { // Add items. CommandItems.Add( new DelegateCommandItem("ShowView3D", new DelegateCommand(ShowView3D)) { Category = "View", Text = "Show 3D View", ToolTip = "Show window with 3D view." }); }
/// <summary> /// Creates the command items of this extension. /// </summary> private void AddCommands() { // Add a command item that shows the About dialog. CommandItems.Add( new DelegateCommandItem("ShowAboutDialog", new DelegateCommand(Show)) { Category = CommandCategories.Help, Icon = MultiColorGlyphs.MessageInformation, Text = "_About...", ToolTip = "Show a dialog with information about this application." }); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("Output", new DelegateCommand(() => _output.Show())) { Category = "View", Icon = MultiColorGlyphs.Output, InputGestures = new InputGestureCollection { new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Alt) }, Text = "_Output", ToolTip = "Show the Output window.", }); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("Errors", new DelegateCommand(ShowErrors)) { Category = CommandCategories.View, Icon = MultiColorGlyphs.ErrorList, InputGestures = new InputGestureCollection { new KeyGesture(Key.E, ModifierKeys.Control | ModifierKeys.Alt) }, Text = "_Errors", ToolTip = "Show the Errors window.", }); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("Properties", new DelegateCommand(ShowProperties)) { Category = CommandCategories.View, Icon = MultiColorGlyphs.Properties, InputGestures = new InputGestureCollection { new KeyGesture(Key.F4) }, Text = "_Properties", ToolTip = "Show the Properties window.", }); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("Outline", new DelegateCommand(ShowOutline)) { Category = CommandCategories.View, Icon = MultiColorGlyphs.Outline, InputGestures = new InputGestureCollection { new KeyGesture(Key.T, ModifierKeys.Control | ModifierKeys.Alt) }, Text = "_Outline", ToolTip = "Show the Outline window.", }); }
private void AddCommands() { CommandItems.Add( new DelegateCommandItem("InspectEditor", new DelegateCommand(InspectEditor)) { Category = CommandCategories.Tools, Text = "Inspect editor", ToolTip = "Show the editor in the Properties window." }, new DelegateCommandItem("LaunchDebugger", new DelegateCommand(LaunchDebugger)) { Category = CommandCategories.Tools, Text = "Launch debugger", ToolTip = "Launch the Visual Studio Debugger for debugging the running application." }, new DelegateCommandItem("OpenExecutableFolder", new DelegateCommand(OpenExecutableFolder)) { Category = CommandCategories.Tools, Text = "Open executable folder", ToolTip = "Open the folder containing the executable." }, new DelegateCommandItem("OpenApplicationSettings", new DelegateCommand(OpenApplicationSettings)) { Category = CommandCategories.Tools, Text = "Open application settings", ToolTip = "Open the application settings folder in Windows Explorer." }, new DelegateCommandItem("OpenUserSettings", new DelegateCommand(OpenUserSettings)) { Category = CommandCategories.Tools, Text = "Open user settings", ToolTip = "Open the user settings folder in Windows Explorer." }, new DelegateCommandItem("OutputCommandNodes", new DelegateCommand(OutputCommandNodes, CanOutputCommandNodes)) { Category = CommandCategories.Tools, Text = "Output command nodes", ToolTip = "Prints the structure of all menu and toolbar commands." }, new DelegateCommandItem("SystemInfo", new DelegateCommand(ShowSystemInfo)) { Category = CommandCategories.Help, //Icon = MultiColorGlyphs.MessageInformation, Text = "_System Info...", ToolTip = "Open the Microsoft System Information application (msinfo32.exe)." }); }
private void AddCommands() { CommandItems.Add( new RoutedCommandItem(ApplicationCommands.PrintPreview) { Category = CommandCategories.File, Icon = MultiColorGlyphs.PrintPreview, Text = "Print pre_view...", ToolTip = "Show the print preview.", }, new RoutedCommandItem(ApplicationCommands.Print) { Category = CommandCategories.File, Icon = MultiColorGlyphs.Print, Text = "_Print...", ToolTip = "Print the document.", }); }
private async void LotSelectedItemChange() { try { if (this.LotSelected == null) { this.NameLot = "Seleccione un lote..."; return; } this.NameLot = this.LotSelected.NameLot; UserDialogs.Instance.ShowLoading("Obteniendo comandos...", MaskType.Black); //ApiSrv = new Services.ApiService(ApiConsult.ApiAuth); if (!await ApiIsOnline()) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } else { if (!TokenValidator.IsValid(TokenMenuB)) { if (!await ApiIsOnline()) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } else { if (!await GetTokenSuccess()) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } else { TokenMenuB = TokenGet; } } } LogInquirieGetCommandsQueryValues logInquirieGetCommandsQueryValues = new LogInquirieGetCommandsQueryValues() { IdLot = this.LotSelected.IdLot }; Response resultGetCommands = await ApiSrv.LogInquirieGetCommands(TokenMenuB.Key, logInquirieGetCommandsQueryValues); if (!resultGetCommands.IsSuccess) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } else { Commands = JsonConvert.DeserializeObject <List <LogInquiriesCommand> >(Crypto.DecodeString(resultGetCommands.Data)); if (CommandItems == null) { CommandItems = new ObservableCollection <PickerCommandItem>(); } else { CommandItems.Clear(); } foreach (LogInquiriesCommand logInquiriesCommand in Commands) { CommandItems.Add(new PickerCommandItem() { IdCommand = logInquiriesCommand.IdCommand, NameCommand = logInquiriesCommand.Command, NameDisplay = (logInquiriesCommand.Command.Length > 20) ? logInquiriesCommand.Command.Substring(0, 20) + "..." : logInquiriesCommand.Command, CodeCommand = logInquiriesCommand.Command.Split('-')[0].Trim() }); } UserDialogs.Instance.HideLoading(); } } } catch //(Exception ex) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); } }
private void AddCommands() { CommandItems.Add(new ThemeCommandItem(this)); }
//-------------------------------------------------------------- #region Properties & Events //-------------------------------------------------------------- #endregion //-------------------------------------------------------------- #region Methods //-------------------------------------------------------------- private void AddCommands() { CommandItems.Add( new NewDocumentItem(this), new DelegateCommandItem("Open", new DelegateCommand(() => OpenAsync().Forget(), CanOpen)) { Category = CommandCategories.File, Icon = MultiColorGlyphs.Open, InputGestures = new InputGestureCollection { new KeyGesture(Key.O, ModifierKeys.Control) }, Text = "_Open", ToolTip = "Open document." }, new DelegateCommandItem("Reload", new DelegateCommand(Reload, CanReload)) { Category = CommandCategories.File, Icon = MultiColorGlyphs.Reload, InputGestures = new InputGestureCollection { new KeyGesture(Key.R, ModifierKeys.Control) }, Text = "_Reload", ToolTip = "Reload document." }, new DelegateCommandItem("Close", new DelegateCommand(Close, HasActiveDocument)) { Category = CommandCategories.File, Icon = MultiColorGlyphs.Close, InputGestures = new InputGestureCollection { new KeyGesture(Key.F4, ModifierKeys.Control) }, Text = "_Close", ToolTip = "Close the document." }, new DelegateCommandItem("CloseAll", new DelegateCommand(() => CloseAllAsync().Forget(), HasActiveDocument)) { Category = CommandCategories.File, Icon = MultiColorGlyphs.CloseAll, Text = "Close all", ToolTip = "Close all documents." }, new DelegateCommandItem("CloseAllButThis", new DelegateCommand(() => CloseAllButActiveAsync().Forget(), CanCloseAllButActiveDocument)) { Category = CommandCategories.File, Text = "Close all but this", ToolTip = "Close all open documents except the current." }, new DelegateCommandItem("CloseAllDocumentsAndWindows", new DelegateCommand(() => CloseAllDocumentsAndWindowsAsync().Forget(), CanCloseAllDocumentsAndWindows)) { Category = CommandCategories.Window, Text = "Close all", ToolTip = "Close all documents and tool windows." }, new DelegateCommandItem("Save", new DelegateCommand(SaveActiveDocument, CanSave)) { Category = CommandCategories.File, Icon = MultiColorGlyphs.Save, InputGestures = new InputGestureCollection { new KeyGesture(Key.S, ModifierKeys.Control) }, Text = "_Save", ToolTip = "Save the document.", }, new DelegateCommandItem("SaveAs", new DelegateCommand(SaveAs, CanSave)) { Category = CommandCategories.File, Icon = MultiColorGlyphs.SaveAs, Text = "Save _as...", ToolTip = "Save the document under a new filename.", }, new DelegateCommandItem("SaveAll", new DelegateCommand(() => SaveAllAsync().Forget(), CanSaveAll)) { Category = CommandCategories.File, Icon = MultiColorGlyphs.SaveAll, InputGestures = new InputGestureCollection { new KeyGesture(Key.S, ModifierKeys.Control | ModifierKeys.Shift) }, Text = "Save a_ll", ToolTip = "Save all documents." }, new RecentDocumentsItem(this), new DelegateCommandItem("CopyFullPath", new DelegateCommand(CopyUri, HasActiveDocument)) { Category = CommandCategories.File, Text = "Copy full path", ToolTip = "Copy full path and name of the document." }, new DelegateCommandItem("OpenContainingFolder", new DelegateCommand(OpenContainingFolder, CanOpenContainingFolder)) { Category = CommandCategories.File, Text = "Open containing folder", ToolTip = "Open the folder containing the document in the Windows Explorer." }, new DelegateCommandItem("NewWindow", new DelegateCommand(AddView, IsDocumentFocused)) { Category = CommandCategories.Window, Icon = MultiColorGlyphs.NewWindow, Text = "_New window", ToolTip = "Open a new window for the current document.", }); }
private void AddCommands() { _toolBarsCommandItem = new ToolBarsCommandItem(this); CommandItems.Add( new DelegateCommandItem("Exit", new DelegateCommand(() => Editor.Exit())) { Category = CommandCategories.File, Icon = MultiColorGlyphs.Exit, Text = "E_xit", ToolTip = "Close this application." }, new RoutedCommandItem(ApplicationCommands.Undo) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Undo, ToolTip = "Undo the last operation.", }, new RoutedCommandItem(ApplicationCommands.Redo) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Redo, ToolTip = "Perform the last undone operation.", }, new RoutedCommandItem(ApplicationCommands.Cut) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Cut, ToolTip = "Remove selected item and copy it to the clipboard.", }, new RoutedCommandItem(ApplicationCommands.Copy) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Copy, ToolTip = "Copy selected item to the clipboard.", }, new RoutedCommandItem(ApplicationCommands.Paste) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Paste, ToolTip = "Paste the content of the clipboard into the active document.", }, new RoutedCommandItem(ApplicationCommands.Delete) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Delete, ToolTip = "Delete the selected item.", }, new RoutedCommandItem(ApplicationCommands.SelectAll) { Category = CommandCategories.Edit, Text = "Select all", ToolTip = "Select all items of the current document.", }, _toolBarsCommandItem, new DelegateCommandItem("ShowAllToolBars", _toolBarsCommandItem.ToggleAllToolBarsCommand) { Category = CommandCategories.View, CommandParameter = Boxed.BooleanTrue, // true = make visible. Text = "_Show all", ToolTip = "Show all toolbars." }, new DelegateCommandItem("HideAllToolBars", _toolBarsCommandItem.ToggleAllToolBarsCommand) { Category = CommandCategories.View, CommandParameter = Boxed.BooleanFalse, // false = make invisible Text = "_Hide all", ToolTip = "Hide all toolbars." }); }