private void NewLocationDialog() { bool accepted = !string.IsNullOrWhiteSpace(s_relativeUrl); while (!accepted) { var window_relativeUrl = new Window_TextEntry("Image Relative Url", ""); window_relativeUrl.ShowDialog(); if (window_relativeUrl.Accepted) { accepted = true; s_relativeUrl = window_relativeUrl.Text; } } if (accepted) { Window_OpenFile window_openFile = new Window_OpenFile("Location File", string.Empty); window_openFile.Closed += (x, y) => { if (window_openFile.Accepted) { Window_TextEntry window_textEntry = new Window_TextEntry("Location Name", Path.GetFileNameWithoutExtension(window_openFile.FileName)); window_textEntry.Closed += (a, b) => { if (window_textEntry.Accepted) GinTubBuilderManager.CreateLocation(window_textEntry.Text, Path.Combine(s_relativeUrl, Path.GetFileName(window_openFile.FileName))); }; window_textEntry.Show(); } }; window_openFile.Show(); } }
private void MenuItem_ImportFromXml_Click(object sender, RoutedEventArgs e) { Window_Notification window_notification = new Window_Notification("Notice", "Importing from an .xml file will OVERWRITE all records currently in the database.\r\nThis action CANNOT be undone.\r\nContinue?"); window_notification.ShowDialog(); if(window_notification.Accepted) { string backupFile = null; window_notification = new Window_Notification("Notice", "Would you like to backup your database before the import?"); window_notification.ShowDialog(); if(window_notification.Accepted) { Window_SelectFile window_selectFile = new Window_SelectFile("Backup to ...", string.Empty); window_selectFile.ShowDialog(); if (window_selectFile.Accepted) backupFile = window_selectFile.FileName; } Window_OpenFile window_openFile = new Window_OpenFile("Import from ...", string.Empty); window_openFile.ShowDialog(); if (window_openFile.Accepted) GinTubBuilderManager.ImportFromXml(window_openFile.FileName, backupFile); } }