public bool Save() { TIniFile IniFile = new TIniFile(IniFileName); IniFile.WriteString("General", "FileName", FileName); IniFile.WriteBool("General", "Glow", Glow); IniFile.UpdateFile(); return(true); }
public void SaveConfig() { TIniFile IniFile = new TIniFile(DataModul.GetInstance().IniFileName); IniFile.WriteBool("General", "Debug", Debug); IniFile.WriteInteger("General", "LineNumbers", LineNumbers); IniFile.WriteBool("General", "BlackWhite", BlackWhite); IniFile.WriteBool("General", "ReloadFiles", ReloadFiles); IniFile.WriteString("General", "FileName1", FileName1); IniFile.WriteString("General", "FileName2", FileName2); IniFile.UpdateFile(); }
public static void WriteFormPos(Window window, bool FromBorder) { if (IniFileName != "") { try { if (FromBorder) { bool AlignLeft = true; bool AlignTop = true; double MarginX = 0; double MarginY = 0; if ((window.Left + (window.Width / 2)) > System.Windows.SystemParameters.PrimaryScreenWidth / 2) { // right border AlignLeft = false; MarginX = System.Windows.SystemParameters.PrimaryScreenWidth - window.Left - window.Width; } else { MarginX = window.Left; }; if ((window.Top + (window.Height / 2)) > System.Windows.SystemParameters.PrimaryScreenHeight / 2) { // bottom border AlignTop = false; MarginY = System.Windows.SystemParameters.PrimaryScreenHeight - window.Top - window.Height; } else { MarginY = window.Top; }; TIniFile IniFile = new TIniFile(IniFileName); try { IniFile.WriteBool(window.Name, "AlignLeft", AlignLeft); IniFile.WriteBool(window.Name, "AlignTop", AlignTop); IniFile.WriteInteger(window.Name, "MarginX", (int)MarginX); IniFile.WriteInteger(window.Name, "MarginY", (int)MarginY); IniFile.UpdateFile(); } catch { //on E: Exception do //{ // MessageDlg('Erreur fatale (WriteFormPos): ' + #13 + #10 // + E.Message, mtError, [mbOk], 0); // Application.Terminate; //}; }; } else { { TIniFile IniFile = new TIniFile(IniFileName); try { IniFile.WriteInteger(window.Name, "WindowState", (int)(window.WindowState)); IniFile.WriteInteger(window.Name, "Left", (int)window.Left); IniFile.WriteInteger(window.Name, "Top", (int)window.Top); IniFile.WriteInteger(window.Name, "Width", (int)window.Width); IniFile.WriteInteger(window.Name, "Height", (int)window.Height); IniFile.UpdateFile(); } catch { //on E: Exception do //{ // MessageDlg('Erreur fatale (WriteFormPos): ' + #13 + #10 // + E.Message, mtError, [mbOk], 0); // Application.Terminate; //}; }; }; }; } catch { }; } ; }