void OnClosing(object sender, ClosingEventArgs e) { //! Do not change combo texts, , at least in Far 2.0.1345, //! it triggers autocomplete that prevents closing. if (e.Control == null) return; if (Type == 0) { int value; if (!int.TryParse(UIMatter.Text, out value) || value <= 0) { Far.Api.Message("Invalid line number", "Line"); UIDialog.Focused = UIMatter; e.Ignore = true; return; } if (UIScript.Text.TrimEnd().Length == 0) { Far.Api.Message("Script has to be defined", "Script"); UIDialog.Focused = UIScript; e.Ignore = true; return; } } // script: trim, file may not exist Script = UIScript.Text.TrimEnd(); // action: Action = null; string action = UIAction.Text.TrimEnd(); if (action.Length > 0) { try { Action = ScriptBlock.Create(action); } catch (RuntimeException ex) { Far.Api.Message(ex.Message, "Action"); UIDialog.Focused = UIAction; e.Ignore = true; return; } } }
void OnClosing(object sender, ClosingEventArgs e) { // allow the dialog to close if the form is closed if (_isClosed) return; // do not close if the form cannot cancel if (!CanCancel) { e.Ignore = true; return; } // abort if (_jobThread != null) Pfz.Threading.SafeAbort.Abort(_jobThread, 4000, 2000, 1000, true); // notify if (Canceled != null) Canceled(this, null); }
private void onDialogClosing(object sender, ClosingEventArgs e) { _bindingEngine.UpdateSource(EBingingMode.TwoWayOnClose); ((IDialog)sender).Closing -= onDialogClosing; }