/// <summary> /// Initializes a new instance of the <see cref="MultiGame"/> class. /// </summary> /// <param name="vm">The vm.</param> public MultiGame(StartMultiGameViewModel vm) { InitializeComponent(); menuVm = vm; DataContext = menuVm; menuVm.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { if (e.PropertyName.Contains("VM_CloseSignal")) { this.Dispatcher.Invoke(() => { string message; Console.WriteLine(menuVm.VM_OtherCurrentPos); Console.WriteLine(menuVm.VM_GoalPos); if (menuVm.VM_OtherCurrentPos != menuVm.VM_GoalPos) { message = "Your partner refused a selfie! \n so he left the game.. "; } else { message = "you are a loser!!"; } MessageBox.Show(message, "notice", MessageBoxButton.OK); this.Close(); Application.Current.MainWindow.Show(); }); } }; }
/// <summary> /// Initializes a new instance of the <see cref="MultiMenu"/> class. /// </summary> public MultiMenu() { InitializeComponent(); setvm = new SettingsViewModel(new SettingsModel()); vm = new StartMultiGameViewModel(new MultiModel()); this.DataContext = setvm; this.waitingWin = new WaitingForPartner(); gamesList.DataContext = vm; }