protected override void OnNavigatedTo(NavigationEventArgs e) { // getting values from object, which was passed during navigation to this page gameData gData = (gameData)e.Parameter; plrName = gData.playerName; difficulty = gData.gameMode; // Notice about player and game Difficulty at the bottom-right area of the screen nameBlock.Text = plrName + " is now playing"; modeBlock.Text = gData.gameMode + " level"; }
private async void playBtn_Click(object sender, RoutedEventArgs e) { if (nameBox.Text == "") // validation. If name is empty, user will get error popup { // Popup notice MessageDialog validControl = new MessageDialog("Please type your name", "Error"); await validControl.ShowAsync(); } else // If username is OK, user will be redirected to new game { gameData gData = new gameData() { playerName = nameBox.Text, gameMode = modeCombo.SelectionBoxItem.ToString() }; Frame.Navigate(typeof(gameField), gData); // passing name of player and game difficulty mode } }