You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB
C#

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<string>(varName);
}
}
}
}
}