private void FillExistedPointInfo() { this.txtName.Text = _pointInfo.Name; this.txtIP.Text = _pointInfo.IP; this.txtPort.Text = _pointInfo.Port; //Fill items if (_pointInfo.Items == null || _pointInfo.Items.Count() == 0)//no item { return; } foreach (var item in _pointInfo.Items) { IItemControl itemCtr = null; if (item.Type == ItemType.App.ToString()) { itemCtr = new AppPanel(); } else if (item.Type == ItemType.Flash.ToString()) { itemCtr = new FlashPanel(); } else if (item.Type == ItemType.Image.ToString()) { itemCtr = new ImagePanel(); } else if (item.Type == ItemType.PPT.ToString()) { itemCtr = new PPTPanel(); } else if (item.Type == ItemType.Video.ToString()) { itemCtr = new VideoPanel(); } else if (item.Type == ItemType.WebPage.ToString()) { itemCtr = new WebPagePanel(); } //load config if (itemCtr != null) { this.flpItem.Controls.Add(itemCtr as UserControl); itemCtr.LoadItem(item); AddDeleteEvent(itemCtr); } } }
private void AddItem_Click(object sender, EventArgs e) { ItemType itemType = (ItemType)cbType.SelectedIndex; IItemControl itemtoAdd = null; switch (itemType) { case ItemType.Image: itemtoAdd = new ImagePanel(); break; case ItemType.PPT: itemtoAdd = new PPTPanel(); break; case ItemType.App: itemtoAdd = new AppPanel(); break; case ItemType.Flash: itemtoAdd = new FlashPanel(); break; case ItemType.Video: itemtoAdd = new VideoPanel(); break; case ItemType.WebPage: itemtoAdd = new WebPagePanel(); break; default: break; } itemtoAdd.IsChanged = true; AddDeleteEvent(itemtoAdd); }