private void UpdateCommands() { if (_suppressUpdateCommandItems) { return; } // Invalidate all DelegateCommands. CommandItems.OfType <DelegateCommandItem>() .Select(item => item.Command) .ForEach(command => command.RaiseCanExecuteChanged()); }
/// <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." }); }
bool TryGetCommand(string[] flags, out CommandBase command) { command = null; if (flags.Length > 0) { if (CommandItems.TryGetCommand(flags, out command)) { return(true); } consoleInteraction.ShowFaultyInput(); } return(false); }
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.", }); }
protected override void OnShutdown() { Editor.Services.GetInstance <IAboutService>()?.ExtensionDescriptions.Remove(_extensionDescription); Editor.Services.GetInstance <IOptionsService>()?.OptionsNodeCollections.Remove(_optionsNodes); _optionsNodes = null; Editor.ToolBarNodeCollections.Remove(_toolBarNodes); _toolBarNodes = null; CommandItems.Clear(); EditorHelper.UnregisterResources(_resourceDictionary); }
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("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("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("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.", }); }
public StringBuilder LogCommand(StringBuilder sb) { sb.AppendLine("_一个子工作单元"); bool _islog = LogSaveAtawChanges(); if (_islog || !IsChildUnit) { if ((CommandItems != null && CommandItems.Count > 0)) { CommandItems.CommandToString(sb); } if (SqlTransList != null && SqlTransList.Count > 0) { SqlTransList.SqlTransToString(sb); } } return(sb); }
public async Task <PluginResult> Handle(BotMessage message, CommandItems commandItems, CancellationToken token) { var chatId = message.ChatId; StringBuilder result = new(); var user = await _userService.GetUserAsync(chatId, token); if (user == null) { var sourceAdapter = _sourceAdapterFactory.GetAdapter(message.SourceId); var name = await sourceAdapter.GetName(message.ChatId, token); user = await _userService.AddUserAsync(new AddUserRequest { ChatId = chatId, Name = name }, token); } result.AppendLine(WelcomeText.WelcomeUser(user.Name)); return(PluginResult.Success(result.ToString())); }
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 RemoveCommands() { CommandItems.Clear(); }
private void RemoveCommands() { CommandItems.Clear(); _quickFindCommandItem = null; }
public void Run() { EmployeeRegister register = new EmployeeRegister(); consoleInteraction.ShowWelcome(); bool exit = false; while (!exit) { consoleInteraction.ShowPrompt(); var inputData = consoleInteraction.GetUserInputs(); CommandBase cmd; if (TryGetCommand(inputData, out cmd)) { if (cmd is CommandHelp) { consoleInteraction.ShowRows(CommandItems.GetSyntaxes()); } else if (cmd is CommandQuit) { exit = true; } else if (cmd is CommandAdd) { var cmdAdd = cmd as CommandAdd; register.AddEmployee(new Employee(cmdAdd.FirstName, cmdAdd.LastName, cmdAdd.Salary)); } else if (cmd is CommandClear) { consoleInteraction.ClearScreen(); } else if (cmd is CommandAddMany) { List <Employee> dummys = new List <Employee>() { new Employee("Musse", "Pigg", 25000), new Employee("Kalle", "Anka", 14500.90m), new Employee("Janne", "Långben", 10000.50m), }; foreach (var employee in dummys) { register.AddEmployee(employee); } } else if (cmd is CommandPrint) { var employees = register.GetEmployees(); foreach (var employee in employees) { consoleInteraction.ShowRows(new string[] { string.Format("Namn: {0} {1} Lön: {2} kr", employee.FirstName, employee.LastName, employee.Salary.ToString()) }); } } else { consoleInteraction.ShowFaultyInput(); } } } consoleInteraction.ShowGoodBye(); }
private void RemoveCommands() { CommandItems.Clear(); _syntaxHighlightingItem = null; }
public Command GetCommandById(int id) { return(CommandItems.FirstOrDefault(i => i.Id == id)); }
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." }); }
public IEnumerable <Command> GetAllCommands() { return(CommandItems.ToList()); }
//-------------------------------------------------------------- #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() { // Add input gestures to routed commands. (Routed commands do not have a setter for InputGestures.) AvalonEditCommands.Comment.InputGestures.Add(new MultiKeyGesture(new[] { Key.K, Key.C }, ModifierKeys.Control)); AvalonEditCommands.Uncomment.InputGestures.Add(new MultiKeyGesture(new[] { Key.K, Key.U }, ModifierKeys.Control)); AvalonEditCommands.ConvertToUppercase.InputGestures.Add(new KeyGesture(Key.U, ModifierKeys.Control | ModifierKeys.Shift)); AvalonEditCommands.ConvertToLowercase.InputGestures.Add(new KeyGesture(Key.U, ModifierKeys.Control)); // Add CommandItems. _syntaxHighlightingItem = new SyntaxHighlightingItem(this); CommandItems.AddRange(new ICommandItem[] { new RoutedCommandItem(AvalonEditCommands.PasteMultiple) { Category = CommandCategories.Edit, Text = "Paste multiple", ToolTip = "Show the most recent entries in the clipboard." }, new DelegateCommandItem("GoToLine", new DelegateCommand(GoToLineNumber, CanGoToLineNumber)) { Category = CommandCategories.Edit, InputGestures = new InputGestureCollection { new KeyGesture(Key.G, ModifierKeys.Control) }, Text = "_Go to...", ToolTip = "Go to line" }, new RoutedCommandItem(AvalonEditCommands.RemoveLeadingWhitespace) { Category = CommandCategories.Edit, Text = "Remove leading white space" }, new RoutedCommandItem(AvalonEditCommands.RemoveTrailingWhitespace) { Category = CommandCategories.Edit, Text = "Remove trailing white space" }, new RoutedCommandItem(AvalonEditCommands.ConvertToUppercase) { Category = CommandCategories.Edit, Text = "Make upper case", ToolTip = "Converts the selected text to upper case." }, new RoutedCommandItem(AvalonEditCommands.ConvertToLowercase) { Category = CommandCategories.Edit, Text = "Make lower case", ToolTip = "Converts the selected text to lower case." }, new RoutedCommandItem(AvalonEditCommands.ConvertToTitleCase) { Category = CommandCategories.Edit, Text = "Make title case", ToolTip = "Converts the selected text to title case." }, new RoutedCommandItem(AvalonEditCommands.InvertCase) { Category = CommandCategories.Edit, Text = "Invert case", ToolTip = "Inverts the case in the selected text." }, new RoutedCommandItem(AvalonEditCommands.ConvertTabsToSpaces) { Category = CommandCategories.Edit, Text = "Tabs to spaces" }, new RoutedCommandItem(AvalonEditCommands.ConvertSpacesToTabs) { Category = CommandCategories.Edit, Text = "Spaces to tabs" }, new RoutedCommandItem(AvalonEditCommands.ConvertLeadingTabsToSpaces) { Category = CommandCategories.Edit, Text = "Leading tabs to spaces" }, new RoutedCommandItem(AvalonEditCommands.ConvertLeadingSpacesToTabs) { Category = CommandCategories.Edit, Text = "Leading spaces to tabs" }, new RoutedCommandItem(AvalonEditCommands.IndentSelection) { Category = CommandCategories.Edit, Text = "Indent selection" }, new RoutedCommandItem(AvalonEditCommands.Comment) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Comment, Text = "Comment selection", ToolTip = "Comment out selected lines." }, new RoutedCommandItem(AvalonEditCommands.Uncomment) { Category = CommandCategories.Edit, Icon = MultiColorGlyphs.Uncomment, Text = "Uncomment selection", ToolTip = "Uncomment selected lines." }, new RoutedCommandItem(AvalonEditCommands.ToggleFold) { Category = CommandCategories.Edit, Text = "Fold/unfold", ToolTip = "Toggle the current fold." }, new RoutedCommandItem(AvalonEditCommands.ToggleAllFolds) { Category = CommandCategories.Edit, Text = "Fold/unfold All", ToolTip = "Toggle all folds (toggle outlining)." }, _syntaxHighlightingItem, }); }
public async Task <PluginResult> Handle(BotMessage message, CommandItems commandItems, CancellationToken token) { var text = message.Text; var chatId = message.ChatId; StringBuilder result = new(); var cost = commandItems.GetDecimal("cost"); var user = await _userService.GetUserAsync(chatId, token); if (user == null) { var sourceAdapter = _sourceAdapterFactory.GetAdapter(message.SourceId); var name = await sourceAdapter.GetName(message.ChatId, token); user = await _userService.AddUserAsync(new AddUserRequest { ChatId = chatId, Name = name }, token); result.AppendLine(AccountantText.WelcomeUser(name)); } var comment = commandItems.GetString("comment"); var categoryName = commandItems.GetString("category"); var categoryExpense = await _accountantService.GetExpenseCategory(user.Id, categoryName, token); var categoryIncome = await _accountantService.GetIncomeCategory(user.Id, categoryName, token); var from = GetCurrentMonthDate(10); var to = from.AddMonths(1); if (categoryExpense == null && categoryIncome == null) { categoryExpense = await _accountantService.AddCategory(new Inbound.AddExpenseCategoryRequest { UserId = user.Id, Name = categoryName }, token); result.AppendLine(AccountantText.AddedNewCategory(categoryName)); } if (categoryExpense != null) { var expense = new Inbound.AddTransactionRequest { Cost = cost, Comment = comment, CategoryId = categoryExpense.Id, UserId = user.Id }; await _accountantService.AddTransaction(expense, token); var categoryBalance = await _accountantService.GetBalance(user.Id, categoryExpense.Id, from, to, token); result.AppendLine( AccountantText.AddedNewExpenseTransaction(categoryName, from, to, categoryBalance)); } else if (categoryIncome != null) { var income = new Inbound.AddTransactionRequest() { Cost = cost, Comment = comment, CategoryId = categoryIncome.Id, UserId = user.Id }; await _accountantService.AddTransaction(income, token); var categoryBalance = await _accountantService.GetBalance(user.Id, categoryIncome.Id, from, to, token); result.AppendLine( AccountantText.AddedNewIncomeTransaction(categoryName, from, to, categoryBalance)); } var balance = await _accountantService.GetBalance(user.Id, token); result.AppendLine(); result.AppendLine(AccountantText.RemainingBalance(balance)); return(PluginResult.Success(result.ToString())); }
private void AddCommands() { CommandItems.Add(new ThemeCommandItem(this)); }