public Command(ChainCommand f, object a0, object a1)
 {
     func = f;
     args = new object[2];
     args[0] = a0;
     args[1] = a1;
 }
Example #2
0
        public ChainCommandTest()
        {
            _console = new StringIOConsole();
            _command = new ChainCommand(_console);

            _storePath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
        }
 public Command(ChainCommand f, object a0, object a1, object a2)
 {
     func = f;
     args = new object[3];
     args[0] = a0;
     args[1] = a1;
     args[2] = a2;
 }
        public FileExplorerViewModel(string initialDirectory) : base(initialDirectory)
        {
            RootPath = new NotifyingProperty <string>(
                (oldS, newS) => { if (newS.Trim() != oldS)
                                  {
                                      SetPath(newS);
                                  }
                },
                initialDirectory
                );
            DragDropRootPath = new DragAndDropHandler(x => true, SetRootPathAndCaretIndex);
            SelectedItem     = new NotifyingProperty <FileSystemEntityViewModel>(x => {
                SelectedIndex = x == null ? -1 : GetItems(this).Select((e, i) => new { I = i, E = e }).First(z => z.E == x).I;
            });

            _refreshTimer.Interval = TimeSpan.FromMilliseconds(100);
            _refreshTimer.Tick    += _refreshTimer_Tick;

            InteractCommand = new ChainCommand(
                InteractCommand,
                x => {
                if (IsExpanded.Value)
                {
                    _refreshTimer.Start();
                }
                else
                {
                    _refreshTimer.Stop();
                }
            }
                );

            KeyPressHandler         = new KeyPressHandler(KeyPressed);
            PathBoxLostFocusCommand = new RelayCommand(x => PathBoxHasFocus.Value = false);

            PathBoxGotFocusCommand = new RelayCommand(x => {
                DeselectItem();
                PathBoxHasFocus.Value = true;
                if (_updatePathBoxCaretIndex)
                {
                    var arg = (RoutedEventArgs)x;
                    SetCaretIndex((TextBox)arg.Source);
                }
                _updatePathBoxCaretIndex = false;
            });

            PathBoxTextChangedCommand = new RelayCommand(
                x => {
                var arg = (TextChangedEventArgs)x;
                SetCaretIndex((TextBox)arg.Source);
            },
                x => _updatePathBoxCaretIndex
                );

            FavoriteSelectedCommand = new RelayCommand(
                x => SetRootPathAndCaretIndex((string)x)
                );
        }
 public Command(ChainCommand f, object a0, object a1, object a2, object a3)
 {
     func = f;
     args = new object[4];
     args[0] = a0;
     args[1] = a1;
     args[2] = a2;
     args[3] = a3;
 }
 public Command(ChainCommand f, object a0)
 {
     func = f;
     args = new object[1];
     args[0] = a0;
 }
 public Command(ChainCommand f)
 {
     func = f;
     args = null;
 }