/// <summary> /// constructor /// </summary> public MultiStartWindow() { InitializeComponent(); MultiMazeModel m = new MultiMazeModel(); int success = m.Connect(); if (success < 0) { ConnectionFailedWindow c = new ConnectionFailedWindow(); c.Show(); } if (success >= 0) { m.GetListOfGames(); myVM = new MultiViewModel(m); DataContext = myVM; GameInfo.btnStart.Click += BtnStart_Click; this.Show(); } }
/// <summary> /// Joins the game selected in the comboBox /// </summary> /// <param name="sender">This window</param> /// <param name="e">sd</param> private void JoinClicked(object sender, RoutedEventArgs e) { MultiMazeModel m = myVM.MyModel as MultiMazeModel; int success = m.Connect(); if (success < 0) { ConnectionFailedWindow c = new ConnectionFailedWindow(); c.Show(); } if (success >= 0) { GameInfo.btnStart.Click += BtnStart_Click; this.Show(); m.GetListOfGames(); m.StartGame("join"); MultiGame mg = new MultiGame(); mg.SetVM(myVM); mg.Show(); this.Close(); } }