Exemplo n.º 1
0
        private void LoadTvControllerData(ShortcutTreeviewController tvController, bool isShopShortcut)
        {
            List <TreeNode> cNodes = tvController.DbAccessor.ReadAllCataNodes(tvController.DbAccessor.Root.EntityId);

            foreach (var node in cNodes)
            {
                var cataEt       = node as ShortcutCatalogEntity;
                var tabItem      = this.CreateTabItem(this.tabMain, cataEt.Name, cataEt, true, isShopShortcut);
                var subCataNodes = tvController.DbAccessor.ReadAllCataNodes(cataEt.EntityId);
                if (subCataNodes.xCount() > 0)
                {
                    var tabControl = new TabControl();
                    this.CreateTabItem(tabControl, cataEt.Name + "*", cataEt, false, isShopShortcut);
                    foreach (var catNode in subCataNodes)
                    {
                        var subCataEt = catNode as ShortcutCatalogEntity;
                        this.CreateTabItem(tabControl, subCataEt.Name, subCataEt, false, isShopShortcut);
                    }
                    tabControl.SelectionChanged += this.tabMain_SelectionChanged;
                    tabItem.Content              = tabControl;
                }
            }
            this.tabMain.SelectionChanged -= this.tabMain_SelectionChanged;
            this.tabMain.SelectionChanged += this.tabMain_SelectionChanged;
            this.CreateTabItem(this.tabMain, this.ShortcutTitle(isShopShortcut), tvController.DbAccessor.Root as ShortcutCatalogEntity, true, isShopShortcut);
        }
Exemplo n.º 2
0
 private void InitPubTvController()
 {
     if (this._pubTvController == null)
     {
         this._pubTvController = new ShortcutTreeviewController(AccountHelper.GetPubDbAccount(this._seller), this._seller);
         this.tvPubSearch.Init(this._pubTvController, null, null, false, false, null, null, null);
     }
     this.LoadTvControllerData(this._pubTvController, true);
 }
Exemplo n.º 3
0
        private string FindParentNode(ShortcutTreeviewController tvController, TreeNode n, out string parentId)
        {
            var selfId = string.Empty;

            parentId = null;
            var ancestorList = tvController.DbAccessor.ReadAncestorList(n, true, false);

            if (ancestorList.Count > 0)
            {
                selfId = ancestorList[0].EntityId;
                if (ancestorList.Count > 1)
                {
                    parentId = ancestorList[1].EntityId;
                }
                else if (tvController.DbAccessor.ReadChildCatalogById(selfId).xCount() > 0)
                {
                    parentId = selfId;
                }
            }
            else
            {
                bool isRoot = false;
                if (n.EntityId != ((_prvTvController != null) ? _prvTvController.DbAccessor.Root.EntityId : null))
                {
                    isRoot = (n.EntityId == ((_pubTvController != null) ? _pubTvController.DbAccessor.Root.EntityId : null));
                }
                else
                {
                    isRoot = true;
                }
                if (isRoot)
                {
                    selfId = n.EntityId;
                }
            }
            return(selfId);
        }