초기 커밋.
This commit is contained in:
126
LFP_Manager/Forms/fmxAntiTheft.cs
Normal file
126
LFP_Manager/Forms/fmxAntiTheft.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.XtraEditors;
|
||||
|
||||
using LFP_Manager.DataStructure;
|
||||
using LFP_Manager.Function;
|
||||
using LFP_Manager.Controls;
|
||||
using LFP_Manager.Threads;
|
||||
|
||||
namespace LFP_Manager.Forms
|
||||
{
|
||||
public delegate void AntiTheftUpdateEvent(object sendor);
|
||||
public delegate void AntiTheftCmdEvent(int sId, int mode, int index, int flag, ref DeviceParamData aParam, ref DeviceCalibration aCalib);
|
||||
|
||||
public partial class fmxAntiTheft : DevExpress.XtraEditors.XtraForm
|
||||
{
|
||||
#region VARIABLES
|
||||
|
||||
int SystemId = 0;
|
||||
DeviceSystemData SystemData;
|
||||
DeviceParamData Param;
|
||||
DeviceCalibration Calib;
|
||||
|
||||
public event AntiTheftUpdateEvent OnUpdate = null;
|
||||
public event AntiTheftCmdEvent OnCommand = null;
|
||||
public event SendDataUartEvent OnSendUartData = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public fmxAntiTheft()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public fmxAntiTheft(int sId, DeviceCalibration aCalib)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
InitComponent();
|
||||
|
||||
SystemId = sId;
|
||||
Calib = aCalib;
|
||||
|
||||
AntiTheftCmd.UpdateData(SystemId, Calib);
|
||||
AntiTheftCmd.OnSendUartData += SetWriteData;
|
||||
|
||||
tmrDisplay.Enabled = true;
|
||||
}
|
||||
|
||||
public void InitComponent()
|
||||
{
|
||||
// Cell Voltage Calibration
|
||||
AntiTheftCmd.OnCommand += OnCmdEvent;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region COMMAND EVENT
|
||||
private void SetWriteData(ushort WriteAddr, byte[] WriteData, bool RelyFlag, int type)
|
||||
{
|
||||
OnSendUartData?.Invoke(WriteAddr, WriteData, RelyFlag, type);
|
||||
}
|
||||
|
||||
private void OnCmdEvent(int mode, int index, int flag, ref DeviceParamData aParam, ref DeviceCalibration aCalib)
|
||||
{
|
||||
OnCommand?.Invoke(SystemId, mode, index, flag, ref aParam, ref aCalib);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BUTTON EVENT
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TIMER EVENT
|
||||
|
||||
private void tmrDisplay_Tick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DisplayValue();
|
||||
if (OnUpdate != null)
|
||||
{
|
||||
OnUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DISPLAY DATA
|
||||
|
||||
private void DisplayValue()
|
||||
{
|
||||
// Cell Voltage Parameter
|
||||
AntiTheftCmd.UpdateData(SystemId, Calib);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PUBLIC FUCTIONS
|
||||
|
||||
public void UpdateData(DeviceParamData aParam, DeviceCalibration aCalib, DeviceSystemData aSystemData)
|
||||
{
|
||||
SystemData = aSystemData;
|
||||
Param = aParam;
|
||||
Calib = aCalib;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void AntiTheftCmd_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user