Example #1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     this.NavigationService.Navigate(new NetworkedGamePage(
                                         UDPGameClient.JoinGame(
                                             userName,
                                             Window.GetWindow(this).ActualHeight,
                                             Window.GetWindow(this).ActualWidth
                                             )));
 }
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            if (txtBxUser.Text != "" && txtBxUser.Text != null)
            {
                string uName = txtBxUser.Text;
                double w     = App.Current.MainWindow.ActualWidth;
                double h     = App.Current.MainWindow.ActualHeight;
                Task <NetworkedGame> myTask = Task.Run(() => UDPGameClient.JoinGame(uName, w, h));
                myTask.ContinueWith((game) => StartGame(game.Result), TaskScheduler.FromCurrentSynchronizationContext());
            }

            else
            {
                MessageBox.Show("You must enter a username!");
            }
        }