private void OnPopupOpened(object sender, object e) { /*var element = actionsHost.Items[0] as Control; * element?.Focus(FocusState.Programmatic);*/ opened.Invoke(this, EventArgs.Empty); }
/// <summary> /// Defines the method to be called when the command is invoked. /// </summary> /// <param name="value">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param> public void Execute(object value) { using (var token = access.AccquireUpgradeableReaderLock()) { if (false == CanExecute(value)) { return; } executeChanged.Invoke(this, EventArgs.Empty); using (token.Upgrade()) { if (IsExecuting) { return; } try { IsExecuting = true; cts = new CancellationTokenSource(); Task.Factory.StartNew(DoExecute, value, cts.Token).RunAndForget(); } catch (Exception) { IsExecuting = false; complete.Invoke(this, new CommandCompleteEventArgs(CompleteStatus.Failed)); } } } }
private bool TryInvokeEventHandler(object sender, TEventArgs args) { if (_weakEventHandler.TryGetTarget(out var target)) { _weakEventHandler.Invoke(target, sender, args); return(true); } return(false); }
protected override bool TryInvokeEventHandler(object sender, PropertyChangedEventArgs e) { if (sender == null) { throw new ArgumentNullException(nameof(sender)); } if (e == null) { throw new ArgumentNullException(nameof(e)); } if (_weakEventHandler.TryGetTarget(out var target)) { _weakEventHandler.Invoke(target, sender, e); return(true); } return(false); }
private protected virtual bool TryInvokeEventHandler([NotNull] object sender, [NotNull] TEventArgs e) { if (sender == null) { throw new ArgumentNullException(nameof(sender)); } if (e == null) { throw new ArgumentNullException(nameof(e)); } if (_weakEventHandler.NotNull().TryGetTarget(out var target)) { _weakEventHandler.Invoke(target, sender, e); return(true); } return(false); }
private void OnActionDispatcherExecuteAction(ActionDispatcher sender, DispatcherActionExecuteEventArgs e) { if (sender != ActionDispatcher) { return; } var wellKnownActions = Enum.GetValues(typeof(WellKnownActions)); foreach (WellKnownActions action in wellKnownActions) { var knownAction = ActionDispatcher.GetKnownAction(action); if (e.Action == knownAction) { Close(); } } executeAction.Invoke(this, new DialogActionExecuteEventArgs(e.Payload as IDialogAction)); }
private void DoResourcesChanged() { resourcesChanged.Invoke(this, EventArgs.Empty); }
private void OnIsEnabledChanged() { canExecuteChanged.Invoke(this, EventArgs.Empty); }
protected void DoRaiseEvent(InteractionRequestedEventArgs e) { raised.Invoke(this, e); }
private void OnPopupClosed(object sender, object e) { closed.Invoke(this, EventArgs.Empty); }