private async void DelMsgOnCmd_Handler(object sender, CommandExecutedEventArgs e) { try { var channel = e.Message.Channel as ITextChannel; if (channel == null) { return; } //todo cache this bool shouldDelete; using (var uow = DbHandler.UnitOfWork()) { shouldDelete = uow.GuildConfigs.For(channel.Guild.Id).DeleteMessageOnCommand; } if (shouldDelete) { await e.Message.DeleteAsync().ConfigureAwait(false); } } catch (Exception ex) { _log.Warn(ex, "Delmsgoncmd errored..."); } }
private void PipeService_CommandExecuted(object sender, CommandExecutedEventArgs args) { logger.Info(@"Executing command ""{0}"" from pipe with arguments ""{1}""", args.Command, args.Args); switch (args.Command) { case CmdlineCommands.Focus: Show(); WindowState = WindowState.Normal; Activate(); BringToForeground(); break; case CmdlineCommands.Launch: var game = GameDatabase.Instance.GamesCollection.FindById(int.Parse(args.Args)); if (game == null) { logger.Error("Cannot start game, game {0} not found.", args.Args); } else { GamesEditor.Instance.PlayGame(game); } break; default: logger.Warn("Unknown command received"); break; } }
private static void PlayersListed(object sender, CommandExecutedEventArgs e) { if (e.Successful) { List <Player> players = Player.ParsePlayers(e.Response); PlayersRefreshed?.Invoke(Client, players); } }
void AddSliderCommand_Executed(object sender, CommandExecutedEventArgs e) { Slider slider = (Slider)AddControlToTheCurrentPane(typeof(Slider), false, false); slider.Width = ContentScale.ScaleWidth(132); slider.ShowMinMaxTicks = false; slider.IsSnapToTickEnabled = true; }
public Task CommandExecuted(CommandExecutedEventArgs e) { e.Context.Client.DebugLogger.LogMessage(LogLevel.Debug, "nullopt", $"{e.Context.User.Username} successfully executed '{e.Command.QualifiedName}'", DateTime.Now); return(Task.CompletedTask); }
void radRichTextBox_CommandExecuted(object sender, CommandExecutedEventArgs e) { if (e.Command is NewDocumentCommand) { // When a new document is opened the values of the path and the provider should be cleared. this.path = null; this.provider = null; } }
#pragma warning disable 1998 private async Task CommandExecuted(CommandExecutedEventArgs e) { var context = (GarlicBreadCommandContext)e.Context; if (context.Command.RunMode != RunMode.Parallel) { context.ServiceScope.Dispose(); } }
private void OnCommandExecuted(object sender, CommandExecutedEventArgs e) { var expander = AssociatedObject; if (expander != null) { expander.SetCurrentValue(Expander.IsExpandedProperty, !expander.IsExpanded); } }
protected virtual void OnExecuted(CommandExecutedEventArgs args) { var e = this.Executed; if (e != null) { e(this, args); } }
private void OnCommandExecuted(object sender, CommandExecutedEventArgs e) { var expander = AssociatedObject; if (expander != null) { expander.IsExpanded = !expander.IsExpanded; } }
private static void ChatReceived(object sender, CommandExecutedEventArgs e) { if (e.Successful) { if (e.Response.Trim() != "Server received, But no response!!") { ChatMessages?.Invoke(sender, e.Response); } } }
private void MessageOfTheDayShown(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SetStatus("Message of the day shown", StatusType.Ok); } else { SetStatus("Could not show message of the day", StatusType.Error); } }
private void OnCommandExecuted(object sender, CommandExecutedEventArgs e) { this.SaveLogEntry( e.Command.GetType(), e.Command.InvokedAs + " " + e.Command.OriginalArguments, e.Command.User, e.Command.CommandSource, e.Command.ExecutionStatus.MainFlags, e.Command.ExecutionStatus.SubcommandFlags, e.Command.ExecutionStatus.AclStatus); }
private void TimeSet(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SetStatus("TimeOfDay set", StatusType.Ok); } else { SetStatus("TimeOfDay could not be set", StatusType.Error); } }
private static Task OnViewModelCommandExecutedAsync(object sender, CommandExecutedEventArgs e) { if (!AuditingManager.IsAuditingEnabled) { return(TaskHelper.Completed); } AuditingManager.OnCommandExecuted((IViewModel)sender, e.CommandPropertyName, e.Command, e.CommandParameter); return(TaskHelper.Completed); }
private void WorldSaved(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SetStatus("World saved"); } else { SetStatus("World save failed", StatusType.Error); } }
private Task Commands_CommandExecuted(CommandExecutedEventArgs e) { // let's log the name of the guild that was just // sent to our client e.Context.Client.DebugLogger.LogMessage(LogLevel.Info, "ExampleBot", $"{e.Context.User.Username} successfully executed '{e.Command.QualifiedName}'", DateTime.Now); // since this method is not async, let's return // a completed task, so that no additional work // is done return(Task.CompletedTask); }
private void MessageSent(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SyncContext.Send(state => tbxChatMessage.Clear(), null); SetStatus("Message sent", StatusType.Ok); } else { SetStatus("Message could not be sent", StatusType.Error); } }
private void Broadcasted(object sender, CommandExecutedEventArgs e) { if (e.Successful) { syncContext.Send(state => rtbBroadcast.Clear(), null); SetStatus("Broadcast sent", StatusType.Ok); } else { SetStatus("Broadcast could not be sent", StatusType.Error); } }
private void CommandExecuted(object sender, CommandExecutedEventArgs e) { SetStatus("Command executed", StatusType.Ok); syncContext.Send(state => { try { tbxCommand.Clear(); } catch { } }, null); }
private void PlayerRemovedFromWhitelist(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SetStatus("Player removed from whitelist", StatusType.Ok); RefreshPlayers(); } else { SetStatus("Player could not be removed from whitelist", StatusType.Error); } }
private void PlayerUnbanned(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SetStatus("Player unbanned", StatusType.Ok); RefreshPlayers(); } else { SetStatus("Player could not be unbanned", StatusType.Error); } }
private void PlayerAddedToWhitelist(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SetStatus("Player added to whitelist.", StatusType.Ok); RefreshPlayers(); } else { SetStatus("Player could not be added to whitelist", StatusType.Error); } }
private void Client_CommandExecuted(object sender, CommandExecutedEventArgs e) { if (e.Command.Type != CommandType.GetChat && e.Command.Type != CommandType.ListPlayers) { syncContext.Post(state => { AddMessage($"Command: {e.Command}"); AddMessage($"Response: {e.Response}"); ScrollToEnd(); }, e); } }
private void ServerExited(object sender, CommandExecutedEventArgs e) { if (e.Successful) { SetStatus("Server shutting down"); ArkRcon.Client.Disconnect(); } else { SetStatus("Server could not be shut down", StatusType.Error); } }
private void PipeService_CommandExecuted(object sender, CommandExecutedEventArgs args) { Logger.Info(@"Executing command ""{0}"" from pipe with arguments ""{1}""", args.Command, args.Args); switch (args.Command) { case CmdlineCommands.Focus: { RestoreWindow(); break; } case CmdlineCommands.New: { _databaseInteractions.CreateAndOpenDatabase().Wait(); RestoreWindow(); break; } case CmdlineCommands.Open: { if (!string.IsNullOrEmpty(args.Args)) { if (args.Args.Equals("new", StringComparison.OrdinalIgnoreCase)) { _databaseInteractions.CreateAndOpenDatabase().Wait(); } else if (args.Args.Equals("open", StringComparison.OrdinalIgnoreCase)) { _databaseInteractions.OpenDatabase().Wait(); } else { _databaseInteractions.OpenDatabase(args.Args).Wait(); } } else { _databaseInteractions.OpenDatabase().Wait(); } RestoreWindow(); break; } default: { Logger.Warn("Unknown command received"); break; } } }
private Task CommandExecutedAsync(CommandExecutedEventArgs args) { var context = (RiasCommandContext)args.Context; var command = context.Command; Log.Logger.Information($"[Command] \"{command.Name}\"\n" + $"\t\t[Arguments] \"{string.Join(" ", context.Arguments)}\"\n" + $"\t\t[User] \"{context.User}\" ({context.User.Id})\n" + $"\t\t[Channel] \"{context.Channel.Name}\" ({context.Channel.Id})\n" + $"\t\t[Guild] \"{context.Guild?.Name ?? "DM"}\" ({context.Guild?.Id ?? 0})"); return(Task.CompletedTask); }
private static void CheckUpdateRowCount(object sender, CommandExecutedEventArgs e, int expectedRowCount) { var token = (ExecutionToken)sender; if (e.RowsAffected == null) { throw new InvalidOperationException($"The database did not report how many rows were affected by operation {token.OperationName}. Either use the UpdateOptions.IgnoreRowsAffected flag or report this as an bug in {token.GetType().FullName}."); } else if (e.RowsAffected != expectedRowCount) { throw new UnexpectedDataException($"Expected {expectedRowCount} rows to be affected by the operation {token.OperationName} but {e.RowsAffected} were affected instead."); } }
private void MessageOfTheDaySet(object sender, CommandExecutedEventArgs e) { if (e.Successful) { syncContext.Send(state => ArkRcon.ConnectedServer.MessageOfTheDay = rtbMotd.Text, null); Data.Data.Set(ArkRcon.ConnectedServer); SetStatus("MOTD set", StatusType.Ok); } else { SetStatus("MOTD could not be set", StatusType.Error); } }
private Task OnCommandExecuted(CommandExecutedEventArgs e) { var context = (EspeonCommandContext)e.Context; this._logger.LogInformation( "Executed {command} for {user} in {guild}/{channel}", context.Command.Name, context.Member.DisplayName, context.Guild.Name, context.Channel.Name); context.ServiceScope.Dispose(); return(Task.CompletedTask); }
private async void DelMsgOnCmd_Handler(object sender, CommandExecutedEventArgs e) { try { var channel = e.Message.Channel as ITextChannel; if (channel == null) return; //todo cache this bool shouldDelete; using (var uow = DbHandler.UnitOfWork()) { shouldDelete = uow.GuildConfigs.For(channel.Guild.Id).DeleteMessageOnCommand; } if (shouldDelete) await e.Message.DeleteAsync().ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex, "Delmsgoncmd errored..."); } }
/// <summary> /// Handle various button click events /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void TagsTabButton_Executed(object sender, CommandExecutedEventArgs e) { // If no Rows are selected, select ALL of them and do the necessary action if (!TracksGridView.CheckSelections(true)) { return; } switch (e.Command.Name) { case "FileNameToTag": FileNameToTag.FileNameToTag dlgFileNameToTag = new FileNameToTag.FileNameToTag(this); ShowDialogInDetailPanel(dlgFileNameToTag); break; case "IdentifyFiles": TracksGridView.IdentifyFiles(); break; case "TagFromInternet": InternetLookup.InternetLookup lookup = new InternetLookup.InternetLookup(this); lookup.SearchForAlbumInformation(); tagEditControl.FillForm(); SetGalleryItem(); break; case "GetCoverArt": TracksGridView.GetCoverArt(); break; case "GetLyrics": TracksGridView.GetLyrics(); break; case "AutoNumber": TracksGridView.AutoNumber(); break; case "RemoveComment": TracksGridView.RemoveComments(); break; case "RemoveCoverArt": TracksGridView.RemovePictures(); break; case "OrganiseFiles": OrganiseFiles dlgOrganise = new OrganiseFiles(this); ShowDialogInDetailPanel(dlgOrganise); break; case "RenameFiles": TagToFileName.TagToFileName dlgTagToFile = new TagToFileName.TagToFileName(this, true); break; case "RenameFileOptions": TagToFileName.TagToFileName dlgTagToFileOptions = new TagToFileName.TagToFileName(this, false); ShowDialogInDetailPanel(dlgTagToFileOptions); break; case "CaseConversion": CaseConversion.CaseConversion dlgCaseConversion = new CaseConversion.CaseConversion(this, true); dlgCaseConversion.CaseConvertSelectedTracks(); break; case "CaseConversionOptions": CaseConversion.CaseConversion dlgCaseConversionOptions = new CaseConversion.CaseConversion(this); ShowDialogInDetailPanel(dlgCaseConversionOptions); break; case "DeleteAllTags": TracksGridView.DeleteTags(TagTypes.AllTags); break; case "DeleteID3v1": TracksGridView.DeleteTags(TagTypes.Id3v1); break; case "DeleteID3v2": TracksGridView.DeleteTags(TagTypes.Id3v2); break; case "ScriptExecute": if (comboBoxScripts.SelectedIndex < 0) return; Item tag = (Item)comboBoxScripts.SelectedItem; TracksGridView.ExecuteScript((string)tag.Value); break; case "AddToBurner": TracksGridView.tracksGrid_AddToBurner(sender, new EventArgs()); break; case "AddToConversion": TracksGridView.tracksGrid_AddToConvert(sender, new EventArgs()); break; case "AddToPlaylist": TracksGridView.tracksGrid_AddToPlayList(sender, new EventArgs()); break; case "Find": FindReplace findDlg = new FindReplace(this); findDlg.Replace = false; ShowCenteredForm(findDlg); break; case "Replace": FindReplace replaceDlg = new FindReplace(this); replaceDlg.Replace = true; ShowCenteredForm(replaceDlg); break; case "ValidateSong": if (!gridViewControl.CheckSelections(true)) break; gridViewControl.ValidateMP3File(); gridViewControl.View.ClearSelection(); break; case "FixSong": if (!gridViewControl.CheckSelections(true)) break; gridViewControl.FixMP3File(); break; } }
/// <summary> /// Save the selected Picture as Folder THumb /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void SaveAsThumb_Executed(object sender, CommandExecutedEventArgs e) { TrackData track = TracksGridView.SelectedTrack; TracksGridView.SavePicture(track); }
/// <summary> /// The Save button was pressed /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void Save_Executed(object sender, CommandExecutedEventArgs e) { this.ribbon.BackstageViewVisible = false; TracksGridView.Save(); }
/// <summary> /// Start Ripping /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void RipStart_Executed(object sender, CommandExecutedEventArgs e) { RipGridView.RipAudioCD(); }
internal static void WhenHandler(object sender, CommandExecutedEventArgs e) { if (!e.MovementCommand) { return; } foreach (ExecuteCmdAction a in m_events) { if (!a.IsRunning && a.ShouldExecuteNow) { try { a.IsRunning = true; WriteOutput("exec> " + a.ToString()); a.Execute(); } finally { a.IsRunning = false; } } } }
/// <summary> /// The Progress Cancel has been fired from the Statusbar Button /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void ProgressCancel_Executed(object sender, CommandExecutedEventArgs e) { _progressCancelled = true; ResetWaitCursor(); }
/// <summary> /// Exit the Application /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void Exit_Executed(object sender, CommandExecutedEventArgs e) { this.ribbon.BackstageViewVisible = false; Application.Exit(); }
/// <summary> /// Display a Folder Select Dialog and update the Textbox, based on the button being pressed /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void FolderSelect_Executed(object sender, CommandExecutedEventArgs e) { FolderBrowserDialog oFD = new FolderBrowserDialog(); if (oFD.ShowDialog() == DialogResult.OK) { if (e.Invoker == buttonRipFolderSelect) { textBoxRipOutputFolder.Text = oFD.SelectedPath; } else if (e.Invoker == buttonConvertFolderSelect) { textBoxConvertOutputFolder.Text = oFD.SelectedPath; } } }
private void ConvertCancel_Executed(object sender, CommandExecutedEventArgs e) { ConvertGridView.ConvertFilesCancel(); }
private void AddToggleButtonWithTextCommand_Executed(object sender, CommandExecutedEventArgs e) { ToggleButton toggleButton = (ToggleButton)AddControlToTheCurrentPane(typeof(ToggleButton), true, true); toggleButton.TextImageRelation = TextImageRelation.ImageBeforeText; }
/// <summary> /// Change Display Columns /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void ChangeDisplayColumns_Executed(object sender, CommandExecutedEventArgs e) { this.ribbon.BackstageViewVisible = false; Form dlg = new ColumnSelect(TracksGridView); ShowModalDialog(dlg); }
private static void OnViewModelCommandExecuted(object sender, CommandExecutedEventArgs e) { AuditingManager.OnCommandExecuted((IViewModel)sender, e.CommandPropertyName, e.Command, e.CommandParameter); }
private void AddToggleButtonCommand_Executed(object sender, CommandExecutedEventArgs e) { AddControlToTheCurrentPane(typeof(ToggleButton), true, false); }
/// <summary> /// Cancel burning /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void BurnCancel_Executed(object sender, CommandExecutedEventArgs e) { BurnGridView.BurnAudioCDCancel(); }
/// <summary> /// Help Button has been pressed /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void Help_Executed(object sender, CommandExecutedEventArgs e) { About dlgAbout = new About(); ShowModalDialog(dlgAbout); }
/// <summary> /// Burn the selected Tracks to CD /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void BurnStart_Executed(object sender, CommandExecutedEventArgs e) { Burner burner = null; if (comboBoxBurner.SelectedIndex < 0) burner = (Burner)(comboBoxBurner.Items[0] as Item).Value; else burner = (Burner)(comboBoxBurner.SelectedItem as Item).Value; BurnGridView.SetActiveBurner(burner); BurnGridView.BurnAudioCD(); }
/// <summary> /// Refresh the Tracksgrid /// </summary> /// <param name = "sender"></param> /// <param name = "e"></param> private void Refresh_Executed(object sender, CommandExecutedEventArgs e) { this.ribbon.BackstageViewVisible = false; RefreshTrackList(); }
private static Task OnViewModelCommandExecutedAsync(object sender, CommandExecutedEventArgs e) { if (!AuditingManager.IsAuditingEnabled) { return TaskHelper.Completed; } AuditingManager.OnCommandExecuted((IViewModel)sender, e.CommandPropertyName, e.Command, e.CommandParameter); return TaskHelper.Completed; }
private void RipCancel_Executed(object sender, CommandExecutedEventArgs e) { RipGridView.RipAudioCDCancel(); }
private void ConvertStart_Executed(object sender, CommandExecutedEventArgs e) { ConvertGridView.ConvertFiles(); }
protected virtual void OnCommandExecuted(object sender, CommandExecutedEventArgs e) { var command = (IRecordableCommand)sender; environment.OnChange(service => service.Command_Executed(command.Id, e.Parameter, e.Start, e.End, e.Canceled, e.Error)); }