private void Restore_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Parameter is ExpenseCategoryViewModelEx category) { e.CanExecute = category.IsHidden; } }
private void Cmd_DeleteAnniversary_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (mainViewModel?.SelectedAnniversary != null) { e.CanExecute = true; } }
public override void CanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { 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.GitCreate) { e.CanExecute = this.CanInitGit; return; } else if (e.Command == ViCommands.GitDiff || e.Command == ViCommands.GitCommit || e.Command == ViCommands.GitShowLog) { e.CanExecute = (this.GitManager != null && this.GitManager.HasCreated); return; } base.CanExecuteCommand(sender, e); }
private void Cmd_AddAnniversary_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (!string.IsNullOrEmpty(NewAnniversary.Text)) { e.CanExecute = true; } }
private void EditCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Parameter as item_inventory_detail != null) { e.CanExecute = true; } }
private void OnCanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Command == CustomCommands.SwapTextAndTranslation) { e.CanExecute = this.song.Song.HasTranslation; // swapping text and translation is only possible if the song has a translation } }
/// <summary> /// This method overrides the /// if (canExecute && HasRowValidationError) condition of the base method to allow /// ----entering edit mode when there is a pending validation error /// ---editing of other rows /// </summary> /// <param name="e"></param> 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) { e.CanExecute = true; e.Handled = true; } }
private void añadirNuevoButton_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (enlaceTextBox.Text.IndexOf(Properties.Settings.Default.EnlaceFilmAffinity) != -1 && tituloNuevaPeliTextBox.Text != "") { e.CanExecute = true; } }
partial void OnOkAddFilterRulesCanExecuteImplementation(System.Windows.Input.CanExecuteRoutedEventArgs e) { #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified e.CanExecute = (this.AddFilterRulesCommand != null) ? CommandHelper.CanExecuteCommand(this.AddFilterRulesCommand, null, this.AddFilterRulesCommandTarget) : false; #pragma warning restore IDE0075 }
private void CommandSave_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (!isLoaded) { return; } e.CanExecute = textboxInput.Text != ""; }
private void buscarButton_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { bool encontrado = false; if (enlaceTextBox.Text.IndexOf(Properties.Settings.Default.EnlaceFilmAffinity) != -1) { encontrado = true; } e.CanExecute = encontrado; }
private void actualizarButton_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { bool actualizar = false; if (_vm.PeliculaSeleccionada()) { actualizar = true; } e.CanExecute = actualizar; }
private void DeleteCommand_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (infoListbox != null && infoListbox.SelectedItem != null) { e.CanExecute = true; } else { e.CanExecute = false; } }
private void CommandBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (this.Visibility == Visibility.Hidden) { e.CanExecute = false; } else { e.CanExecute = true; } }
public override void CanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Command == ViCommands.AddNewItem || e.Command == ViCommands.AddExistingItem) { e.CanExecute = true; return; } base.CanExecuteCommand(sender, e); }
private void CommandBinding_CanExecute_DoQuery(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (!string.IsNullOrEmpty(txtOdrerCode.Text)) { e.CanExecute = true; } else { e.CanExecute = false; } }
private void CommandBinding_CanExecute_SubjectGoods(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { ManagementViewModel vm = this.DataContext as ManagementViewModel; decimal au = 0; decimal ag = 0; decimal pt = 0; decimal pd = 0; foreach (object child in LogicalTreeHelper.GetChildren(grid)) { TextBox element = child as TextBox; if (element != null) { if (Validation.GetHasError(element)) { e.CanExecute = false; return; } } } if (!isExcuteQueryed) { e.CanExecute = false; } else if (string.IsNullOrEmpty(txtAu.Text) && string.IsNullOrEmpty(txtAg.Text) && string.IsNullOrEmpty(txtPt.Text) && string.IsNullOrEmpty(txtPd.Text)) { e.CanExecute = false; } else if (!string.IsNullOrEmpty(txtAu.Text) && !decimal.TryParse(txtAu.Text.Trim(), out au)) { e.CanExecute = false; } else if (!string.IsNullOrEmpty(txtAg.Text) && !decimal.TryParse(txtAg.Text.Trim(), out ag)) { e.CanExecute = false; } else if (!string.IsNullOrEmpty(txtPt.Text) && !decimal.TryParse(txtPt.Text.Trim(), out pt)) { e.CanExecute = false; } else if (!string.IsNullOrEmpty(txtPd.Text) && !decimal.TryParse(txtPd.Text.Trim(), out pd)) { e.CanExecute = false; } else if (au < 0 || ag < 0 || pt < 0 || pd < 0) { e.CanExecute = false; } else { e.CanExecute = true; } }
/// <summary> /// 判断剪贴板数据是否为数字 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Paste_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { try { Convert.ToDouble(System.Windows.Clipboard.GetText()); } catch { e.Handled = true; MessageBox.Show("粘贴失败!", "提示"); } }
private void Cmd_CreateCalenderEvent_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (mainViewModel?.SelectedAnniversary == null) { return; } if (mainViewModel?.SelectedAnniversary.Date < DateTime.Now) { return; } e.CanExecute = true; }
private void CommandBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { //stop it from passing on e.Handled = true; if ((DataContext as ViewModels.MainWindowViewModel).HandleMenuCanExecuteEvent(sender, e)) { return; } if (((DataContext as ViewModels.MainWindowViewModel).ActiveContent as FrameworkElement)?.DataContext is IDecompileViewModel viewModel) { Container.Resolve <IEventAggregator>().GetEvent <MenuCanExecuteEvent>().Publish((viewModel.Guid, e)); } }
private void DeleteCommandBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Parameter as hr_family != null) { e.CanExecute = true; } if (e.Parameter as hr_talent_detail != null) { e.CanExecute = true; } if (e.Parameter as hr_education != null) { e.CanExecute = true; } }
void CanExecuteZoomOut(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { var isExecutable = false; var isProcessed = false; OnCanExecuteZoomOut(ref isExecutable, ref isProcessed); if (isProcessed) { e.CanExecute = isExecutable; } else { e.CanExecute = true; } }
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); }
public override void CanExecuteCommand(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { if (e.Command == ViCommands.AddExistingItem) { e.CanExecute = true; return; } else if (e.Command == ViCommands.Build || e.Command == ViCommands.Rebuild || e.Command == ViCommands.Clean) { this.CurrProject.CanExecuteCommand(sender, e); return; } else if (e.Command == ViCommands.IsActive) { e.CanExecute = !this.IsActive; return; } base.CanExecuteCommand(sender, e); }
public void HandleCanExecuteInheritanceTargetsList(object sender, CanExecuteRoutedEventArgs e) { CommandTargetParameters parameter = e.Parameter as CommandTargetParameters; if (parameter != null) { int index = parameter.Id - InheritanceMarginConstants.cmdidInheritanceTargetsList; if (index < Targets.Count) { e.CanExecute = true; parameter.Enabled = true; parameter.Visible = true; parameter.Pressed = false; parameter.Text = Targets[index].DisplayName; } else { e.CanExecute = false; parameter.Enabled = false; parameter.Visible = false; } } }
public void HandleCanExecuteInheritanceTargetsList(object sender, CanExecuteRoutedEventArgs e) { CommandTargetParameters parameter = e.Parameter as CommandTargetParameters; if (parameter != null) { int index = parameter.Id - InheritanceMarginConstants.cmdidInheritanceTargetsList; if (index < Targets.Count) { e.CanExecute = true; parameter.Enabled = true; parameter.Visible = true; parameter.Pressed = false; parameter.Text = Targets[index].DisplayName; } else { e.CanExecute = false; parameter.Enabled = false; parameter.Visible = false; } } }
private void OnStartFilter_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = true; }
private void CommandBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = false; }
private void ApplyBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = PropertiesBinding.SourceNotEqualsTarget(propertiesBinding); }
private void OnSave_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { //e.CanExecute = e.Parameter as string != null; e.CanExecute = !string.IsNullOrWhiteSpace(e.Parameter as string); }
private void PrintCanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) { e.CanExecute = _saleConfirmationModel != null && _saleConfirmationModel.AmountPaid != 0; }