void ExecuteCommand() { if (CompletedCommand?.CanExecute(CommandParameter ?? this) ?? false) { CompletedCommand?.Execute(CommandParameter ?? this); } }
/// <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; }
void Bindable_Completed(object sender, EventArgs e) { var entry = sender as Entry; Device.BeginInvokeOnMainThread(() => { CompletedCommand?.Execute(entry.Text); }); }
/// <summary> /// Sends the completed. /// </summary> public void SendCompleted() { Completed?.Invoke(this, EventArgs.Empty); if (CompletedCommand != null) { if (CompletedCommand.CanExecute(null)) { CompletedCommand.Execute(null); } } }
/// <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)); } }
public void InvokeCompleted() { Completed?.Invoke(this, null); CompletedCommand?.Execute(null); }