private void GoBack(object sender, RoutedEventArgs e)
 {
     if (Application.Current.Windows.OfType<MainWindow>().Any(w => w.Name.Equals("PreferencesPane")))
     {
         Application.Current.Windows.OfType<MainWindow>().Single().Focus();
     }
     else
     {
         var preferencePanel = new MainWindow();
         preferencePanel.Show();
     }
     Close();
 }
 private void showPreferences()
 {
     if (Application.Current.Windows.OfType<MainWindow>().Any(w => w.Name.Equals("PreferencesPane")))
         {
                 Application.Current.Windows.OfType<MainWindow>().Single().Focus();
         }
         else
         {
             var preferencePanel = new MainWindow();
             preferencePanel.Show();
         }
     if (Application.Current.Windows.OfType<FileChooser>().Any(w => w.Name.Equals("FileChooserWindow")))
     {
         Application.Current.Windows.OfType<FileChooser>().Single().Close();
     }
 }