Ejemplo n.º 1
0
        private void setupInterface()
        {

            if (System.IO.File.Exists("config.xml"))
            {
                System.IO.StreamReader configReader = new System.IO.StreamReader("config.xml");
                string xmlConfig = configReader.ReadToEnd();
                xcfg.LoadXmlFromString(xmlConfig);
                configReader.Close();
            }
            else
            {
                xcfg = new VAkos.Xmlconfig("config.xml", true);
            }
           
            bool SimgStrip1 = false;
            bool SimgStrip2 = false;
            bool SimgStrip3 = false;
            bool SimgStrip4 = false;
            if (xcfg.Settings.ChildCount(false) != 0)
            {
                foreach (VAkos.ConfigSetting child in xcfg.Settings.Children())
                {
                    if (child.Name == "imgStrip1")
                        SimgStrip1 = true;
                    if (child.Name == "imgStrip2")
                        SimgStrip2 = true;
                    if (child.Name == "imgStrip3")
                        SimgStrip3 = true;
                    if (child.Name == "imgStrip4")
                        SimgStrip4 = true;
                }
            }

            //Window Width
            if (xcfg.Settings["window"]["width"].intValue > 0)
                this.Width = xcfg.Settings["window"]["width"].intValue;
            else
                xcfg.Settings["window"]["width"].intValue = this.Width;

            //Window Height
            if (xcfg.Settings["window"]["height"].intValue > 0)
                this.Height = xcfg.Settings["window"]["height"].intValue;
            else
                xcfg.Settings["window"]["height"].intValue = this.Height;

            //Window Background Image
            if (xcfg.Settings["window"]["background"].Value != "")
                this.BackgroundImage = Image.FromFile(xcfg.Settings["window"]["background"].Value);
            else
                this.BackgroundImage = ((System.Drawing.Image)(monobooth.Properties.Resources.ResourceManager.GetObject("BackgroundImage")));
            
            //Start Button
            if (xcfg.Settings["startButton"]["locationX"].Value != "")
            {
                Point cmdStartLocation = new Point(xcfg.Settings["startButton"]["locationX"].intValue,
                                                   xcfg.Settings["startButton"]["locationY"].intValue);
                cmdStart.Location = cmdStartLocation;
            }
            else
            {
                xcfg.Settings["startButton"]["locationX"].intValue = cmdStart.Location.X;
                xcfg.Settings["startButton"]["locationY"].intValue = cmdStart.Location.Y;
            }

            //Preview Window
            if (xcfg.Settings["previewWindow"]["locationX"].Value != "")
            {
                Point imgPreviewLocation = new Point(xcfg.Settings["previewWindow"]["locationX"].intValue,
                                                   xcfg.Settings["previewWindow"]["locationY"].intValue);
                imgPreview.Location = imgPreviewLocation;
            }
            else
            {
                xcfg.Settings["previewWindow"]["locationX"].intValue = imgPreview.Location.X;
                xcfg.Settings["previewWindow"]["locationY"].intValue = imgPreview.Location.Y;
            }

            //image1 box settings
            if (SimgStrip1)
            {
                imgStrip1.Visible = xcfg.Settings["imgStrip1"]["enabled"].boolValue;
                Point imgStrip1Location = new Point(xcfg.Settings["imgStrip1"]["locationX"].intValue, xcfg.Settings["imgStrip1"]["locationY"].intValue);
                imgStrip1.Location = imgStrip1Location;
                imgStrip1.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip1"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip1"]["enabled"].boolValue = imgStrip1.Visible;
                xcfg.Settings["imgStrip1"]["locationX"].intValue = imgStrip1.Location.X;
                xcfg.Settings["imgStrip1"]["locationY"].intValue = imgStrip1.Location.Y;
                xcfg.Settings["imgStrip1"]["backgroundcolor"].Value = imgStrip1.BackColor.Name.ToString();
            }

            //image2 box settings
            if (SimgStrip2)
            {
                imgStrip2.Visible = xcfg.Settings["imgStrip2"]["enabled"].boolValue;
                Point imgStrip2Location = new Point(xcfg.Settings["imgStrip2"]["locationX"].intValue, xcfg.Settings["imgStrip2"]["locationY"].intValue);
                imgStrip2.Location = imgStrip2Location;
                imgStrip2.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip2"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip2"]["enabled"].boolValue = imgStrip2.Visible;
                xcfg.Settings["imgStrip2"]["locationX"].intValue = imgStrip2.Location.X;
                xcfg.Settings["imgStrip2"]["locationY"].intValue = imgStrip2.Location.Y;
                xcfg.Settings["imgStrip2"]["backgroundcolor"].Value = imgStrip2.BackColor.Name.ToString();
            }

            

            //image3 box settings
            if (SimgStrip3)
            {
                imgStrip3.Visible = xcfg.Settings["imgStrip3"]["enabled"].boolValue;
                Point imgStrip3Location = new Point(xcfg.Settings["imgStrip3"]["locationX"].intValue, xcfg.Settings["imgStrip3"]["locationY"].intValue);
                imgStrip3.Location = imgStrip3Location;
                imgStrip3.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip3"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip3"]["enabled"].boolValue = imgStrip3.Visible;
                xcfg.Settings["imgStrip3"]["locationX"].intValue = imgStrip3.Location.X;
                xcfg.Settings["imgStrip3"]["locationY"].intValue = imgStrip3.Location.Y;
                xcfg.Settings["imgStrip3"]["backgroundcolor"].Value = imgStrip3.BackColor.Name.ToString();
            }

            //image4 box settings
            if (SimgStrip4)
            {
                imgStrip4.Visible = xcfg.Settings["imgStrip4"]["enabled"].boolValue;
                Point imgStrip4Location = new Point(xcfg.Settings["imgStrip4"]["locationX"].intValue, xcfg.Settings["imgStrip4"]["locationY"].intValue);
                imgStrip4.Location = imgStrip4Location;
                imgStrip4.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip4"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip4"]["enabled"].boolValue = imgStrip4.Visible;
                xcfg.Settings["imgStrip4"]["locationX"].intValue = imgStrip4.Location.X;
                xcfg.Settings["imgStrip4"]["locationY"].intValue = imgStrip4.Location.Y;
                xcfg.Settings["imgStrip4"]["backgroundcolor"].Value = imgStrip4.BackColor.Name.ToString();
            }

            


            //Save settings incase anything was not specified and defaults were added
            xcfg.Save("config.xml");
            this.Location = new Point(20, 20);
        }
