public MainViewModel()
 {
     SayHelloCommand = DelegateCommandBuilder.NoParameter()
                       .OnExecute(() => SayHello())
                       .OnCanExecute(() => !string.IsNullOrWhiteSpace(Name))
                       .Observe(this, nameof(Name))
                       .Build();
 }
Exemple #2
0
        public PublisherViewModel(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;

            PublishCommand = DelegateCommandBuilder.NoParameter()
                             .OnExecute(() => Publish())
                             .OnCanExecute(() => !string.IsNullOrEmpty(Message))
                             .Observe(this, nameof(Message))
                             .Build();
        }
Exemple #3
0
        public MainViewModel(Company company)
        {
            _company = company;

            _validation           = new ValidationAdapter(OnErrorsChanged);
            _validation.Validator = SetupValidator();

            SaveCommand = DelegateCommandBuilder.NoParameter()
                          .OnExecute(() => Save())
                          .OnCanExecute(() => CanSave)
                          .Observe(this, nameof(CanSave))
                          .Build();
        }
Exemple #4
0
        public ShellViewModel(Func <TabViewModel> createTabViewModel)
        {
            if (createTabViewModel == null)
            {
                throw new ArgumentNullException(nameof(createTabViewModel));
            }

            _createTabViewModel = createTabViewModel;

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

            CloseTabCommand = DelegateCommandBuilder.WithParameter <TabViewModel>()
                              .OnExecute(item => DeactivateItem(item, true))
                              .Build();
        }
Exemple #5
0
        public ShellViewModel()
        {
            ExecuteCommand = DelegateCommandBuilder.NoParameter()
                             .OnExecute(() => OnExecute())
                             .Build();

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

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

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