示例#1
0
        public static bool OpenProject(FileInfo projectFile)
        {
            bool success = false;

            try
            {
                Project = GCDProject.Load(projectFile);
                Properties.Settings.Default.LastUsedProjectFolder = Path.GetDirectoryName(projectFile.FullName);
                Properties.Settings.Default.Save();
                success = true;
            }
            catch (Exception ex)
            {
                success = false;

                string msg = string.Format("Failed to open the GCD project file:\n\n{0}", projectFile.FullName);

                if (ex.Data.Contains("File Path"))
                {
                    msg += string.Format("\n\n{0}\n\n{1}", ex.Message, ex.Data["File Path"]);
                }

                if (ex.Data.Contains("Solution"))
                {
                    msg += string.Format("\n\n{0}", ex.Data["Solution"]);
                }

                MessageBox.Show(msg, Properties.Resources.ApplicationNameLong, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(success);
        }
示例#2
0
 public static void CreateProject(GCDProject project)
 {
     project.Save();
     Project = project;
 }