Exemplo n.º 1
0
 public static void Load(string fileName)
 {
     try
     {
         fileName = Commons.FolderPath + 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;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("LFS", 2) + ex.Message);
     }
 }
Exemplo n.º 2
0
        public static void Save(string fileName)
        {
            try
            {
                fileName = Commons.FolderPath + 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);
                }
            }
            catch (Exception ex)
            {
                Commons.Status(Commons.GetErrorCode("LFS", 1) + ex.Message);
            }
        }
Exemplo n.º 3
0
 void rFrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (!m_LisansKeyValidate)
         {
             if (Commons.ValidateApplication())
             {
                 LookAndFeelSettings.Save("LookAndFeelSettings.dat");
                 Commons.BackupDatabase();
             }
         }
         e.Cancel = false;
         Application.Exit();
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("FMN", 3) + ex.Message);
         e.Cancel = false;
         Application.Exit();
     }
 }
Exemplo n.º 4
0
 public rFrmMain()
 {
     InitializeComponent();
     SetCurrencyAndLangs();
     LookAndFeelSettings.Load("LookAndFeelSettings.dat");
 }