Esempio n. 1
0
        private protected void UnsubscribeCanExecuteCommand(NotificationReflectorModel model, string propertyName)
        {
            var guaranteedCommandName = model.GetKeyCommand(propertyName);

            _cmdProvider.RemoveCommand(guaranteedCommandName);

            model.CanExecuteCommandChanged -= _subscribersDictionary[guaranteedCommandName];

            _subscribersDictionary.Remove(guaranteedCommandName);
        }
Esempio n. 2
0
        private void SubscribeCanExecuteCommandInternal(NotificationReflectorModel model, string propertyName, ICommand command, Func <string, bool> raiseFunc)
        {
            var guaranteedCommandName = model.GetKeyCommand(propertyName);

            _cmdProvider.AddCommand(guaranteedCommandName, command);

            CommandChangedEventHandler handler = (objectSender, commandName) =>
            {
                var result = raiseFunc.Invoke(commandName);

                if (!result)
                {
                    raiseFunc.Invoke(guaranteedCommandName);
                }
            };

            model.CanExecuteCommandChanged += handler;

            _subscribersDictionary.Add(guaranteedCommandName, handler);
        }
 public static void RaiseCanExecuteCommandChanged(this NotificationReflectorModel @this, in string propertyIndex)
Esempio n. 4
0
        private protected void SubscribeCanExecuteCommand <TAny>(NotificationReflectorModel model, string propertyName, ICommand command)
        {
            bool raiseFunc(string cmdName) => _cmdProvider.RaiseRelayGenericCommand <TAny>(cmdName);

            this.SubscribeCanExecuteCommandInternal(model, propertyName, command, raiseFunc);
        }