private void button2_Click(object sender, RoutedEventArgs e) { var loader = new CardLoader(); fullCardView.FrontSide = new CardView() { Card = loader.LoadFromFile("card.card") }; }
private void Window_Loaded(object sender, RoutedEventArgs e) { Closing += Close; if (File.Exists("last.card")) { var loader = new CardLoader(); Card = loader.LoadFromFile("last.card"); } else { Card = new Card(); } }
private void LoadCardFromFile(object sender, RoutedEventArgs e) { using (var dialog = new CommonOpenFileDialog()) { dialog.Filters.Add(new CommonFileDialogFilter("Card", "*.card")); dialog.DefaultExtension = "card"; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { var loader = new CardLoader(); try { Card = loader.LoadFromFile(dialog.FileName); } catch (IOException ex) { MessageBox.Show(ex.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } } } }