public MainPage()
 {
     InitializeComponent();
     SearchPane.DataContext = App.ViewModel;
     TextToSpeech dummy = new TextToSpeech(null); // to initialise XNA framework
     this.Loaded += new RoutedEventHandler(MainPage_Loaded);
 }
 void PlayButton_Click(object sender, RoutedEventArgs e)
 {
     Button button = (Button)sender;
     DictionaryRecord record = ((ItemViewModel)button.DataContext).Record;
     TextToSpeech tts = new TextToSpeech(record);
     Settings settings = new Settings();
     if (!tts.Speak(settings.AudioQualitySetting))
     {
         App.ViewModel.UpdateNetworkStatus(false);
         MessageBox.Show("Sorry, Text-to-Speech is only available with a network connection.");
         return;
     }
 }
 void PlayButton_Click(object sender, RoutedEventArgs e)
 {
     Button button = (Button)sender;
     int i;
     int.TryParse(button.Tag.ToString(), out i);
     TextToSpeech tts = new TextToSpeech(d[i]);
     Settings settings = new Settings();
     if (!tts.Speak(settings.AudioQualitySetting))
     {
         App.ViewModel.UpdateNetworkStatus(false);
         MessageBox.Show("Sorry, Text-to-Speech is only available with a network connection.");
         return;
     }
 }