Ejemplo n.º 2
0
        private void setupInterface()
        {
            if (System.IO.File.Exists("config.xml"))
            {
                System.IO.StreamReader configReader = new System.IO.StreamReader("config.xml");
                string xmlConfig = configReader.ReadToEnd();
                xcfg.LoadXmlFromString(xmlConfig);
                configReader.Close();
            }
            else
            {
                xcfg = new VAkos.Xmlconfig("config.xml", true);
            }

            bool SimgStrip1 = false;
            bool SimgStrip2 = false;
            bool SimgStrip3 = false;
            bool SimgStrip4 = false;

            if (xcfg.Settings.ChildCount(false) != 0)
            {
                foreach (VAkos.ConfigSetting child in xcfg.Settings.Children())
                {
                    if (child.Name == "imgStrip1")
                    {
                        SimgStrip1 = true;
                    }
                    if (child.Name == "imgStrip2")
                    {
                        SimgStrip2 = true;
                    }
                    if (child.Name == "imgStrip3")
                    {
                        SimgStrip3 = true;
                    }
                    if (child.Name == "imgStrip4")
                    {
                        SimgStrip4 = true;
                    }
                }
            }

            //Window Width
            if (xcfg.Settings["window"]["width"].intValue > 0)
            {
                this.Width = xcfg.Settings["window"]["width"].intValue;
            }
            else
            {
                xcfg.Settings["window"]["width"].intValue = this.Width;
            }

            //Window Height
            if (xcfg.Settings["window"]["height"].intValue > 0)
            {
                this.Height = xcfg.Settings["window"]["height"].intValue;
            }
            else
            {
                xcfg.Settings["window"]["height"].intValue = this.Height;
            }

            //Window Background Image
            if (xcfg.Settings["window"]["background"].Value != "")
            {
                this.BackgroundImage = Image.FromFile(xcfg.Settings["window"]["background"].Value);
            }
            else
            {
                this.BackgroundImage = ((System.Drawing.Image)(monobooth.Properties.Resources.ResourceManager.GetObject("BackgroundImage")));
            }

            //Start Button
            if (xcfg.Settings["startButton"]["locationX"].Value != "")
            {
                Point cmdStartLocation = new Point(xcfg.Settings["startButton"]["locationX"].intValue,
                                                   xcfg.Settings["startButton"]["locationY"].intValue);
                cmdStart.Location = cmdStartLocation;
            }
            else
            {
                xcfg.Settings["startButton"]["locationX"].intValue = cmdStart.Location.X;
                xcfg.Settings["startButton"]["locationY"].intValue = cmdStart.Location.Y;
            }

            //Preview Window
            if (xcfg.Settings["previewWindow"]["locationX"].Value != "")
            {
                Point imgPreviewLocation = new Point(xcfg.Settings["previewWindow"]["locationX"].intValue,
                                                     xcfg.Settings["previewWindow"]["locationY"].intValue);
                imgPreview.Location = imgPreviewLocation;
            }
            else
            {
                xcfg.Settings["previewWindow"]["locationX"].intValue = imgPreview.Location.X;
                xcfg.Settings["previewWindow"]["locationY"].intValue = imgPreview.Location.Y;
            }

            //image1 box settings
            if (SimgStrip1)
            {
                imgStrip1.Visible = xcfg.Settings["imgStrip1"]["enabled"].boolValue;
                Point imgStrip1Location = new Point(xcfg.Settings["imgStrip1"]["locationX"].intValue, xcfg.Settings["imgStrip1"]["locationY"].intValue);
                imgStrip1.Location  = imgStrip1Location;
                imgStrip1.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip1"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip1"]["enabled"].boolValue     = imgStrip1.Visible;
                xcfg.Settings["imgStrip1"]["locationX"].intValue    = imgStrip1.Location.X;
                xcfg.Settings["imgStrip1"]["locationY"].intValue    = imgStrip1.Location.Y;
                xcfg.Settings["imgStrip1"]["backgroundcolor"].Value = imgStrip1.BackColor.Name.ToString();
            }

            //image2 box settings
            if (SimgStrip2)
            {
                imgStrip2.Visible = xcfg.Settings["imgStrip2"]["enabled"].boolValue;
                Point imgStrip2Location = new Point(xcfg.Settings["imgStrip2"]["locationX"].intValue, xcfg.Settings["imgStrip2"]["locationY"].intValue);
                imgStrip2.Location  = imgStrip2Location;
                imgStrip2.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip2"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip2"]["enabled"].boolValue     = imgStrip2.Visible;
                xcfg.Settings["imgStrip2"]["locationX"].intValue    = imgStrip2.Location.X;
                xcfg.Settings["imgStrip2"]["locationY"].intValue    = imgStrip2.Location.Y;
                xcfg.Settings["imgStrip2"]["backgroundcolor"].Value = imgStrip2.BackColor.Name.ToString();
            }



            //image3 box settings
            if (SimgStrip3)
            {
                imgStrip3.Visible = xcfg.Settings["imgStrip3"]["enabled"].boolValue;
                Point imgStrip3Location = new Point(xcfg.Settings["imgStrip3"]["locationX"].intValue, xcfg.Settings["imgStrip3"]["locationY"].intValue);
                imgStrip3.Location  = imgStrip3Location;
                imgStrip3.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip3"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip3"]["enabled"].boolValue     = imgStrip3.Visible;
                xcfg.Settings["imgStrip3"]["locationX"].intValue    = imgStrip3.Location.X;
                xcfg.Settings["imgStrip3"]["locationY"].intValue    = imgStrip3.Location.Y;
                xcfg.Settings["imgStrip3"]["backgroundcolor"].Value = imgStrip3.BackColor.Name.ToString();
            }

            //image4 box settings
            if (SimgStrip4)
            {
                imgStrip4.Visible = xcfg.Settings["imgStrip4"]["enabled"].boolValue;
                Point imgStrip4Location = new Point(xcfg.Settings["imgStrip4"]["locationX"].intValue, xcfg.Settings["imgStrip4"]["locationY"].intValue);
                imgStrip4.Location  = imgStrip4Location;
                imgStrip4.BackColor = System.Drawing.Color.FromName(xcfg.Settings["imgStrip4"]["backgroundcolor"].Value);
            }
            else
            {
                xcfg.Settings["imgStrip4"]["enabled"].boolValue     = imgStrip4.Visible;
                xcfg.Settings["imgStrip4"]["locationX"].intValue    = imgStrip4.Location.X;
                xcfg.Settings["imgStrip4"]["locationY"].intValue    = imgStrip4.Location.Y;
                xcfg.Settings["imgStrip4"]["backgroundcolor"].Value = imgStrip4.BackColor.Name.ToString();
            }



            //Save settings incase anything was not specified and defaults were added
            xcfg.Save("config.xml");
            this.Location = new Point(20, 20);
        }