示例#1
0
 private void LoadLibraries()
 {
     if (!librariesLoaded)
     {
         librariesLoaded = true;
         foreach (object library in mCctsRepository.GetAllLibraries())
         {
             if (library is ICcLibrary)
             {
                 mCcLibraries.Add(new CacheItemCcLibrary((ICcLibrary)library));
             }
             else if (library is IBdtLibrary)
             {
                 mBdtLibraries.Add(new CacheItemBdtLibrary((IBdtLibrary)library));
             }
             else if (library is IBieLibrary)
             {
                 mBieLibraries.Add(new CacheItemBieLibrary((IBieLibrary)library));
             }
             else if (library is ICdtLibrary)
             {
                 mCdtLibraries.Add(new CacheItemCdtLibrary((ICdtLibrary)library));
             }
             else if (library is IDocLibrary)
             {
                 mDocLibraries.Add(new CacheItemDocLibrary((IDocLibrary)library));
             }
         }
     }
 }
        private void MirrorLibsToUI()
        {
            var allLibraries = cctsR.GetAllLibraries();

            foreach (var library in allLibraries)
            {
                if (library is IDocLibrary)
                {
                    var actualLibrary = (IDocLibrary)library;
                    comboBoxSourceDocLibrary.Items.Add(actualLibrary.Name);
                    comboBoxTargetDocLibrary.Items.Add(actualLibrary.Name);
                }
                else if (library is IBieLibrary)
                {
                    var actualLibrary = (IBieLibrary)library;
                    comboBoxSourceBIELibrary.Items.Add(actualLibrary.Name);
                    comboBoxTargetBIELibrary.Items.Add(actualLibrary.Name);
                }
            }
        }
        public ProjectBrowserContent(ICctsRepository repo)
        {
            var map = new Hashtable();

            rootItem        = new ProjectBrowserItem();
            rootItem.Header = "Current Project";
            foreach (var bLib in repo.GetBLibraries())
            {
                var item = new ProjectBrowserItem();
                item.Header = bLib.Name + " <bLibrary>";
                item.Tag    = bLib;
                rootItem.Items.Add(item);
                map.Add(bLib, item);
            }
            foreach (var lib in repo.GetAllLibraries())
            {
                if (lib is IBdtLibrary)
                {
                    var temp = new ProjectBrowserItem();
                    var libr = (IBdtLibrary)lib;
                    temp.Header = libr.Name + " <BDTLibrary>";
                    temp.Tag    = libr;
                    ((ProjectBrowserItem)map[libr.BLibrary]).Items.Add(temp);
                }
                if (lib is IBieLibrary)
                {
                    var temp = new ProjectBrowserItem();
                    var libr = (IBieLibrary)lib;
                    temp.Header = libr.Name + " <BIELibrary>";
                    temp.Tag    = libr;
                    ((ProjectBrowserItem)map[libr.BLibrary]).Items.Add(temp);
                }
                if (lib is ICcLibrary)
                {
                    var temp = new ProjectBrowserItem();
                    var libr = (ICcLibrary)lib;
                    temp.Header = libr.Name + " <CCibrary>";
                    temp.Tag    = libr;
                    ((ProjectBrowserItem)map[libr.BLibrary]).Items.Add(temp);
                }
                if (lib is ICdtLibrary)
                {
                    var temp = new ProjectBrowserItem();
                    var libr = (ICdtLibrary)lib;
                    temp.Header = libr.Name + " <CDTLibrary>";
                    temp.Tag    = libr;
                    ((ProjectBrowserItem)map[libr.BLibrary]).Items.Add(temp);
                }
                if (lib is IDocLibrary)
                {
                    var temp = new ProjectBrowserItem();
                    var libr = (IDocLibrary)lib;
                    temp.Header = libr.Name + " <DOCLibrary>";
                    temp.Tag    = libr;
                    ((ProjectBrowserItem)map[libr.BLibrary]).Items.Add(temp);
                }
                if (lib is IEnumLibrary)
                {
                    var temp = new ProjectBrowserItem();
                    var libr = (IEnumLibrary)lib;
                    temp.Header = libr.Name + " <ENUMLibrary>";
                    temp.Tag    = libr;
                    ((ProjectBrowserItem)map[libr.BLibrary]).Items.Add(temp);
                }
                if (lib is IPrimLibrary)
                {
                    var temp = new ProjectBrowserItem();
                    var libr = (IPrimLibrary)lib;
                    temp.Header = libr.Name + " <PRIMLibrary>";
                    temp.Tag    = libr;
                    ((ProjectBrowserItem)map[libr.BLibrary]).Items.Add(temp);
                }
            }
        }