private void Button_Click_1(object sender, RoutedEventArgs e) { DefaultDialogService service = new DefaultDialogService(); service.OpenFileDialog(); if (service.FilePath != null) { LoadTestData loadData = new LoadTestData(service.FilePath); UpdateListView(); } }
private void Button_Click(object sender, RoutedEventArgs e) { using (ApplicationContext context = new ApplicationContext()) { ApplicationViewModel appView = this.DataContext as ApplicationViewModel; var selecteduser = appView.SelectedUser; DefaultDialogService service = new DefaultDialogService(); service.SaveFileDialog(); if (service.FilePath == null) { return; } string extension = System.IO.Path.GetExtension(service.FilePath); if (extension == ".json") { //ApplicationViewModel appView = this.DataContext as ApplicationViewModel; //var selecteduser = appView.SelectedUser; if (selecteduser != null) { JsonSave save = new JsonSave(appView, selecteduser, service.FilePath); } } else if (extension == ".xml") { //ApplicationViewModel a = this.DataContext as ApplicationViewModel; //var selecteduser = a.SelectedUser; if (selecteduser != null) { XMLSave save = new XMLSave(selecteduser, service.FilePath); } } else if (extension == ".csv") { //ApplicationViewModel a = this.DataContext as ApplicationViewModel; //var selecteduser = a.SelectedUser; if (selecteduser != null) { CSVSave save = new CSVSave(selecteduser, service.FilePath); } } } }