/// <summary> /// 关闭中行为 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnWindowClosing(object sender, System.ComponentModel.CancelEventArgs e) { if (ClosingCommand != null) { e.Cancel = !ClosingCommand.CanExecute(null); } }
public WindowEventViewModel() { LoadedCommand.Subscribe(Loaded); ClosingCommand.Subscribe(Closing); ClosedCommand.Subscribe(Closed); ActivatedCommand.Subscribe(Activated); ContentRenderedCommand.Subscribe(ContentRendered); }
private void PopupWindow_Closing(object sender, CancelEventArgs e) { Closing -= PopupWindow_Closing; if (ClosingCommand != null && ClosingCommand.CanExecute(null)) { ClosingCommand.Execute(null); } }
public MainWindowViewModel() { Game = new GameWindowViewModel(this); SelectedPuzzle = new SelectPuzzleViewModel(this); this.OpenRules = new OpenRulesCommand(); this.OpenPuzzleSelect = new OpenPuzzleSelectCommand(SelectedPuzzle); this.OpenStartGame = new OpenStartGameCommand(this); Exit = new ExitCommand(this); Closing = new ClosingCommand(this); }
public ViewAViewModel(IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; ShowMessageCommand.Subscribe(() => { NotificationRequest.Raise(new Notification { Title = "sample", Content = "new message" }); }); ClosingCommand.Subscribe(OnClosing); NavigateToViewBCommand.Subscribe(NavigateToViewB); Thread.Sleep(500); }
void OnClosing(object sender, CancelEventArgs e) { ClosingCommand.Do(x => x.Execute(e)); }
public PopupViewModel() { LoadedCommand.Subscribe(OnLoaded); ClosingCommand.Subscribe(OnClosing); }