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.

116 lines
3.7 KiB
C#

using Rs.AutoDischarge.V3.Flow;
using Rs.Camera;
using Rs.Controls;
using Rs.Framework;
using Rs.Motion;
using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Flow;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Rs.MotionPlat.SysConfig
{
public partial class CommonConfig : BaseForm
{
IniHelper ini = new IniHelper(Path.Combine(GlobalVar.CurRecipe, "default.ini"));
public CommonConfig()
{
InitializeComponent();
}
private void CommonConfig_Load(object sender, EventArgs e)
{
List<string> cameras = HikCamera.Instance.GetCameras();
foreach (string cam in cameras)
{
cboxUpCameraName.Items.Add(cam);
cboxDownLocationCameraName.Items.Add(cam);
cboxDownScanCameraName.Items.Add(cam);
}
foreach (var con in groupBox1.Controls)
{
if (con is TextBox)
{
TextBox txt = (TextBox)con;
txt.Text = SysConfigParam.GetValue<string>(txt.Name.Replace("txt", ""));
}
else if (con is TrackBar)
{
TrackBar tb = (TrackBar)con;
tb.Value = SysConfigParam.GetValue<int>(tb.Name.Replace("tbar", ""));
}
else if (con is CheckBox)
{
CheckBox cbox = (CheckBox)con;
cbox.Checked = SysConfigParam.GetValue<bool>(cbox.Name.Replace("cbox", ""));
}
else if (con is ComboBox)
{
ComboBox cbox = (ComboBox)con;
cbox.SelectedItem = SysConfigParam.GetValue<string>(cbox.Name.Replace("cbox", ""));
}
}
LoadSysParam(groupBox2);
PositionHelper.BindPosition(groupBox3,"int");
}
private void btnSaveSpeedParam_Click(object sender, EventArgs e)
{
foreach(var con in groupBox1.Controls)
{
if(con is TextBox)
{
TextBox txt=(TextBox)con;
SysConfigParam.Update(txt.Name.Replace("txt",""), txt.Text);
}
else if(con is TrackBar)
{
TrackBar tb= (TrackBar)con;
SysConfigParam.Update(tb.Name.Replace("tbar",""), tb.Value.ToString());
}
else if(con is CheckBox)
{
CheckBox cbox= (CheckBox)con;
SysConfigParam.Update(cbox.Name.Replace("cbox",""), cbox.Checked.ToString());
}
else if(con is ComboBox)
{
ComboBox cbox= (ComboBox)con;
if(cbox.SelectedItem!=null)
{
SysConfigParam.Update(cbox.Name.Replace("cbox", ""), cbox.SelectedItem.ToString());
}
}
}
Msg.ShowInfo("Save camera param success!");
}
private void tbarWholeSpeed_ValueChanged(object sender, EventArgs e)
{
lblWholeSpeed.Text = $"{tbarWholeSpeed.Value}%";
}
private void tbarFlyCameraSpeed_ValueChanged(object sender, EventArgs e)
{
lblFlyCameraSpeed.Text = $"{tbarFlyCameraSpeed.Value}%";
}
public void txtSysParam_KeyUp(object sender, KeyEventArgs e)
{
UpdateSysParam((TextBox)sender);
}
}
}