示例#1
0
        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;
            }
        }
示例#3
0
 private static void PlayersListed(object sender, CommandExecutedEventArgs e)
 {
     if (e.Successful)
     {
         List <Player> players = Player.ParsePlayers(e.Response);
         PlayersRefreshed?.Invoke(Client, players);
     }
 }
示例#4
0
        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;
        }
示例#5
0
        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);
        }
示例#6
0
 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);
            }
        }
示例#9
0
            protected virtual void OnExecuted(CommandExecutedEventArgs args)
            {
                var e = this.Executed;

                if (e != null)
                {
                    e(this, args);
                }
            }
示例#10
0
        private void OnCommandExecuted(object sender, CommandExecutedEventArgs e)
        {
            var expander = AssociatedObject;

            if (expander != null)
            {
                expander.IsExpanded = !expander.IsExpanded;
            }
        }
示例#11
0
 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;
     }
 }
示例#12
0
 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);
         }
     }
 }
示例#13
0
 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);
     }
 }
示例#14
0
 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);
 }
示例#15
0
 private void TimeSet(object sender, CommandExecutedEventArgs e)
 {
     if (e.Successful)
     {
         SetStatus("TimeOfDay set", StatusType.Ok);
     }
     else
     {
         SetStatus("TimeOfDay could not be set", StatusType.Error);
     }
 }
示例#16
0
        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);
        }
示例#17
0
 private void WorldSaved(object sender, CommandExecutedEventArgs e)
 {
     if (e.Successful)
     {
         SetStatus("World saved");
     }
     else
     {
         SetStatus("World save failed", StatusType.Error);
     }
 }
示例#18
0
        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);
        }
示例#19
0
 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);
     }
 }
示例#20
0
 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);
     }
 }
示例#21
0
 private void CommandExecuted(object sender, CommandExecutedEventArgs e)
 {
     SetStatus("Command executed", StatusType.Ok);
     syncContext.Send(state =>
     {
         try
         {
             tbxCommand.Clear();
         }
         catch { }
     }, null);
 }
示例#22
0
 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);
     }
 }
示例#23
0
 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);
     }
 }
示例#24
0
 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);
     }
 }
示例#25
0
 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);
     }
 }
示例#26
0
 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;
            }
            }
        }
示例#28
0
        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);
        }
示例#29
0
        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.");
            }
        }
示例#30
0
 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);
     }
 }
示例#31
0
        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);
        }
示例#32
0
        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...");
            }
        }
示例#33
0
        /// <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;
              }
        }
示例#34
0
 /// <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);
 }
示例#35
0
 /// <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();
 }
示例#36
0
 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;
 }
示例#37
0
 /// <summary>
 ///   Start Ripping
 /// </summary>
 /// <param name = "sender"></param>
 /// <param name = "e"></param>
 private void RipStart_Executed(object sender, CommandExecutedEventArgs e)
 {
     RipGridView.RipAudioCD();
 }
示例#38
0
 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;
             }
         }
     }
 }
示例#39
0
 /// <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();
 }
示例#40
0
 /// <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();
 }
示例#41
0
 /// <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;
     }
       }
 }
示例#42
0
 private void ConvertCancel_Executed(object sender, CommandExecutedEventArgs e)
 {
     ConvertGridView.ConvertFilesCancel();
 }
示例#43
0
 private void AddToggleButtonWithTextCommand_Executed(object sender, CommandExecutedEventArgs e)
 {
     ToggleButton toggleButton = (ToggleButton)AddControlToTheCurrentPane(typeof(ToggleButton), true, true);
     toggleButton.TextImageRelation = TextImageRelation.ImageBeforeText;
 }
示例#44
0
 /// <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);
 }
示例#45
0
 private static void OnViewModelCommandExecuted(object sender, CommandExecutedEventArgs e)
 {
     AuditingManager.OnCommandExecuted((IViewModel)sender, e.CommandPropertyName, e.Command, e.CommandParameter);
 }
示例#46
0
 private void AddToggleButtonCommand_Executed(object sender, CommandExecutedEventArgs e)
 {
     AddControlToTheCurrentPane(typeof(ToggleButton), true, false);
 }
示例#47
0
 /// <summary>
 ///   Cancel burning
 /// </summary>
 /// <param name = "sender"></param>
 /// <param name = "e"></param>
 private void BurnCancel_Executed(object sender, CommandExecutedEventArgs e)
 {
     BurnGridView.BurnAudioCDCancel();
 }
示例#48
0
 /// <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);
 }
示例#49
0
        /// <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();
        }
示例#50
0
 /// <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();
 }
示例#51
0
        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;
        }
示例#52
0
 private void RipCancel_Executed(object sender, CommandExecutedEventArgs e)
 {
     RipGridView.RipAudioCDCancel();
 }
示例#53
0
 private void ConvertStart_Executed(object sender, CommandExecutedEventArgs e)
 {
     ConvertGridView.ConvertFiles();
 }
示例#54
0
 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));
 }