Пример #1
0
        public void SaveWinProp()
        {
            SaveWindowProperties swp = new SaveWindowProperties(Width, Height, Location.X, Location.Y, checkBox2.Checked);

            BinaryFormatter binary = new BinaryFormatter();

            using (FileStream fs = new FileStream(Path.Combine(Constants.PROG_DATA_DIR, "win_prop.bin"), FileMode.OpenOrCreate))
            {
                binary.Serialize(fs, swp);
            }
        }
Пример #2
0
        public void OpenWinProp()
        {
            FileInfo bin = new FileInfo(Path.Combine(Constants.PROG_DATA_DIR, "win_prop.bin"));

            if (bin.Exists)
            {
                BinaryFormatter bf = new BinaryFormatter();
                using (FileStream fs = new FileStream(bin.FullName, FileMode.OpenOrCreate))
                {
                    SaveWindowProperties swp = (SaveWindowProperties)bf.Deserialize(fs);

                    Width  = swp.Width;
                    Height = swp.Height;

                    Location = new Point(swp.LocationX, swp.LocationY);

                    checkBox2.Checked = swp.HideZeroDebt;
                }
            }
        }