public void CanExecuteEventArgsTest() { var args = new CanExecuteEventArgs(); Assert.IsNotNull(args); Assert.IsTrue(args.CanExecute); args = new CanExecuteEventArgs() { CanExecute = false, }; Assert.IsNotNull(args); Assert.IsFalse(args.CanExecute); }
protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); if (CanExecute.HasDelegate) { var ev = new CanExecuteEventArgs(); await CanExecute.InvokeAsync(ev); _canExecute = ev.Result; } else { _canExecute = true; } }
public void CanExecuteEventArgs_T_Test() { var args = new CanExecuteEventArgs <int>(13); Assert.IsNotNull(args); Assert.IsTrue(args.CanExecute); Assert.AreEqual(13, args.Parameter); args = new CanExecuteEventArgs <int>(42) { CanExecute = false, }; Assert.IsNotNull(args); Assert.IsFalse(args.CanExecute); Assert.AreEqual(42, args.Parameter); }
protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); if (CanExecute.HasDelegate) { var ev = new CanExecuteEventArgs(); await CanExecute.InvokeAsync(ev); _canExecute = ev.Result; } else { _canExecute = true; if (Screen != null) { var dws = Screen.GetDataWorkspace(); if (dws != null) { dws.SavedChanges += Dws_SavedChanges; } } } }
void canExecute(object sender, CanExecuteEventArgs e) { e.CanExecute = e.ActiveDocument != null; }
void canExecute(object sender, CanExecuteEventArgs e) { e.CanExecute = DynamoButtonEnabled && e.ActiveDocument != null; }
public void AddInCommandBinding_CanExecute(object sender, CanExecuteEventArgs e) { ExecuteEventHooks(EventType.AddInCommandBinding_CanExecute, sender, e, e.CommandId.Name); }
internal bool ReloadListCanExecute() { if (CanExecuteEvent != null) { var ea = new CanExecuteEventArgs(CanExecuteType.ReloadList, true); CanExecuteEvent(this, ea); if (ea.Result is bool) return (bool)ea.Result; } return true; }
private void CanLastPage(object sender, CanExecuteEventArgs e) { e.Cancel = ViewModel.CurrentPage == ViewModel.MaxPage; }
private void CanPreviousPage(object sender, CanExecuteEventArgs e) { e.Cancel = ViewModel.CurrentPage <= 1; }
private void CanFirstPage(object sender, CanExecuteEventArgs e) { e.Cancel = ViewModel.CurrentPage == 1; }
private void CanAdd(object sender, CanExecuteEventArgs e) { e.Cancel = !ViewModel.ViewBuilder.AllowedAdd; }