public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e) { if (BaseElement.NextElement == null && (actionId == ImeAction.Done || actionId == ImeAction.Next)) { UIHelper.CloseSoftKeyboard(Control); if (BaseElement.Command != null && BaseElement.Command.CanExecute(null)) { System.Windows.Input.ICommand cmd = BaseElement.Command; cmd.Execute(null); } return(false); } if (actionId == ImeAction.Done || actionId == ImeAction.Next) { BaseElement.NextElement.Focus(); UIHelper.OpenSoftKeyboard(Control); return(true); } return(false); }
private void SafelyExecute(System.Windows.Input.ICommand command) { if (command.CanExecute(null)) { command.Execute(null); } }
public static IDisposable Execute <T>(this IObservable <T> observable, System.Windows.Input.ICommand command) { return(observable.Do(t => { if (command.CanExecute(t)) { command.Execute(t); } }).Subscribe()); }
public PinnedRepoElement(PinnedRepository pinnedRepo, System.Windows.Input.ICommand command) : base(pinnedRepo.Name, () => command.Execute(new RepositoryIdentifier(pinnedRepo.Owner, pinnedRepo.Name)), Octicon.Repo.ToImage(), GetActualImage(pinnedRepo)) { PinnedRepo = pinnedRepo; TintImage = pinnedRepo.ImageUri == null; }
public PinnedRepoElement(PinnedRepository pinnedRepo, System.Windows.Input.ICommand command) : base(pinnedRepo.Name, () => command.Execute(new RepositoryIdentifier { Owner = pinnedRepo.Owner, Name = pinnedRepo.Name }), Images.Repo, GetActualImage(pinnedRepo)) { PinnedRepo = pinnedRepo; TintImage = false; }
/// <summary> /// Коллбек события которое переводится в тип ICommand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void Lw_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (sender is UIElement element) { object param = GetDoubleClickCommandParameter(element); ICommand cmd = GetDoubleClickCommand(element); if (cmd.CanExecute(param)) { cmd.Execute(param); } } }
public override void Run() { var routedCommand = wpfCommand as System.Windows.Input.RoutedCommand; if (routedCommand != null) { var target = System.Windows.Input.FocusManager.GetFocusedElement(WorkbenchSingleton.MainWindow); routedCommand.Execute(this.Owner, target); } else { wpfCommand.Execute(this.Owner); } }
public bool Execute([NotNull] System.Windows.Input.ICommand command, [NotNull] object context) { Assert.ArgumentNotNull(command, nameof(command)); Assert.ArgumentNotNull(context, nameof(context)); if (!command.CanExecute(context)) { return(false); } AppHost.Usage.ReportCommand(command, context); command.Execute(context); return(true); }
public PinnedRepoElement(CodeHub.Core.Data.PinnedRepository pinnedRepo, System.Windows.Input.ICommand command) : base(pinnedRepo.Name, () => command.Execute(new RepositoryIdentifier(pinnedRepo.Owner, pinnedRepo.Name)), Octicon.Repo.ToImage()) { PinnedRepo = pinnedRepo; // BUG FIX: App keeps getting relocated so the URLs become off if (new [] { "repository.png", "repository_fork.png" }.Any(x => PinnedRepo.ImageUri.EndsWith(x, StringComparison.Ordinal))) { ImageUri = new Uri("http://codehub-app.com/assets/repository_icon.png"); } else { ImageUri = new Uri(PinnedRepo.ImageUri); } }
private static void DataDatePicker_DataDatePickerChanged(object sender, RoutedEventArgs e) { DataDatePicker.DataDatePickerEventArgs args = (DataDatePicker.DataDatePickerEventArgs)e; DataDatePicker picker = sender as DataDatePicker; if (picker != null) { ICommand changedCommand = picker.GetValue(ItemChangedCommandProperty) as ICommand; IDictionary <string, object> evArgs = args.ChangedValuesObjects; if (changedCommand != null) { changedCommand.Execute(evArgs); } } }
public PinnedRepoElement(PinnedRepository pinnedRepo, System.Windows.Input.ICommand command) : base(pinnedRepo.Name, () => command.Execute(new RepositoryIdentifier { Owner = pinnedRepo.Owner, Name = pinnedRepo.Name }), Images.Repo) { PinnedRepo = pinnedRepo; // BUG FIX: App keeps getting relocated so the URLs become off if (PinnedRepo.ImageUri.EndsWith("repository.png", StringComparison.Ordinal)) { Image = UIImage.FromFile("Images/repository.png"); } else if (PinnedRepo.ImageUri.EndsWith("repository_fork.png", StringComparison.Ordinal)) { Image = UIImage.FromFile("Images/repository_fork.png"); } else { ImageUri = new Uri(PinnedRepo.ImageUri); } }
private static void SelectedDate_Changed(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { DatePicker picker = sender as DatePicker; if (picker != null) { ICommand changedCommand = picker.GetValue(ItemChangedCommandProperty) as ICommand; if (changedCommand != null) { if (picker.SelectedDate != null) { IDictionary <string, object> valueDictionary = new Dictionary <string, object> { ["Field"] = ControlExt.GetDataSourcePath(picker), ["DataObject"] = ControlExt.GetDataSource(picker), ["ChangedValue"] = (DateTime)picker.SelectedDate, }; changedCommand.Execute(valueDictionary); } } } }
public PinnedRepoElement(CodeFramework.Core.Data.PinnedRepository pinnedRepo, System.Windows.Input.ICommand command) : base(pinnedRepo.Name, () => command.Execute(new RepositoryIdentifier { Owner = pinnedRepo.Owner, Name = pinnedRepo.Slug }), Images.RepoPlaceholder) { PinnedRepo = pinnedRepo; ImageUri = new System.Uri(PinnedRepo.ImageUri); }
public void NavigationListItem_OnConfirmClick(object sender, EventArgs args) { Click?.Execute(this); }
public void Execute(object parameter) => WrappedCommand.Execute(Parameter);
public void Execute(object parameter) { _winCommand.Execute(parameter); }
void OnTapped() { _tapCommand?.Execute(null); }