示例#1
0
        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);
        }
示例#2
0
 private void SafelyExecute(System.Windows.Input.ICommand command)
 {
     if (command.CanExecute(null))
     {
         command.Execute(null);
     }
 }
示例#3
0
 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());
 }
示例#4
0
 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;
 }
示例#5
0
文件: MenuView.cs 项目: zjdgx/CodeHub
 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;
 }
示例#6
0
 /// <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);
         }
     }
 }
示例#7
0
            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);
                }
            }
示例#8
0
        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);
        }
示例#9
0
            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);
                }
            }
示例#10
0
        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);
                }
            }
        }
示例#11
0
            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);
                }
            }
示例#12
0
        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);
                    }
                }
            }
        }
示例#13
0
 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);
 }
示例#14
0
 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);
 }
示例#17
0
 void OnTapped()
 {
     _tapCommand?.Execute(null);
 }