private void NextButton_Click(object sender, RoutedEventArgs e) { switch (CurrentState) { case UIVisibilityState.OnlyVoice: for (int i = 0; i < SentenceGrid.Children.Count; i += 2) { SentenceGrid.Children[i].Visibility = Visibility.Visible; } ruleLabel1.Visibility = Visibility.Hidden; ruleLabel2.Visibility = Visibility.Hidden; ruleTextBlock1.Visibility = Visibility.Visible; wordLabel.Visibility = Visibility.Visible; phoneticSymbolLabel.Visibility = Visibility.Visible; CurrentState = UIVisibilityState.VoiceAndEng; break; case UIVisibilityState.VoiceAndEng: for (int i = 1; i < SentenceGrid.Children.Count; i += 2) { SentenceGrid.Children[i].Visibility = Visibility.Visible; } ruleTextBlock1.Visibility = Visibility.Hidden; NextButton.IsEnabled = false; NextButton.Visibility = Visibility.Hidden; UnfamiliarButton.IsEnabled = true; MediumButton.IsEnabled = true; FamiliarButton.IsEnabled = true; chiMeanScrollViewer.Visibility = Visibility.Visible; CurrentState = UIVisibilityState.All; break; default: MessageBox.Show("Error in CurrentState"); break; } }
private void ChangeWeight(Button bt) { switch (bt.Name) { case "UnfamiliarButton": DataBase.weightIncrease(wordLabel.Content.ToString()); break; case "MediumButton": break; case "FamiliarButton": DataBase.weightDecrease(wordLabel.Content.ToString()); break; default: MessageBox.Show("Error in ChangeWeight"); break; } #region UI控制 //按完後進到下一題 CurrentState = UIVisibilityState.OnlyVoice; UnfamiliarButton.IsEnabled = false; MediumButton.IsEnabled = false; FamiliarButton.IsEnabled = false; NextButton.IsEnabled = true; NextButton.Visibility = Visibility.Visible; ruleLabel1.Visibility = Visibility.Visible; ruleLabel2.Visibility = Visibility.Visible; wordLabel.Visibility = Visibility.Hidden; phoneticSymbolLabel.Visibility = Visibility.Hidden; chiMeanScrollViewer.Visibility = Visibility.Hidden; SentenceGrid.RowDefinitions.Clear(); SentenceGrid.Children.Clear(); #endregion setTest(); }