private void listBox1_DoubleClick(object sender, EventArgs e) { ScenInfo si = _SceneCollection.Where(s => s.Description == listBox1.Text).FirstOrDefault(); STemplateDetails obj = objWaspFileHandler.GetTemplatePlayerInfo(si.Id, ""); if (obj != null) { Form obj1 = Activator.CreateInstance(obj.TemplatePlayerInfo) as Form; obj1.TopLevel = false; obj1.Visible = true; var ctl = tableLayoutPanel1.GetControlFromPosition(1, RowPos); if (ctl != null) // Already control present there { //First play out the graphic. //then delete the gfx tableLayoutPanel1.Controls.Remove(ctl); } tableLayoutPanel1.Controls.Add(obj1, 1, RowPos); if (RowPos == 1) { RowPos--; } else { RowPos++; } obj1.Show(); } else { MessageBox.Show("Template " + si.Id + "Not found"); } }
private void GetTemplateList() { listBox1.Items.Clear(); XDocument xdoc = XDocument.Load("templates.xml"); var templates = xdoc.Descendants("template"); foreach (var item in templates) { ScenInfo sc = new ScenInfo(); sc.Id = item.Attribute("id").Value; sc.Name = item.Attribute("name").Value; sc.Description = item.Attribute("description").Value; sc.inuse = false; _SceneCollection.Add(sc); listBox1.Items.Add(item.Attribute("description").Value); } }
/// <summary> /// Fill templates list by reading the templates.xml /// </summary> private void LoadTemplates() { try { if (m_lstSceneCollection == null) { m_lstSceneCollection = new List<ScenInfo>(); } XDocument xdoc = XDocument.Load("templates.xml"); var templates = xdoc.Descendants("template"); foreach (var item in templates) { ScenInfo sc = new ScenInfo(); sc.Id = item.Attribute("id").Value; sc.Name = item.Attribute("name").Value; sc.Description = item.Attribute("description").Value; bool ismanual = false; bool.TryParse(item.Attribute("ismanual").Value, out ismanual); sc.ismanual = ismanual; sc.inuse = false; m_lstSceneCollection.Add(sc); } } catch (Exception ex) { LogWriter.WriteLog(ex); } }