using Rs.Controls; using Rs.Framework; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Rs.MotionPlat { public partial class BaseForm : Form { protected bool quit = false; public void Quit() { quit = true; } private Color backColor = Color.FromArgb(11, 16, 36); public BaseForm() { InitializeComponent(); this.BackColor = Color.FromArgb(11, 16, 36); } protected void CloseWin(System.Windows.Forms.Control.ControlCollection ctls) { foreach(Control ctl in ctls) { if(ctl is BaseForm) { //((BaseForm)ctl).Quit(); ((BaseForm)ctl).Close(); } } } public void UpdateSysParam(TextBox txtSysParam) { string value = txtSysParam.Text; try { if (double.TryParse(value, out double dValue)) { SysConfigParam.Update(txtSysParam.Name.Replace("txt", ""), dValue.ToString()); } } catch (Exception) { throw; } } public void LoadSysParam(Control control) { foreach (Control ctl in control.Controls) { if(ctl is TextBox && ctl.Tag.ToString()=="SysParam") { string varName = ctl.Name.Replace("txt", ""); ctl.Text = SysConfigParam.GetValue(varName); } } } } }