Пример #1
0
 public MainViewModel()
 {
     SayHelloCommand = DelegateCommand.NoParameter()
                       .OnExecute(() => SayHello())
                       .OnCanExecute(() => !string.IsNullOrWhiteSpace(Name))
                       .Observe(this, nameof(Name))
                       .Build();
 }
Пример #2
0
        public PublisherViewModel(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;

            PublishCommand = DelegateCommand.NoParameter()
                             .OnExecute(() => Publish())
                             .OnCanExecute(() => !string.IsNullOrEmpty(Message))
                             .Observe(this, nameof(Message))
                             .Build();
        }
Пример #3
0
        public MainViewModel(Company company)
        {
            _validation = new ValidationAdapter(OnErrorsChanged);
            _validation.Validators.Add(new DataAnnotationsValidator(GetType()));

            _company    = company;
            SaveCommand = DelegateCommand
                          .NoParameter()
                          .OnExecute(() => Save())
                          .OnCanExecute(() => CanSave)
                          .Observe(this, nameof(CanSave))
                          .Build();
        }
Пример #4
0
        public ShellViewModel(Func <TabViewModel> createTabViewModel)
        {
            if (createTabViewModel == null)
            {
                throw new ArgumentNullException(nameof(createTabViewModel));
            }

            _createTabViewModel = createTabViewModel;

            OpenTabCommand = DelegateCommand.NoParameter()
                             .OnExecute(() => OpenTab())
                             .Build();

            CloseTabCommand = DelegateCommand.WithParameter <TabViewModel>()
                              .OnExecute(item => DeactivateItem(item, true))
                              .Build();
        }
Пример #5
0
        public ShellViewModel()
        {
            ExecuteCommand = DelegateCommand
                             .NoParameter()
                             .OnExecute(() => OnExecute())
                             .Build();

            UIContextRunCommand = DelegateCommand
                                  .NoParameter()
                                  .OnExecute(() => OnUIContextRun())
                                  .Build();

            TaskRunCommand = DelegateCommand
                             .NoParameter()
                             .OnExecute(() => OnTaskRun())
                             .Build();

            AsyncCommand = DelegateCommand
                           .NoParameter()
                           .OnExecute(() => OnAsync())
                           .Build();
        }