Exemplo n.º 1
0
        private void listBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ObjInd = listBox.SelectedIndex;
            listBox2.Items.Clear();
            ObjectXml obj = objects[listBox.SelectedIndex];

            foreach (string s in obj.AtrName)
            {
                ListBoxItem item = new ListBoxItem();
                item.Height  = 40;
                item.Width   = 150;
                item.Content = s;
                listBox2.Items.Add(item);
            }
        }
Exemplo n.º 2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         XmlDocument document = new XmlDocument();
         document.Load(file_path);
         XmlElement root = document.DocumentElement;
         foreach (XmlElement node in root)
         {
             ObjectXml obj = new ObjectXml();
             if (node.Attributes.GetNamedItem("name") != null)
             {
                 XmlNode atr = node.Attributes.GetNamedItem("name");
                 obj.name = atr.Value;
             }
             foreach (XmlNode child in node.ChildNodes)
             {
                 XmlNode att = child.Attributes.GetNamedItem("help");
                 if (att != null)
                 {
                     obj.AtrHelp.Add(child.Attributes.GetNamedItem("help").Value);
                 }
                 else
                 {
                     obj.AtrHelp.Add("");
                 }
                 obj.AtrName.Add(child.Name);
                 obj.AtrValue.Add(child.InnerText);
             }
             objects.Add(obj);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     foreach (ObjectXml obj in objects)
     {
         ListBoxItem item = new ListBoxItem();
         item.Height  = 40;
         item.Width   = 150;
         item.Content = obj.name;
         listBox.Items.Add(item);
     }
 }