public override void CanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Command == ViCommands.Link) { if (this.Parent is ViCPUInfo && !this.Linked) { e.CanExecute = true; } return; } else if (e.Command == ViCommands.Unlink) { if (this.Parent is ViCPUInfo && this.Linked) { e.CanExecute = true; } return; } else if (e.Command == ViCommands.Rename) { e.CanExecute = true; return; } base.CanExecuteCommand(sender, e); }
public void ActionCanExecute(object sender, CanExecuteRoutedEventArgs e) { try { bool CanExecute = false; if (IsShowBankAccNo == true) { CanExecute = Validation.GetHasError(txtFirstName) || Validation.GetHasError(txtMiddleName) || Validation.GetHasError(txtLastName) || Validation.GetHasError(txtAdd1) || Validation.GetHasError(txtAdd2) || Validation.GetHasError(txtPincode) || Validation.GetHasError(txtBankAccNo); } else { CanExecute = Validation.GetHasError(txtFirstName) || Validation.GetHasError(txtMiddleName) || Validation.GetHasError(txtLastName) || Validation.GetHasError(txtAdd1) || Validation.GetHasError(txtAdd2) || Validation.GetHasError(txtPincode); } e.CanExecute = !CanExecute; if(btnSearch.IsEnabled==true) btnSaveCustomer.IsEnabled = !CanExecute; } catch(Exception ex ) { ExceptionManager.Publish(ex); } }
/// <summary> /// Determine if the start button should be enabled /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StartGame_CanExecute(object sender, CanExecuteRoutedEventArgs e) { var playerSetupControls = StackPanel_Players.Children.OfType<PlayerSetup>(); List<string> usedNames = new List<string>(5); foreach (var playerSetupControl in playerSetupControls) { if (playerSetupControl.IsRequired && playerSetupControl.IsEmpty) { e.CanExecute = false; e.Handled = true; return; } else if (playerSetupControl.IsEmpty == false) { if (usedNames.Contains(playerSetupControl.PlayerName.ToUpper())) { e.CanExecute = false; e.Handled = true; return; } usedNames.Add(playerSetupControl.PlayerName.ToUpper()); } } e.CanExecute = true; e.Handled = true; }
private void Command_CanExecute_MoveInHistory(object sender, CanExecuteRoutedEventArgs args) { if (args.Parameter == null) return; if (int.Parse(args.Parameter.ToString()) == -1) { if (lbHistory.SelectedIndex == 0 || lbHistory.SelectedIndex == -1) { args.CanExecute = false; } else { args.CanExecute = true; } } else { if (lbHistory.SelectedIndex == lbHistory.Items.Count - 1) { args.CanExecute = false; } else { args.CanExecute = true; } } }
private void CanExecuteOpenComponentGraphCommand(object sender, CanExecuteRoutedEventArgs e) { if (OpenComponentGraphCommand != null) { e.CanExecute = OpenComponentGraphCommand.CanExecute(e.Parameter); } }
private void CanExecutePasteHandler(object sender, CanExecuteRoutedEventArgs e) { try { if (Clipboard.ContainsFileDropList()) { StringCollection fileDropList = Clipboard.GetFileDropList(); string path = fileDropList[0]; if (fileDropList.Count != 1 || !Enumerable.Contains<string>((IEnumerable<string>) this.supportedImageTypeExtensions, Path.GetExtension(path).ToLower())) return; e.CanExecute = true; e.Handled = true; } else { if (!Clipboard.ContainsImage() || Clipboard.ContainsText()) return; e.CanExecute = true; e.Handled = true; } } catch { e.CanExecute = true; e.Handled = false; } }
private void EditCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Parameter as purchase_tender_contact != null) { e.CanExecute = true; } }
private void CommandClearTrace_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (!string.IsNullOrEmpty(txtTrace.Text)) { e.CanExecute = true; } }
private void ResetDecoder_CanExecute(object sender, CanExecuteRoutedEventArgs e) { //e.CanExecute = // station != null && station.Connected && Decoder != null && // ((station.MainTrackActive && (NMRAProgramMode)cbProgramMode.SelectedValue == NMRAProgramMode.POM) || (NMRAProgramMode)cbProgramMode.SelectedValue != NMRAProgramMode.POM) // ; }
private void CanEditDocument(object sender, CanExecuteRoutedEventArgs e) { if (Editor != null && Editor.TextArea != null && Editor.TextArea.Selection != null) { e.CanExecute = !Editor.TextArea.Selection.IsEmpty; } }
private void CanExecuteAddControlCommand(object sender, CanExecuteRoutedEventArgs e) { //var type = GetType(e.Parameter); //e.CanExecute = type == null || _controls.All(c => c.Control.GetType() != type.Item1); e.CanExecute = true; }
private static void CanExecute(object sender, CanExecuteRoutedEventArgs e) { FrameworkElement senderElement = (sender as FrameworkElement); if (HelpProvider.GetHelpString(senderElement) != null) e.CanExecute = true; }
private void Refresh_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (_pageLoaded) { e.CanExecute = true; } }
private void CommandBinding_CanExecute_Cancel(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; e.CanExecute = true; //权限处理 e.CanExecute = vm.AccountAuthority.AllowRevocationOrder; }
private void CanCancelReplaceExecuteHandler(object sender, CanExecuteRoutedEventArgs e) { // Ideally, this would check to see that the order's state is one that could be cancel/replaced // but right now it doesn't. e.CanExecute = (lvOrders.Items.Count > 0) && (lvOrders.SelectedItem != null); e.Handled = true; }
private void ClearOutputCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (Model == null) return; e.CanExecute = Model.ExecutedScripts.Any(); }
void canExecute_Save(object sender, CanExecuteRoutedEventArgs e) { if (Surname.Text != "" && Name.Text != "" && Patronymic.Text != "" && Year.Text != "" && Male.Text != "") e.CanExecute = true; else e.CanExecute = false; }
private void CommandBinding_AddSentence_CanExecute(object sender, CanExecuteRoutedEventArgs e) { var page = this.Page; var sentence = this.Sentence; e.CanExecute = page > 0 && sentence > 0 && !this._facade.ContainsSentence(page, sentence); }
private void ApplicationUndoCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (lstHistory == null || lstHistory.Items.Count == 0) e.CanExecute = false; else e.CanExecute = true; }
private void CanExecuteStopCommand(object sender, CanExecuteRoutedEventArgs eventArgs) { var statusViewModel = (StatusViewModel)DataContext; bool canExecute = statusViewModel.CancelCommand.CanExecute(); eventArgs.CanExecute = canExecute; eventArgs.Handled = canExecute; }
void PrintCommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (MySQLHandler.ClassList.Default.Dt.Rows.Count == 0) e.CanExecute = false; else e.CanExecute = true; }
private void gl_editCmd_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (this.xCatNameTxt.Text == "") e.CanExecute = false; else e.CanExecute = true; }
private void SwitchToIdleModeCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (VM.InputMode == Controls.Problem.InputMode.Idle) e.CanExecute = false; else e.CanExecute = true; }
private void OpenInBrowser_CanExecute(object sender, CanExecuteRoutedEventArgs e) { var url = (string)e.Parameter; Uri uri; e.CanExecute = Uri.TryCreate(url, UriKind.Absolute, out uri) && (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps); e.Handled = true; }
protected override void OnCanExecuteBeginEdit(System.Windows.Input.CanExecuteRoutedEventArgs e) { bool hasCellValidationError = false; bool hasRowValidationError = false; BindingFlags bindingFlags = BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Instance; //Current cell PropertyInfo cellErrorInfo = this.GetType().BaseType.GetProperty("HasCellValidationError", bindingFlags); //Grid level PropertyInfo rowErrorInfo = this.GetType().BaseType.GetProperty("HasRowValidationError", bindingFlags); if (cellErrorInfo != null) { hasCellValidationError = (bool)cellErrorInfo.GetValue(this, null); } if (rowErrorInfo != null) { hasRowValidationError = (bool)rowErrorInfo.GetValue(this, null); } base.OnCanExecuteBeginEdit(e); if (!e.CanExecute && !hasCellValidationError && hasRowValidationError) { e.CanExecute = true; e.Handled = true; } }
private void CreateLinkFromSelectionCanExecute(object sender, CanExecuteRoutedEventArgs args) { RichTextBox wikiEditor = sender as RichTextBox; args.CanExecute = !wikiEditor.Selection.IsEmpty; args.ContinueRouting = false; args.Handled = true; }
private void Find_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (EditText1.IsEnabled) { e.CanExecute = true; } }
private static void CanExecuteSave(object sender, CanExecuteRoutedEventArgs e) { if (sender == null) throw new ArgumentNullException("sender"); var owner = sender as Example; e.CanExecute = owner != null && owner.diagram != null && owner.diagram.Items.Count > 0; }
private void pausethejob_CanExecute(object sender, CanExecuteRoutedEventArgs e) { var j = this.DataContext as Job; if (j != null && j.IsProcessing) { e.CanExecute = true; } }
//// The following 4 event handlers support the "CommandBindings" in the window. // These hook to the Undo and Redo commands. private void Undo_CanExecute(object sender, CanExecuteRoutedEventArgs e) { // Tell the UI whether Undo is available. var catalog = VM; if (catalog != null) e.CanExecute = UndoService.Current[catalog].CanUndo; }
/// <summary> /// Commands the undo can execute. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Windows.Input.CanExecuteRoutedEventArgs"/> instance containing the event data.</param> private void CommandUndoCanExecute(object sender, CanExecuteRoutedEventArgs e) { if (GlobalApplicationViewModel.GetApplicationViewModel.CurrentlyDisplayedFile != null) e.CanExecute = CommandHistoryDataGrid.SelectedItem == null ? GlobalApplicationViewModel.GetApplicationViewModel.CurrentlyDisplayedFile.CommandsApplied.HasUndoableCommand : ((CommandGeneric)CommandHistoryDataGrid.SelectedItem).Done; else e.CanExecute = false; }
private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (e.Command.Equals(ApplicationCommands.Find)) { e.CanExecute = !this.IsUpdateChecking; } }
private void CanAddBookItemExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = !String.IsNullOrWhiteSpace(uxAddBookTitle.Text) && !String.IsNullOrWhiteSpace(uxAddBookAuthor.Text); //&& !String.IsNullOrWhiteSpace(uxAddBookISBN.Text); e.Handled = true; }
private void RCUCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e) { var serTest = this.DataContext as SerialConnTest; bool canex = false; if (serTest != null) canex = !serTest.Busy; e.CanExecute = canex; }
private void CommandBinding_CanExecuteCutOrPaste(object sender, CanExecuteRoutedEventArgs e) { if (e.Command == ApplicationCommands.Cut || e.Command == ApplicationCommands.Paste) { e.CanExecute = false; e.Handled = true; } }
private void CommandBinding_CanExecute_RecordRealWeight(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; MarketOrderData selectedOrder = (e.OriginalSource as DataGridRow).DataContext as MarketOrderData; e.CanExecute = true; //权限处理e.CanExecute = vm.AccountAuthority.CheckManage&&(selectedOrder.OrderType==TRANSACTION_TYPE.Recovery); }
private void StopProject_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (Project.Project.Current == null) { e.CanExecute = false; return; } e.CanExecute = Project.Project.Current.Running; }
private void ExitCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { try { e.CanExecute = true; } catch (Exception ex) { App.HandleException(ex); } }
private void SaveAsWithFormattingCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { try { e.CanExecute = this.GetSelectedXPathDocumentContent() != null; } catch (Exception ex) { App.HandleException(ex); } }
private void AddCommandHandler_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (DataItemModel != null) { if (Validation.GetHasError(DataItem_X) == false && Validation.GetHasError(DataItem_Y) == false && Validation.GetHasError(DataItem_Value) == false) { e.CanExecute = true; return; } } e.CanExecute = false; }
private void CommandBinding_CanExecute_Warehousing(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; //e.CanExecute = vm.AccountAuthority.AllowWarehousingOrder; MarketOrderData selectedOrder = (e.OriginalSource as DataGridRow).DataContext as MarketOrderData; if (selectedOrder.AllowStore) { e.CanExecute = true; } //权限处理 e.CanExecute = vm.AccountAuthority.AllowWarehousingOrder; else { e.CanExecute = false; } }
public override void CanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Command == ViCommands.OpenLocalFolder || e.Command == ViCommands.AddNewItem) { e.CanExecute = true; return; } else if (e.Command == ViCommands.Build || e.Command == ViCommands.Rebuild || e.Command == ViCommands.Clean) { //e.CanExecute = this.CanBuild(); } base.CanExecuteCommand(sender, e); }
private void CommandBinding_CanExecute_Password(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { ValidationResult PbNewResult = rule.Validate(PbNew.Password, new System.Globalization.CultureInfo("en-US")); //Validation validation PbNew.ToolTip = PbNewResult.ErrorContent; if (!PbNewResult.IsValid) { PbNew.BorderBrush = Brushes.Red; } else { PbNew.BorderBrush = cbrush.BorderBrush; } ValidationResult PbNewConfirmResult = rule.Validate(PbNewConfirm.Password, new System.Globalization.CultureInfo("en-US")); PbNewConfirm.ToolTip = PbNewConfirmResult.ErrorContent; if (!PbNewConfirmResult.IsValid) { PbNewConfirm.BorderBrush = Brushes.Red; } else { PbNewConfirm.BorderBrush = cbrush.BorderBrush; } ValidationResult PbOldResult = rule.Validate(PbOld.Password, new System.Globalization.CultureInfo("en-US")); PbOld.ToolTip = PbOldResult.ErrorContent; if (!PbOldResult.IsValid) { PbOld.BorderBrush = Brushes.Red; } else { PbOld.BorderBrush = cbrush.BorderBrush; } e.CanExecute = !string.IsNullOrEmpty(PbOld.Password) && !string.IsNullOrEmpty(PbNew.Password) && !string.IsNullOrEmpty(PbNewConfirm.Password) && PbNew.Password == PbNewConfirm.Password && PbNew.Password.Length >= 6 && PbNew.Password.Length <= 16 && PbNewConfirm.Password.Length >= 6 && PbNewConfirm.Password.Length <= 16; }
public override void CanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Command == ViCommands.AddExistingItem) { e.CanExecute = true; return; } else if (e.Command == ApplicationCommands.Delete) { e.CanExecute = true; } else if (e.Command == ViCommands.Rename) { } base.CanExecuteCommand(sender, e); }
private void StartProject_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (Project.Project.Current == null) { e.CanExecute = false; return; } /*Item screen = Global.ProjectManager.Current.Screens.Get(Global.ProjectManager.Current.Config.StartupScreen); * if (screen == null) * { * e.CanExecute = false; * return; * }*/ if (Project.Project.Current.Running) { e.CanExecute = false; return; } e.CanExecute = true; }
public override void CanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Command == ViCommands.AddExistingItem) { e.CanExecute = true; return; } else if (e.Command == ApplicationCommands.Delete) { e.CanExecute = true; return; } else if (e.Command == ViCommands.Rename) { } else if (e.Command == ViCommands.Build || e.Command == ViCommands.Rebuild || e.Command == ViCommands.Clean) { if (this.TheFactory != null) { e.CanExecute = true; return; } } else if (e.Command == ViCommands.GitDiff) { if (this.TheSolution.GitManager != null) { e.CanExecute = true; } return; } base.CanExecuteCommand(sender, e); }
private void CommandSave_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = startDate.Text != "" && starttime.Text != ""; }
private void SelectAll_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = true; }
private void OnRequestNavigateForward(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.Handled = true; NavigationHelper.RequestPageForwardAction(); }
private void BackCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = _browsingHistoryManager.CanBack(); }
private void CollectCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = _pageTabControl.SelectedItem != null; }
private void CollectCommand_CanExecute1(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = _helpDocTreeView.HelpDocTree.SelectedItem != null; }
private void DeleteCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = _helpDocFavorite.CollectList.SelectedItems.Count == 1; }
private void OpenCommand_CanExecute1(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = _helpDocSearch.CollectList.SelectedItems.Count == 1; }
private void SaveCommandHandler_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = Collection.ChangedAfterSaving; }
private void Ok_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = IsLoaded && TypeComboBox.SelectedIndex > 0; }
private void DeleteCommandHandler_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = listBox_Main != null && listBox_Main.SelectedIndex >= 0; }
private void AddProduct_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = _noOfErrorsOnScreen == 0; e.Handled = true; }
private void OpenCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = true; }
private void SaveAsCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = tabControl1.SelectedIndex != -1; }