Exemplo n.º 1
0
 public static void Load(string fileName)
 {
     if (File.Exists(fileName))
     {
         using (FileStream stream = new FileStream(fileName, FileMode.Open))
         {
             BinaryFormatter formatter = new BinaryFormatter();
             formatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple;
             LookAndFeelSettings settings = formatter.Deserialize(stream) as LookAndFeelSettings;
             if (settings != null)
             {
                 UserLookAndFeel.Default.UseWindowsXPTheme = settings.UseWindowsXPTheme;
                 UserLookAndFeel.Default.Style             = settings.Style;
                 UserLookAndFeel.Default.SkinName          = settings.SkinName;
             }
         }
     }
 }
Exemplo n.º 2
0
        public static void Save(string fileName)
        {
            FileStream          stream;
            LookAndFeelSettings settings;
            BinaryFormatter     formatter;

            settings                   = new LookAndFeelSettings();
            settings.SkinName          = UserLookAndFeel.Default.SkinName;
            settings.Style             = UserLookAndFeel.Default.Style;
            settings.UseWindowsXPTheme = UserLookAndFeel.Default.UseWindowsXPTheme;

            using (stream = new FileStream(fileName, FileMode.Create))
            {
                formatter = new BinaryFormatter();
                formatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple;
                formatter.Serialize(stream, settings);
            }
        }