Exemplo n.º 1
0
        public ItemManager CreateItemsMenu(Menu itemsMenu, params IActivateableItem[] items)
        {
            var itemManager = new ItemManager();

            itemManager.Attach(itemsMenu, this, items);
            return(itemManager);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化 具体主题
        /// </summary>
        private void InitItemManageer()
        {
            itemManager = new ItemManager();
            // 初始化数据.
            itemManager.SelectedItemList = new List <int>();

            // 当前窗口,会修改数据, 同时也是观察者.
            itemManager.Attach(this);


            // 添加 奇数的子窗口.
            FormSubOdd frmSubOdd = new FormSubOdd()
            {
                ItemManager = itemManager,
                Left        = 10,
                Top         = 10,
            };

            itemManager.Attach(frmSubOdd);


            // 添加 偶数的子窗口.
            FormSubEven frmSubEven = new FormSubEven()
            {
                ItemManager = itemManager,
                Left        = 10,
                Top         = 350,
            };

            itemManager.Attach(frmSubEven);


            frmSubOdd.Show();
            frmSubEven.Show();


            // 初始化完毕后, 先尝试通知一次.
            itemManager.Notify();
        }