Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public static PdfProject Load(string path)
        {
            XmlSerializer xs = new XmlSerializer(typeof(PdfProject));

            using (Stream s = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                PdfProject pp = (PdfProject)xs.Deserialize(s);
                pp.Path = path;
                return(pp);
            }
        }
Ejemplo n.º 3
0
        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);
        }