void LoadSceneCommand_Executing(object sender, CancelCommandEventArgs args) { // Use the serialization engine. var engine = SharpGL.Serialization.SerializationEngine.Instance; // Create an open file dialog. OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = engine.Filter; // Show the dialog. if (openFileDialog.ShowDialog() != true) { // Cancel any loading. args.Cancel = true; return; } // Load the scene. Scene scene = engine.LoadScene(openFileDialog.FileName); // Set the args. args.Parameter = scene; // Create in the current OpenGL context. scene.CreateInContext(viewModel.Scene.CurrentOpenGLContext); // Switch the scene over. viewModel.SelectedElements.Clear(); viewModel.Scene = scene; }
private void ShowPopupCommandOnExecuting(object sender, CancelCommandEventArgs args) { var shell = ApexBroker.GetShell(); ViewModel.PopupResult = shell.ShowPopup(new SimplePopup()); }
public override async void DoExecute(object paramObject) { if (IsExecuting) { return; } var args = new CancelCommandEventArgs { Parameter = paramObject, Cancel = false }; InvokeExecuting(args); if (args.Cancel) { return; } // We are executing. IsExecuting = true; CancelCommand.NotifyCanExecuteChanged(); _cts = new CancellationTokenSource(); _token = _cts.Token; await DoExecuteAsync(paramObject); }
private void ShowFadePopupCommandOnExecuting(object sender, CancelCommandEventArgs args) { var shell = ApexBroker.GetShell(); shell.PopupAnimationHelper = new FadeInOutPopupAnimationHelper(); shell.ShowPopup(new CustomisedPopup()); }
public virtual void DoExecute(object param) { // Вызывает выполнении команды с возможностью отмены CancelCommandEventArgs args = new CancelCommandEventArgs() { Parameter = param, Cancel = false }; InvokeExecuting(args); // Если событие было отменено - останавливаем. if (args.Cancel) { return; } // Вызываем действие с / без параметров, в зависимости от того. Какое было устанвленно. InvokeAction(param); // Call the executed function. InvokeExecuted(new CommandEventArgs() { Parameter = param }); }
/// <summary> /// The invoke executing. /// </summary> /// <param name="args"> /// The args. /// </param> private void InvokeExecuting(CancelCommandEventArgs args) { CancelCommandEventHandler executing = Executing; if (executing != null) { executing(this, args); } }
/// <summary> /// Handles the Executed event of the DealNewGameCommand control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="Apex.MVVM.CommandEventArgs"/> instance containing the event data.</param> void SpiderDealNewGameCommand_Executing(object sender, CancelCommandEventArgs args) { // If we've made any moves, update the stats. if (SpiderSolitaireViewModel.Moves > 0) { SpiderSolitaireStatistics.UpdateStatistics(SpiderSolitaireViewModel); } Save(); }
protected void InvokeExecuting(CancelCommandEventArgs args) { CancelCommandEventHandler executing = Executing; // Call the executed event. if (executing != null) { executing(this, args); } }
void OnFuncCommandExecuting(object sender, CancelCommandEventArgs args) { if (String.IsNullOrWhiteSpace(this.TextToSearch)) { App.ShowWarning("Нечего искать!"); args.Cancel = true; return; } args.Parameter = this; Status = "Ожидание данных ..."; State = State.Busy; }
/// <summary> /// Handles the Executing event of the FileSaveAsCommand control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="Apex.MVVM.CancelCommandEventArgs"/> instance containing the event data.</param> void FileSaveAsCommand_Executing(object sender, CancelCommandEventArgs args) { // Create a Save File Dialog. SaveFileDialog saveFileDialog = new SaveFileDialog(); // If the user cancels, end the command. if (saveFileDialog.ShowDialog() != true) { // Cancel the command. args.Cancel = true; return; } // Set the parameter to the path. args.Parameter = saveFileDialog.FileName; }
private void ToolStripMenuItem_Click(System.Object sender, System.EventArgs e) { Command cmd = GetCommandForInstance((ToolStripDropDownItem)sender); CancelCommandEventArgs args = new CancelCommandEventArgs(); args.Checked = cmd.Checked; args.Enabled = cmd.Enabled; args.Visible = cmd.Visible; if (this.CommandExecute != null) { this.CommandExecute(sender, args); } if (args.Cancel == false) { cmd.Enabled = args.Enabled; cmd.Checked = args.Checked; cmd.Visible = args.Visible; cmd.Execute(); } }
//Check private void ListView_DoubleClick(object sender, System.EventArgs e) { Command cmd = GetCommandForInstance((ListView)sender); CancelCommandEventArgs args = new CancelCommandEventArgs(); args.Checked = cmd.Checked; args.Enabled = cmd.Enabled; args.Visible = cmd.Visible; if (this.CommandExecute != null) { this.CommandExecute(sender, args); } if (args.Cancel == false) { cmd.Enabled = args.Enabled; cmd.Checked = args.Checked; cmd.Visible = args.Visible; cmd.Execute(); } }
// Execution event handler private void toolbar_ButtonClick(object sender, ToolBarButtonClickEventArgs e) { Command cmd = GetCommandForInstance(e.Button); CancelCommandEventArgs args = new CancelCommandEventArgs(); args.Checked = cmd.Checked; args.Enabled = cmd.Enabled; args.Visible = cmd.Visible; if (this.CommandExecute != null) { this.CommandExecute(sender, args); } if (args.Cancel == false) { cmd.Enabled = args.Enabled; cmd.Checked = args.Checked; cmd.Visible = args.Visible; cmd.Execute(); } }
private void TextBox_Event(object sender, System.EventArgs e) { Command cmd = GetCommandForInstance((ToolStripTextBox)sender); CancelCommandEventArgs args = new CancelCommandEventArgs(); args.Checked = cmd.Checked; args.Enabled = cmd.Enabled; args.Visible = cmd.Visible; if (this.CommandExecute != null) { this.CommandExecute(sender, args); } if (args.Cancel == false) { cmd.Enabled = args.Enabled; cmd.Checked = args.Checked; cmd.Visible = args.Visible; cmd.Execute(); } }
private void Check_CheckedChanged(System.Object sender, System.EventArgs e) { Command cmd = GetCommandForInstance((System.Windows.Forms.CheckBox)sender); CancelCommandEventArgs args = new CancelCommandEventArgs(); args.Checked = cmd.Checked; args.Enabled = cmd.Enabled; args.Visible = cmd.Visible; if (this.CommandExecute != null) { this.CommandExecute(sender, args); } if (args.Cancel == false) { cmd.Enabled = args.Enabled; cmd.Checked = args.Checked; cmd.Visible = args.Visible; cmd.Execute(); } }
void SaveCommand_Executing(object sender, CancelCommandEventArgs args) { var sglSerializer = new SharpGL.Serialization.SharpGL.SharpGLXmlFormat(); // Create an open file dialog. SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = sglSerializer.Filter; // Show the dialog. if (saveFileDialog.ShowDialog() != true) { // Cancel any loading. args.Cancel = true; return; } // Set the args. args.Parameter = saveFileDialog.FileName; }
/// <summary> /// Handles the Executing event of the LoadDataCommand control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="Apex.MVVM.CancelCommandEventArgs"/> instance containing the event data.</param> void LoadDataCommand_Executing(object sender, CancelCommandEventArgs args) { // Create an open file dialog. OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = SerializationEngine.Instance.Filter; // Show the dialog. if (openFileDialog.ShowDialog() != true) { // Cancel any loading. args.Cancel = true; return; } // Load the scene. Scene scene = SerializationEngine.Instance.LoadScene(openFileDialog.FileName); // Set the args. args.Parameter = scene; }
private void input_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { Command cmd = GetCommandForInstance((ToolStripTextBox)sender); CancelCommandEventArgs args = new CancelCommandEventArgs(); args.Checked = cmd.Checked; args.Enabled = cmd.Enabled; args.Visible = cmd.Visible; if (this.CommandExecute != null) { this.CommandExecute(sender, args); } if (args.Cancel == false) { cmd.Enabled = args.Enabled; cmd.Checked = args.Checked; cmd.Visible = args.Visible; cmd.Execute(); } } }
private void OnExportContentCommandExecuting(object sender, CancelCommandEventArgs args) { Shared.IWaitableObject parent = null; Control control = this; while (control != null && control.DataContext != null && !(control.DataContext is Shared.IWaitableObject)) { parent = control.DataContext as Shared.IWaitableObject; control = control.Parent as Control; } if (control != null) { parent = control.DataContext as Shared.IWaitableObject; } else { return; } if (parent != null) { parent.State = Shared.State.Busy; } }
protected virtual void OnCommandPreExecute(object sender, CancelCommandEventArgs e) { if (PreExecute != null) PreExecute(sender, e); }
/// <summary> /// Handles the Executing event of the FileExitCommand control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="Apex.MVVM.CancelCommandEventArgs"/> instance containing the event data.</param> void FileExitCommand_Executing(object sender, CancelCommandEventArgs args) { // Close the application. Close(); }
void DeleteContactCommand_Executing(object sender, CancelCommandEventArgs args) { args.Cancel = MessageBox.Show("Are you sure?", "Sure?", MessageBoxButton.YesNoCancel) != MessageBoxResult.Yes; }
void OnFuncCommandExecuting(object sender, CancelCommandEventArgs args) { args.Parameter = this; Status = "Ожидание данных ..."; State = State.Busy; }
protected void InvokeExecuting(CancelCommandEventArgs args) { Executing?.Invoke(this, args); }