예제 #1
0
        public Window1()
        {
            InitializeComponent();
            if (File.Exists("LithoGratosSettings.xml"))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(LGsettings));
                using (Stream reader = new FileStream("LithoGratosSettings.xml", FileMode.Open)) {
                    LGsettings setList = (LGsettings)serializer.Deserialize(reader);
                    lineOne.Text   = setList.L1default;
                    lineTwo.Text   = setList.L2default;
                    lineThree.Text = setList.L3default;
                    lineFour.Text  = setList.L4default;
                    lineFive.Text  = setList.L5default;
                    lineDT.Text    = setList.DTdefault;
                    fontOne.Text   = setList.L1font;
                    fontTwo.Text   = setList.L2font;
                    fontThree.Text = setList.L3font;
                    fontFour.Text  = setList.L4font;
                    fontFive.Text  = setList.L5font;
                    fontDT.Text    = setList.DTfont;

                    //setFonts.Text = setList.fontPath;
                }
            }
        }
예제 #2
0
        void btnSave_Click(object sender, RoutedEventArgs e)
        {
            LGsettings setList = new LGsettings {
            };

            setList.L1default = setLineOne.Text;
            setList.L2default = setLineTwo.Text;
            setList.L3default = setLineThree.Text;
            setList.L4default = setLineFour.Text;
            setList.L5default = setLineFive.Text;
            setList.DTdefault = setLineDT.Text;
            setList.L1font    = setFontOne.Text;
            setList.L2font    = setFontTwo.Text;
            setList.L3font    = setFontThree.Text;
            setList.L4font    = setFontFour.Text;
            setList.L5font    = setFontFive.Text;
            setList.DTfont    = setFontDT.Text;
            setList.fontPath  = setFonts.Text;
            XmlSerializer serializer = new XmlSerializer(typeof(LGsettings));

            using (Stream writer = new FileStream("LithoGratosSettings.xml", FileMode.Create)) {
                serializer.Serialize(writer, setList);
            }
        }