Example #1
0
        private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox.SelectedItem != null)
            {
                bool       findOut = false;
                PrintTitle title   = (PrintTitle)comboBox.SelectedItem;
                propertyGrid.SelectedObject = title;

                XmlNode root = xml.FirstChild["Defines"];

                foreach (XmlNode node in root.ChildNodes)
                {
                    findOut = node.Attributes[0].InnerText.ToUpper() == title.Name.ToUpper();
                    if (findOut)
                    {
                        root = node;
                        break;
                    }
                }

                if (findOut)
                {
                    listBox.Items.Clear();
                    currentNode = root;
                    foreach (XmlNode node in root.ChildNodes)
                    {
                        PrintItem item = new PrintItem();
                        item.Name        = node["Name"].InnerText;
                        item.Description = node["Description"].InnerText;
                        try
                        {
                            item.Location  = node["Location"].InnerText == "" ? Point.Empty : new Point(int.Parse(node["Location"].InnerText.Substring(1, node["Location"].InnerText.Length - 2).Split(',')[0].Split('=')[1]), int.Parse(node["Location"].InnerText.Substring(1, node["Location"].InnerText.Length - 2).Split(',')[1].Split('=')[1]));
                            item.PrintFont = node["PrintFont"].InnerText == "" ? null : item.SetFontName(node["PrintFont"].InnerText);
                        }
                        catch
                        {
                            item.Location  = Point.Empty;
                            item.PrintFont = null;
                        }

                        item.Tag = node;

                        listBox.Items.Add(item);
                    }
                }
            }
        }
Example #2
0
        private void GetAllAirStations()
        {
            XmlNode root = xml.FirstChild;

            comboBox.Items.Clear();
            foreach (XmlNode node in root["Reports"].ChildNodes)
            {
                PrintTitle title = new PrintTitle(node.Attributes[0].InnerText, node.InnerText, node.Attributes[1].InnerText);
                title.Tag = node;
                comboBox.Items.Add(title);
            }

            if (comboBox.Items.Count > 0)
            {
                comboBox.SelectedIndex = 0;
            }
        }