private void moduleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (LoadedProject == null)
            {
                return;
            }

            NewModuleDialogue dialog = new NewModuleDialogue(ref ModuleDataSource);

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (LoadedProject.QueryNewModuleExists(dialog.ModuleName))
                {
                    DialogResult res = MessageBox.Show(string.Format("A module named \"{0}\" already exists. Continue?", dialog.ModuleName), "Module Already Exists", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (res == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }
                }

                //Generate GO
                try
                {
                    UProjectModule settings = null;

                    if (dialog.ShouldWriteToProjectFile)
                    {
                        settings = new UProjectModule()
                        {
                            Name                   = dialog.ModuleName,
                            LoadingPhase           = dialog.LoadPhase,
                            Type                   = dialog.Type,
                            AdditionalDependencies = dialog.GetAdditionalDependencies()
                        };
                    }

                    //Generate the new module with the provided settings
                    LoadedProject.GenerateNewModule(dialog.ModuleName, dialog.GetPublicDependencies(), dialog.GetPrivateDependencies(), settings);

                    //Reload and select the module with the matching name
                    reloadModules(dialog.ModuleName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error Generating Files", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 2
0
        private void moduleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (LoadedProject == null) return;

            NewModuleDialogue dialog = new NewModuleDialogue(ref ModuleDataSource);
            if ( dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK )
            {
                if (LoadedProject.QueryNewModuleExists(dialog.ModuleName))
                {
                    DialogResult res = MessageBox.Show(string.Format("A module named \"{0}\" already exists. Continue?", dialog.ModuleName), "Module Already Exists", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (res == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }
                }

                //Generate GO
                try
                {
                    UProjectModule settings = null;

                    if (dialog.ShouldWriteToProjectFile)
                    {
                        settings = new UProjectModule()
                        {
                            Name = dialog.ModuleName,
                            LoadingPhase = dialog.LoadPhase,
                            Type = dialog.Type,
                            AdditionalDependencies = dialog.GetAdditionalDependencies()
                        };
                    }

                    //Generate the new module with the provided settings
                    LoadedProject.GenerateNewModule(dialog.ModuleName, dialog.GetPublicDependencies(), dialog.GetPrivateDependencies(), settings);

                    //Reload and select the module with the matching name
                    reloadModules(dialog.ModuleName);

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error Generating Files", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }