private void SaveAs_Click(object sender, RoutedEventArgs e) { DialogProcessor dialogProcessor = new DialogProcessor(); FileStream fStream = (FileStream)dialogProcessor.CreateSaveAsDialog(); if (fStream != null) { if (dataRepo.WriteToXml(fStream)) { tbStatus.Text = "Файл сохранен"; } else { tbStatus.Text = "Ошибка сохранения файла"; } } }
private void OpenFile_Click(object sender, RoutedEventArgs e) { DialogProcessor dialogProcessor = new DialogProcessor(); FileStream fStream = (FileStream)dialogProcessor.CreateOpenFileDialog(); if (fStream != null) { if (dataRepo.ReadFromXml(fStream)) { tbStatus.Text = "Файл успешно открыт"; lvMatches.ItemsSource = dataRepo.MatchList; if (dataRepo.MatchList.Count > 0) { cbMatches.SelectedIndex = -1; cbMatches.IsEnabled = true; } } else { tbStatus.Text = "Ошибка открытия файла"; dataRepo.Clean(); } } }