// Set the project status marker to not loaded, show error message. private void ProjectFailedLoading(object sender, LoadFailEventArgs e) { Status = ProjectLoadStatus.NotLoaded; string message; switch (e.LoadFailType) { case ProjectLoadException.Type.ProjectFileNotAccessible: message = "The project could not be opened. It may be in use by another program."; break; case ProjectLoadException.Type.RomFileNotSpecified: message = "The project file does not specify a ROM file."; break; case ProjectLoadException.Type.RomFileNotFound: message = "The ROM associated with the project could not be found." + "Make sure that the following file exists:" + Environment.NewLine + MainProject.ProjectPath + MainProject.RomFileName; break; case ProjectLoadException.Type.RomFileNotAccessible: message = "Unknown load error"; break; default: message = "Unknown load error"; break; } MessageBox.Show(message); }
//======================================================================================== // Event handlers private void NewProject_Click(object sender, RoutedEventArgs e) { var window = new UI.NewProjectWindow(MainProject); window.Owner = Window.GetWindow(this); if (window.ShowDialog() == true) { Status = ProjectLoadStatus.Loading; Task.Run(() => MainProject.Load(window.TemplateFileName)); WaitProjectLoaded(window.ProjectPath, window.ProjectFileName, window.RomFileName); } }
private void OpenProject_Click(object sender, RoutedEventArgs e) { var Open = new Microsoft.Win32.OpenFileDialog() { Filter = "Project files (*.sm3p)|*.sm3p" // InitialDirectory = Directory.GetCurrentDirectory () }; if (Open.ShowDialog(Window.GetWindow(this)) ?? false) { Status = ProjectLoadStatus.Loading; Task.Run(() => MainProject.Load(Open.FileName)); WaitProjectLoaded(null, null, null); } }
// Set the project status marker to loaded. private void ProjectFinishedLoading(object sender, EventArgs e) { Status = ProjectLoadStatus.Loaded; }