// Export all data menu item. private void MenuExportAllData_Click(object sender, RoutedEventArgs e) { var save = new Microsoft.Win32.SaveFileDialog(); if (save.ShowDialog() == true && ImportExport.OpenFileWrite(save.FileName)) { MainProject.ExportAllData(); ImportExport.CloseFileWrite(); } }
// Import data menu item. private void MenuImport_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Not implemented yet."); return; var load = new Microsoft.Win32.OpenFileDialog(); if (load.ShowDialog() == true && ImportExport.OpenFileRead(load.FileName)) { // MainProject.Import (); // [wip] ImportExport.CloseFileWrite(); } }
// Export selection menu item. private void MenuExportSelection_Click(object sender, RoutedEventArgs e) { List <int> selected; switch (ActiveView) { case View.Activities: selected = GetSelectedElements(ActivityItems); break; case View.Instances: selected = GetSelectedElements(InstanceItems); break; case View.Sessions: selected = GetSelectedElements(SessionItems); break; default: selected = new List <int> (); break; } if (selected.Count == 0) { return; } var save = new Microsoft.Win32.SaveFileDialog(); if (save.ShowDialog() == true && ImportExport.OpenFileWrite(save.FileName)) { switch (ActiveView) { case View.Activities: foreach (int item in selected) { MainProject.SelectActivity(ActivityItems [item].ID); MainProject.ExportData(DataType.Activity); } break; case View.Instances: foreach (int item in selected) { MainProject.SelectActivity(InstanceItems [item].ID); MainProject.ExportData(DataType.Activity); } break; case View.Sessions: foreach (int item in selected) { MainProject.SelectActivity(InstanceItems [item].ID); MainProject.ExportData(DataType.Activity); } break; default: break; } ImportExport.CloseFileWrite(); } }