private void PhoneticNotation_OnClick(object sender, RoutedEventArgs e) { try { Word[] words = new Word[InputText.Text.Length]; for (int i = 0; i != InputText.Text.Length; i++) { string kana = ""; string tone = ""; if (initialTable[PinYin.GetPinYin(InputText.Text[i])] != null) { foreach (string temp in initialTable[PinYin.GetPinYin(InputText.Text[i])].ToObject <string[]>()) { kana = kana + temp + " "; tone = PinYin.GetTone(InputText.Text[i]); } } words[i] = new Word { Tone = tone, Kana = kana, SourceText = InputText.Text[i].ToString() }; } WordItemsControl.ItemsSource = words; } catch (Exception ex) { MainWindow.ContentFrame.Navigate(new Crush_Page(ex)); } }