Example #1
0
        public void SetBaseItemText(BaseItem bi)
        {
            XmlInfo li = null;

            if (xmlInfo.TryGetValue(bi.Name, out li))
            {
                if (li.Tooltip)
                {
                    bi.Tooltip = li.Text;
                }
                else
                {
                    bi.Text = li.Text;
                }
            }

            if (bi.SubItems == null)
            {
                return;
            }

            foreach (BaseItem bsub in bi.SubItems)
            {
                SetBaseItemText(bsub);
            }
        }
Example #2
0
        public void SetControlText(Control ctrl)
        {
            XmlInfo li = null;

            if (xmlInfo.TryGetValue(ctrl.Name, out li))
            {
                ctrl.Text = li.Text;
            }
        }
Example #3
0
 public void SetToolStripText(ToolStrip ms)
 {
     foreach (ToolStripItem tsi in ms.Items)
     {
         XmlInfo li = null;
         if (xmlInfo.TryGetValue(tsi.Name, out li))
         {
             tsi.Text = li.Text;
         }
     }
 }
Example #4
0
        public string GetString(string name, string default_text)
        {
            string  text = "";
            XmlInfo xi   = null;

            if (xmlInfo.TryGetValue(name, out xi))
            {
                text = xi.Text;
            }
            else
            {
                text = default_text;
            }

            return(text);
        }
Example #5
0
        public bool Load(string file, string name)
        {
            try
            {
                XmlDocument xml_doc = new XmlDocument();
                xml_doc.Load(file);

                XmlNode xml_node = xml_doc.DocumentElement.FirstChild;

                foreach (XmlNode xml_node_sub in xml_node.ChildNodes)
                {
                    if (xml_node_sub.Name == "Form")
                    {
                        if (xml_node_sub.Attributes["name"].Value != name)
                        {
                            continue;
                        }

                        xmlInfo.Add(xml_node_sub.Attributes["name"].Value, new XmlInfo(false, xml_node_sub.Attributes["text"].Value));

                        foreach (XmlNode xml_subNode_sub in xml_node_sub.ChildNodes)
                        {
                            switch (xml_subNode_sub.Name)
                            {
                            case "Control":
                            {
                                XmlInfo      li = new XmlInfo();
                                XmlAttribute xa = xml_subNode_sub.Attributes["text"];
                                if (xa == null)
                                {
                                    li.Tooltip = true;
                                    li.Text    = xml_subNode_sub.Attributes["tooltip"].Value;
                                }
                                else
                                {
                                    li.Tooltip = false;
                                    li.Text    = xml_subNode_sub.Attributes["text"].Value;
                                }
                                xmlInfo.Add(xml_subNode_sub.Attributes["name"].Value, li);
                            }
                            break;

                            case "String":
                            {
                                XmlInfo li = new XmlInfo();
                                li.Tooltip = false;
                                li.Text    = xml_subNode_sub.Attributes["text"].Value;
                                xmlInfo.Add(xml_subNode_sub.Attributes["name"].Value, li);
                            }
                            break;
                            }
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }