Пример #1
0
 private void Restore_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     if (e.Parameter is ExpenseCategoryViewModelEx category)
     {
         e.CanExecute = category.IsHidden;
     }
 }
Пример #2
0
 private void Cmd_DeleteAnniversary_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     if (mainViewModel?.SelectedAnniversary != null)
     {
         e.CanExecute = true;
     }
 }
Пример #3
0
        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);
        }
Пример #4
0
 private void Cmd_AddAnniversary_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(NewAnniversary.Text))
     {
         e.CanExecute = true;
     }
 }
Пример #5
0
 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;
     }
 }
Пример #9
0
 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
 }
Пример #10
0
        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;
     }
 }
Пример #14
0
 private void CommandBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     if (this.Visibility == Visibility.Hidden)
     {
         e.CanExecute = false;
     }
     else
     {
         e.CanExecute = true;
     }
 }
Пример #15
0
        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);
        }
Пример #16
0
 private void CommandBinding_CanExecute_DoQuery(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(txtOdrerCode.Text))
     {
         e.CanExecute = true;
     }
     else
     {
         e.CanExecute = false;
     }
 }
Пример #17
0
        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;
            }
        }
Пример #18
0
 /// <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("粘贴失败!", "提示");
     }
 }
Пример #19
0
        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;
        }
Пример #20
0
 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));
     }
 }
Пример #21
0
 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;
     }
 }
Пример #22
0
        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;
            }
        }
Пример #23
0
        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);
        }
Пример #24
0
        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);
        }
Пример #25
0
 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;
         }
     }
 }
Пример #26
0
        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;
 }
Пример #28
0
 private void CommandBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     e.CanExecute = false;
 }
Пример #29
0
 private void ApplyBinding_CanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     e.CanExecute = PropertiesBinding.SourceNotEqualsTarget(propertiesBinding);
 }
Пример #30
0
 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);
 }
Пример #31
0
 private void PrintCanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
 {
     e.CanExecute = _saleConfirmationModel != null && _saleConfirmationModel.AmountPaid != 0;
 }