/// <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);
     }
 }
Пример #2
0
 public WindowEventViewModel()
 {
     LoadedCommand.Subscribe(Loaded);
     ClosingCommand.Subscribe(Closing);
     ClosedCommand.Subscribe(Closed);
     ActivatedCommand.Subscribe(Activated);
     ContentRenderedCommand.Subscribe(ContentRendered);
 }
Пример #3
0
 private void PopupWindow_Closing(object sender, CancelEventArgs e)
 {
     Closing -= PopupWindow_Closing;
     if (ClosingCommand != null && ClosingCommand.CanExecute(null))
     {
         ClosingCommand.Execute(null);
     }
 }
Пример #4
0
 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);
 }
Пример #5
0
 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);
 }
Пример #6
0
 void OnClosing(object sender, CancelEventArgs e)
 {
     ClosingCommand.Do(x => x.Execute(e));
 }
Пример #7
0
 public PopupViewModel()
 {
     LoadedCommand.Subscribe(OnLoaded);
     ClosingCommand.Subscribe(OnClosing);
 }