private void LoadProject(string path) { if (this.PendingChanges) { switch (MessageBox.Show("Save Pending Changes?", "Load Project", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)) { case DialogResult.Yes: this.SaveProject(false); break; case DialogResult.No: break; case DialogResult.Cancel: return; } } try { this.Project = PdfProject.Load(path); Settings.AddRecentProjecy(path); this.PrepareRecentProjectItems(); } catch (Exception e2) { MessageBox.Show(e2.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ProjectForm pf = new ProjectForm(); pf.Project = PdfProject.BlankProject; if (args.Length > 0) { try { pf.Project = PdfProject.Load(args[0]); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } Application.Run(pf); }