Exemple #1
0
        private void backToDefaultClick(object sender, EventArgs e)
        {
            if (File.Exists("config.xml"))
            {
                File.Delete("config.xml");
            }

            StyleApplier.Reload();
            StyleApplier.ApplyColors(this);
        }
Exemple #2
0
        private void settingsClick(object sender, EventArgs e)
        {
            this.Visible = false;
            var settings = new Settings();

            settings.FormClosed += (s, ea) =>
            {
                StyleApplier.Reload();
                StyleApplier.ApplyColors(this);
                StyleApplier.ApplyName(this);
                this.Visible = true;
            };
            settings.Show();
        }
Exemple #3
0
        private void saveButtonClick(object sender, EventArgs e)
        {
            var elements = new List <XElement>();

            elements.Add(new XElement("programName", programNameTextbox.Text));

            var buttonColor = new XElement
                              (
                "buttonColor",
                new XAttribute("red", buttonColorTextboxRed.Text),
                new XAttribute("green", buttonColorTextboxGreen.Text),
                new XAttribute("blue", buttonColorTextboxBlue.Text)
                              );

            elements.Add(buttonColor);

            var backgroundColor = new XElement
                                  (
                "backgroundColor",
                new XAttribute("red", backgroundColorTextboxRed.Text),
                new XAttribute("green", backgroundColorTextboxGreen.Text),
                new XAttribute("blue", backgroundColorTextboxBlue.Text)
                                  );

            elements.Add(backgroundColor);

            var fontColor = new XElement
                            (
                "fontColor",
                new XAttribute("red", fontColorTextboxRed.Text),
                new XAttribute("green", fontColorTextboxGreen.Text),
                new XAttribute("blue", fontColorTextboxBlue.Text)
                            );

            elements.Add(fontColor);

            elements.Add(new XElement("buttonStyle", buttonStyleButton.FlatStyle == FlatStyle.Standard ? "Standard" : "Popup"));

            var document = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), new XElement("settings", elements));

            document.Save("config.xml");

            StyleApplier.Reload();
            StyleApplier.ApplyColors(this);
        }