Exemplo n.º 1
0
        public void newscenario(EA.Repository Repository)
        {
            Form10 form = new Form10();
            form.ShowDialog();

            if (form.confirm == 1)
            {
                this.encours = false;

                int packageid = 0;
                int packscenarioid = 0;

                EA.Package pack0 = Repository.Models.GetAt(0);
                foreach (EA.Package package in pack0.Packages)
                {
                    foreach (EA.Package pack in package.Packages)
                    {
                        packageid = pack.PackageID;
                    }
                }
                pack0 = Repository.GetPackageByID(packageid);

                foreach (EA.Package packscenario in pack0.Packages)
                {
                    if (packscenario.Name == "Scenarios")
                        packscenarioid = packscenario.PackageID;
                }

                EA.Collection newscenario = Repository.GetPackageByID(packscenarioid).Elements;
                EA.Element scenario = newscenario.AddNew(form.Name.Text, "Use Case");
                scenario.Stereotype = "Scenario";
                scenario.Update();

                EA.Collection newscenarios = scenario.Scenarios;
                EA.Scenario sc = newscenarios.AddNew(form.Name.Text, "Basic Path");
                sc.Update();
                newscenarios.Refresh();

                newscenario.Refresh();

                Repository.OpenElementPropertyDlg(scenario.ElementID);
                
            }
            this.encours = true;
        }