private void newProjectButton_Click(object sender, EventArgs e) { NewProjectDialog dialog = new NewProjectDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Settings.Instance.Projects.Add(dialog.newProject); Settings.Instance.Save(); SelectPage(OpenProject(dialog.newProject)); } }
private void loadProjectButton_Click(object sender, EventArgs e) { FolderSelectDialog folderDialog = new FolderSelectDialog(); folderDialog.Title = "Select the updates folder containing the appinfo.json file"; if (folderDialog.ShowDialog(this.Handle)) { string appInfoFile = Path.Combine(folderDialog.FileName, "appinfo.json"); if (!File.Exists(appInfoFile)) { MessageBox.Show("Could not load project folder: Folder does not contain appinfo.json", "Failed to load project", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AppInfo info = AppInfo.FromJson(File.ReadAllText(appInfoFile)); if (info == null) { MessageBox.Show("Could not load project folder: Invalid appinfo.json", "Failed to load project", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } UpdateInfo[] updates = LoadUpdates(folderDialog.FileName, info); NewProjectDialog dialog = new NewProjectDialog(); dialog.appIDTextBox.Text = info.appId; dialog.newProject.Updates = updates.ToList(); dialog.SetPublisher(typeof(LocalDiskPublisher)); //TODO: enable loading with different publisher types dialog.appIDTextBox.Enabled = false; dialog.publisherComboBox.Enabled = false; LocalDiskPublisherGUI gui = (LocalDiskPublisherGUI)dialog.publisherSettings.Controls[0]; gui.SetFolder(folderDialog.FileName); gui.SetFolderEditable(false); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Settings.Instance.Projects.Add(dialog.newProject); Settings.Instance.Save(); SelectPage(OpenProject(dialog.newProject)); } } }