public MainViewModel(IFileDialogService fileDialogService) { ShowFirstDetailsCommand = new SimpleRelayCommand(ExecuteShowFirstDetails, CanShowFirstDetails); ShowSecondDetailsCommand = new SimpleRelayCommand(ExecuteShowSecondDetails, CanShowSecondDetails); _firstDetails = new FirstDetailsViewModel(fileDialogService); _secondDetails = new SecondDetailsViewModel(); }
public void CanExecuteChanged_RemoveHandler_HandlerIsNotCalled() { SynchronizationContext.SetSynchronizationContext(new TestSynchronizationContext()); var commandExecuted = false; _canExecuteChangedRaised = false; var command = new SimpleRelayCommand(() => { // ReSharper disable once AccessToModifiedClosure Assert.False(commandExecuted); commandExecuted = true; }); command.CanExecuteChanged += CommandOnCanExecuteChanged; command.Execute(null); Assert.True(commandExecuted); Assert.True(_canExecuteChangedRaised); _canExecuteChangedRaised = false; commandExecuted = false; command.CanExecuteChanged -= CommandOnCanExecuteChanged; command.Execute(null); Assert.True(commandExecuted); Assert.False(_canExecuteChangedRaised); }
public AddCcuViewModel(IWindowManager windowManager) { OkCommand = new SimpleRelayCommand(() => windowManager.CloseDialog(this, true), () => !string.IsNullOrWhiteSpace(Address)); CancelCommand = new SimpleRelayCommand(() => windowManager.CloseDialog(this, false)); MruAddresses = new ExtendedObservableCollection <string>(); }
public TextEditDialogViewModel(string text, string caption, string title, Func<string, bool> validate) { _caption = caption; _title = title; _validate = validate; _text = text; OkCommand = new SimpleRelayCommand(Ok, CanOk); }
public RedViewModel(SimpleViewModel blueViewModel) { _blueViewModel = blueViewModel; _yellowViewModel = new YellowViewModel(this); GotoBackCommand = new SimpleRelayCommand(GotoBack); GotoBlueCommand = new SimpleRelayCommand(GotoBlue); GotoYellowCommand = new SimpleRelayCommand(GotoYellow); }
public TextEditDialogViewModel(string text, string caption, string title, Func <string, bool> validate) { _caption = caption; _title = title; _validate = validate; _text = text; OkCommand = new SimpleRelayCommand(Ok, CanOk); }
public MainViewModel(IFileDialogService fileDialogService) { if (fileDialogService == null) { throw new ArgumentNullException(nameof(fileDialogService)); } _fileDialogService = fileDialogService; OpenFileCommand = new SimpleRelayCommand(OpenFile); SaveFileCommand = new SimpleRelayCommand(SaveFile); }
public MainViewModel(ITextEditService textEditService) { if (textEditService == null) { throw new ArgumentNullException(nameof(textEditService)); } _textEditService = textEditService; EditTextCommand = new SimpleRelayCommand(EditText); }
public MainViewModel(IViewService viewService) { if (viewService == null) { throw new ArgumentNullException(nameof(viewService)); } _viewService = viewService; EditTextCommand = new SimpleRelayCommand(EditText); DisplayTextCommand = new SimpleRelayCommand(DisplayText); }
public MainViewModel(IMessageBoxService messageBoxService) { if (messageBoxService == null) { throw new ArgumentNullException(nameof(messageBoxService)); } _messageBoxService = messageBoxService; ShowMessageBoxCommand = new SimpleRelayCommand(ShowMessageBox); AskYesNoCommand = new SimpleRelayCommand(AskYesNo); }
public MainViewModel() { SelectFirstName = new SimpleRelayCommand(() => { IsLastNameFocused = false; IsFirstNameFocused = true; }); SelectLastName = new SimpleRelayCommand(() => { IsFirstNameFocused = false; IsLastNameFocused = true; }); }
public void Execute_CanExecuteIsFalse_ActionIsNotExecuted() { var commandExecuted = false; var command = new SimpleRelayCommand(() => { Assert.False(commandExecuted); commandExecuted = true; }, () => false); command.Execute(null); Assert.False(commandExecuted); }
public void Execute_Wait_ActionIsExecuted() { SynchronizationContext.SetSynchronizationContext(new TestSynchronizationContext()); var commandExecuted = false; var canExecuteChangedRaised = false; var command = new SimpleRelayCommand(() => { Assert.False(commandExecuted); commandExecuted = true; }); command.CanExecuteChanged += (_, _) => { Assert.False(canExecuteChangedRaised); canExecuteChangedRaised = true; }; command.Execute(null); Assert.True(commandExecuted); Assert.True(canExecuteChangedRaised); }
public RedViewModel() { _blueVM = new BlueViewModel(); GotoBlueCommand = new SimpleRelayCommand(GotoBlue); }
public BlueViewModel() { GotoRedCommand = new SimpleRelayCommand(GotoRed); GetMessageCommand = new SimpleRelayCommand(GetMessage); }
public EditTextViewModel() { OkCommand = new SimpleRelayCommand(Ok); }
public AddNoteViewModel() { SaveCommand = new SimpleRelayCommand(x => Save(this, new EventArgs())); CancelCommand = new SimpleRelayCommand(x => Cancel(this, new EventArgs())); }
public MainViewModel() { OkCommand = new SimpleRelayCommand(Ok); CancelCommand = new SimpleRelayCommand(Cancel); }
public AppViewModel() { HomeCommand = new SimpleRelayCommand(NavigateToHome); }
public FirstDetailsViewModel(IFileDialogService fileDialogService) { OpenFileDialogCommand = new SimpleRelayCommand(() => ExecuteOpenFileDialog(fileDialogService)); }
public YellowViewModel(SimpleViewModel redViewModel) { _redViewModel = redViewModel; GotoRedCommand = new SimpleRelayCommand(GotoRed); NavCommand = new SimpleRelayCommand <Type>(Nav); }