コード例 #1
0
        public void LoadChildren(ObservableCollection <IIMenuItem> lst, int _menuId)
        {
            ChildTreeItems.Clear();

            if (_menuId <= MenuIdControlAssign.MenuFileGroupIdMin) //File)
            {
                return;
            }

            foreach (var t in lst)
            {
                if (t.Id >= MenuIdControlAssign.MenuFileGroupIdMin)  //File)
                //menu id
                {
                    if (t.Visibility != Visibility.Visible)
                    {
                        continue;
                    }
                    var tmp = new ShortCutTreeItemViewModel(this, t.Id, 0)
                    {
                        Name = t.Text
                    };
                    tmp.LoadChildren(t.CmItems, t.Id);
                    if (tmp.ChildTreeItems.Count > 0)
                    {
                        ChildTreeItems.Add(tmp);
                    }
                }
                else
                {
                    if (t.Visibility != Visibility.Visible)
                    {
                        continue;
                    }
                    ChildTreeItems.Add(new ShortCutTreeItemViewModel(this, this.InstanceId, t.Id)
                    {
                        Name = t.Text
                    });
                }
            }
        }
コード例 #2
0
        private void LoadChildren()
        {
            //ChildTreeItems.Clear();

            //var t =
            //    ServerInstanceRoot.GetInstanceByKey(
            //        MainMenuDefine.MainMenuKey);


            //if (t == null) return;
            //string name = t.Name;
            //ChildTreeItems.Add(new ShortCutTreeItemViewModel(null, t.Id , 0)
            //                       {
            //                           Name = name
            //                       });
            //foreach (var f in this.ChildTreeItems) f.LoadChildren();



            ChildTreeItems.Clear();
            var fff = MenuBuilding.BulidCm(MainMenuDefine.MainMenuKey, true, null);

            foreach (var g in fff)
            {
                if (g.Visibility != Visibility.Visible)
                {
                    continue;
                }
                var tmp = new ShortCutTreeItemViewModel(null, g.Id, 0)
                {
                    Name = g.Text
                };
                tmp.LoadChildren(g.CmItems, g.Id);
                if (tmp.ChildTreeItems.Count > 0)
                {
                    ChildTreeItems.Add(tmp);
                }
            }


            //    public  ObservableCollection<IIMenuItem> IimenuItems=new ObservableCollection<IIMenuItem>( );

            //private void ResetM()
            //{
            //    Items.Clear();
            //    IimenuItems.Clear();
            //    var fff = MenuBuilding.BulidCm(MainMenuDefine.MainMenuKey, true, null);
            //    //this.HelpCmm(fff);
            //    this.Helpcmmm(fff);
            //    this.RaisePropertyChanged(() => this.Items);
            //}

            //protected void Helpcmmm(ObservableCollection<IIMenuItem> t)
            //{
            //    var fs = MenuBuilding.HelpCmm(t,true );
            //    Items.Clear();
            //    foreach (var g in fs)
            //    {
            //        Items.Add(g);
            //    }
            //}
        }