void ExecuteCommand()
 {
     if (CompletedCommand?.CanExecute(CommandParameter ?? this) ?? false)
     {
         CompletedCommand?.Execute(CommandParameter ?? this);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public AdvancedEntry()
        {
            this.Children.Add(lblTitle);
            this.Children.Add(lblAnnotation);
            this.Children.Add(frmBackground);
            frmBackground.Content = new Grid
            {
                Children =
                {
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            imgIcon,
                            txtInput
                        }
                    },
                    imgWarning
                }
            };

            txtInput.TextChanged += TxtInput_TextChanged;
            txtInput.Completed   += (s, args) => { CompletedCommand?.Execute(s); Completed?.Invoke(this, new EventArgs()); FocusNext(); };
            imgWarning.IsVisible  = this.IsRequired;
        }
Ejemplo n.º 3
0
        void Bindable_Completed(object sender, EventArgs e)
        {
            var entry = sender as Entry;

            Device.BeginInvokeOnMainThread(() =>
            {
                CompletedCommand?.Execute(entry.Text);
            });
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Sends the completed.
 /// </summary>
 public void SendCompleted()
 {
     Completed?.Invoke(this, EventArgs.Empty);
     if (CompletedCommand != null)
     {
         if (CompletedCommand.CanExecute(null))
         {
             CompletedCommand.Execute(null);
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles firing off events and commands if necessary.
        /// </summary>
        /// <param name="pin">The current pin.</param>
        protected virtual void OnPinChanged(string pin)
        {
            if (string.IsNullOrEmpty(pin))
            {
                return;
            }

            if (pin.Length == Length)
            {
                var handler = PinCompleted;

                if (CompletedCommand != default(Command))
                {
                    if (CompletedCommand.CanExecute(pin))
                    {
                        CompletedCommand.Execute(pin);
                    }
                }

                handler?.Invoke(this, new PinCompletedEventArgs(pin));
            }
        }
Ejemplo n.º 6
0
 public void InvokeCompleted()
 {
     Completed?.Invoke(this, null);
     CompletedCommand?.Execute(null);
 }