private void CreateBdts()
 {
     foreach (var bdtSpec in bdtSpecs)
     {
         bdtLibrary.CreateBdt(bdtSpec);
     }
 }
예제 #2
0
        private void buttonGenerateBDT_Click(object sender, EventArgs e)
        {
            GatherUserInput();

            if ((cache.PathIsValid(CacheConstants.PATH_CDTs, new[] { selectedCDTLName, selectedCDTName })) &&
                (cache.PathIsValid(CacheConstants.PATH_BDTLs, new[] { selectedBDTLName })))
            {
                ICdt        cdt  = repository.GetCdtById(cache.CDTLs[selectedCDTLName].CDTs[selectedCDTName].Id);
                IBdtLibrary bdtl = repository.GetBdtLibraryById(cache.BDTLs[selectedBDTLName].Id);

                BdtSpec bdtSpec = BdtSpec.CloneCdt(cdt, textBDTName.Text);

                var sups = new List <BdtSupSpec>(bdtSpec.Sups);
                foreach (cSUP sup in cache.CDTLs[selectedCDTLName].CDTs[selectedCDTName].SUPs.Values)
                {
                    if (sup.State == CheckState.Unchecked)
                    {
                        var name = sup.Name;
                        sups.RemoveAll(s => s.Name == name);
                    }
                }
                bdtSpec.Sups = sups;

                IBdt newBDT = bdtl.CreateBdt(bdtSpec);

                cache.BDTLs[selectedBDTLName].BDTs.Add(newBDT.Name, new cBDT(newBDT.Name, newBDT.Id, newBDT.BasedOn.Id, CheckState.Unchecked));

                textBDTName.Text = "";
                textBDTName.Text = newBDT.Name;
            }
        }