示例#1
0
        public MainFrame(string[] args)
        {
            _this = this;

            currentFileName = "Untitled";
            projectNeedSave = false;
            currentProject = new SetupProject();
            currentProject.InitializeDefaults();
            InitializeComponent();
            LoadRecentMenu();

            if (args.Length == 1)
                _openFileName = args[0];
        }
示例#2
0
        private void OnNewProject(object sender, EventArgs e)
        {
            if (projectNeedSave)
            {
                switch (MessageBox.Show("The current project has changed. Do you want to save it?",
                    "Save?", MessageBoxButtons.YesNoCancel))
                {
                    case DialogResult.OK:
                        OnSave(null, null);
                        // Fall troug
                        break;
                    case DialogResult.No:
                        break;
                    case DialogResult.Cancel:
                        return; // Do not create a new project
                }
            }

            currentFileName = "";
            currentProject = new SetupProject();
            currentProject.InitializeDefaults();
            BindData();
            SynchFeatures(true);
            ReloadMergeModuleList();
            ReloadWixModuleList();
            ReloadFileList();
        }
示例#3
0
        private void LoadFile(string path)
        {
            Cursor = System.Windows.Forms.Cursors.WaitCursor;
            currentFileName = path;
            try
            {
                Environment.CurrentDirectory = (Path.GetDirectoryName(currentFileName));
                currentProject.Clear();
                projectNeedSave = false;
                XmlSerializer serializer = new XmlSerializer(Type.GetType("WarSetup.SetupProject"));
                using (StreamReader file = new StreamReader(currentFileName))
                {
                    currentProject = (SetupProject)serializer.Deserialize(file);
                }

                // Previously the merge-modules were re-loaded each time the document was
                // loaded. We have to load the information from the modules if this is an
                // old warsetup file...
                foreach (MergeModule mm in currentProject.projectMergeModules)
                {
                    if ((null == mm.ModuleId) || ("" == mm.ModuleId))
                        mm.LoadInfo();
                }

                BindData();
                projectNeedSave = false;
                SynchFeatures(true);
                ReloadMergeModuleList();
                ReloadWixModuleList();
                currentProject.projectProperties.AddAllUiCulture();
                currentProject.projectProperties.RemoveUiCultureDuplicates();
                InitLicense();
                SetSelectedLicense();
                CurrentProject.ResolveMainFeature(false);
                CurrentProject.Virgin = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                Cursor = System.Windows.Forms.Cursors.Default;
            }
        }