예제 #1
0
        public override void PopulateTree(Tree tree)
        {
            XPathNavigator n = new XPathDocument(Path.Combine(basedir, "toc.xml")).CreateNavigator();

            n.MoveToRoot();
            n.MoveToFirstChild();
            PopulateNode(n.SelectChildren("node", ""), tree);
        }
예제 #2
0
        public void Init_FormUI()
        {
            try
            {
                XPathNavigator navigator = new XPathDocument(this.xmlPath).CreateNavigator();
                navigator.MoveToRoot();
                XPathNodeIterator parent1 = navigator.Select("/form/property");
                while (parent1.MoveNext())
                {
                    switch (this.GetInnerContent(parent1, "name"))
                    {
                    case "picBackground":
                        this.picBackground      = new Bitmap(Path.Combine(this.uiPath, this.GetInnerContent(parent1, "value")));
                        this.myPictureBox.Image = (Image)this.picBackground;
                        this.myForm.Size        = this.picBackground.Size;
                        this.myPictureBox.Size  = this.picBackground.Size;
                        continue;

                    case "picForeground":
                        this.picForeground = new Bitmap(Path.Combine(this.uiPath, this.GetInnerContent(parent1, "value")));
                        continue;

                    case "picHighlight":
                        this.picHighlight = new Bitmap(Path.Combine(this.uiPath, this.GetInnerContent(parent1, "value")));
                        continue;

                    default:
                        continue;
                    }
                }
                navigator.MoveToRoot();
                XPathNodeIterator parent2 = navigator.Select("/form/region");
                Size  aSize  = new Size();
                Point aPoint = new Point();
                while (parent2.MoveNext())
                {
                    string innerContent1 = this.GetInnerContent(parent2, "name");
                    string innerContent2 = this.GetInnerContent(parent2, "type");
                    aPoint.X     = Convert.ToInt32(this.GetInnerContent(parent2, "X"));
                    aPoint.Y     = Convert.ToInt32(this.GetInnerContent(parent2, "Y"));
                    aSize.Width  = Convert.ToInt32(this.GetInnerContent(parent2, "Width"));
                    aSize.Height = Convert.ToInt32(this.GetInnerContent(parent2, "Height"));
                    string innerContent3 = this.GetInnerContent(parent2, "tooltip");
                    if (innerContent2 != "control")
                    {
                        this.AddElement(innerContent1, innerContent2, aPoint, aSize, innerContent3);
                        if (innerContent2 == "trackbar")
                        {
                            this.elementlist[this.elementlist.Count - 1].ImageForeground = new Bitmap(Path.Combine(this.uiPath, this.GetInnerContent(parent2, "value")));
                            aSize.Width  = Convert.ToInt32(this.GetInnerContent(parent2, "Widthbar"));
                            aSize.Height = Convert.ToInt32(this.GetInnerContent(parent2, "Heightbar"));
                            this.elementlist[this.elementlist.Count - 1].Rect2.Size    = aSize;
                            this.elementlist[this.elementlist.Count - 1].isDisplayFore = true;
                        }
                        else
                        {
                            string innerContent4 = this.GetInnerContent(parent2, "value");
                            if (innerContent4 != null)
                            {
                                this.elementlist[this.elementlist.Count - 1].ImageForeground = new Bitmap(Path.Combine(this.uiPath, innerContent4));
                                this.elementlist[this.elementlist.Count - 1].isDisplayFore   = true;
                            }
                        }
                    }
                    else
                    {
                        System.Windows.Forms.Control control = this.myForm.Controls[innerContent1];
                        control.Size     = aSize;
                        control.Location = aPoint;
                    }
                }
            }
            catch (Exception ex)
            {
                int num = (int)MessageBox.Show(ex.Message);
                Environment.Exit(0);
            }
        }