public MainViewModel() { SayHelloCommand = DelegateCommand.NoParameter() .OnExecute(() => SayHello()) .OnCanExecute(() => !string.IsNullOrWhiteSpace(Name)) .Observe(this, nameof(Name)) .Build(); }
public PublisherViewModel(IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; PublishCommand = DelegateCommand.NoParameter() .OnExecute(() => Publish()) .OnCanExecute(() => !string.IsNullOrEmpty(Message)) .Observe(this, nameof(Message)) .Build(); }
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(); }
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(); }
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(); }