private void LoadTextIntoDataset() { dsText = new DataSet(); // key = source file foreach (string src in dialogs.Keys) { DataTable table = CreateTable(src); dsText.Tables.Add(table); XmlDocument doc = new XmlDocument(); FileStream stream = new FileStream(Common.wixUIFolder + Path.DirectorySeparatorChar + src, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); doc.Load(stream); XmlNodeList controls = doc.GetElementsByTagName("Control"); foreach (XmlNode control in controls) { if (control.Attributes["Type"].Value == "Text") { if (control.Attributes["Text"] != null) { string textId = control.Attributes["Text"].Value; textId = textId.Remove(0, 6); textId = textId.Remove(textId.Length - 1); string text = textsDictionary[textId]; DataRow row = table.Rows.Add(control.Attributes["Id"].Value, control.Attributes["X"].Value, control.Attributes["Y"].Value , control.Attributes["Width"].Value, control.Attributes["Height"].Value, "", textId, text);// varify the order of values ProcessFont(row); } } } //create UI control XmlNodeList dialogNodes = doc.GetElementsByTagName("Dialog"); int width = int.Parse(dialogNodes[0].Attributes["Width"].Value); int height = int.Parse(dialogNodes[0].Attributes["Height"].Value); UIControl ctrl = new UIControl(dsText.Tables[src]); //ctrl.DialogSize = new Size(width, height); ctrl.Dock = DockStyle.Fill; uiControls.Add(src, ctrl); } }
private void lstDialogs_SelectedIndexChanged(object sender, EventArgs e) { if (lstDialogs.SelectedIndex > -1) { foreach (Control control in splitContainer.Panel2.Controls) { if (control is UIControl) { ((UIControl)control).IsCurrentControl = false; } } splitContainer.Panel2.Controls.Clear(); string selectedValue = (string)lstDialogs.SelectedValue; if (uiControls.ContainsKey(selectedValue)) { UIControl control = uiControls[selectedValue]; control.BannerImg = txtBanner.Text; control.DialogImg = txtDialog.Text; control.IsCurrentControl = true; splitContainer.Panel2.Controls.Add(control); } } }