Example #1
0
        private void OnPopupOpened(object sender, object e)
        {
            /*var element = actionsHost.Items[0] as Control;
             * element?.Focus(FocusState.Programmatic);*/

            opened.Invoke(this, EventArgs.Empty);
        }
Example #2
0
        /// <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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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));
        }
Example #7
0
 private void DoResourcesChanged()
 {
     resourcesChanged.Invoke(this, EventArgs.Empty);
 }
Example #8
0
 private void OnIsEnabledChanged()
 {
     canExecuteChanged.Invoke(this, EventArgs.Empty);
 }
Example #9
0
 protected void DoRaiseEvent(InteractionRequestedEventArgs e)
 {
     raised.Invoke(this, e);
 }
Example #10
0
 private void OnPopupClosed(object sender, object e)
 {
     closed.Invoke(this, EventArgs.Empty);
 }