예제 #1
0
        /// <summary>
        /// 加载
        /// </summary>
        public override void LoadState(IMemento memento)
        {
            Name      = memento.GetString("Name");
            Text      = memento.GetString("Text");
            RefSector = memento.GetString("RefSector");
            String typeInfo = memento.GetString("MenuBoxItemType");

            Assembly assembly = LoadAssembly(typeInfo.Split(',')[1]);

            MenuBoxItemType = assembly.GetType(typeInfo.Split(',')[0]);

            SectorList.Clear();
            for (int Index = 0; Index < memento.ChildCount; Index++)
            {
                IMemento     childMemento = memento.GetChild(Index);
                MenuListItem menuListItem = new MenuListItem();
                menuListItem.LoadState(childMemento);

                //确保只有一个是选中状态
                if (menuListItem.IsChecked)
                {
                    foreach (MenuListItem item in SectorList)
                    {
                        item.IsChecked = false;
                    }
                }

                SectorList.Add(menuListItem);
            }
        }
예제 #2
0
        /// <summary>
        /// 深拷贝
        /// </summary>
        public MenuListItem DeepClone()
        {
            MenuListItem temp = new MenuListItem();

            temp.MenuText  = this.MenuText;
            temp.MenuValue = this.MenuValue;
            temp.IsChecked = this.IsChecked;
            return(temp);
        }