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;

namespace LFP_Manager.Forms
{
    public delegate void CalibUpdateEvent(object sendor);
    public delegate void CalibCmdEvent(int sId, int mode, int flag, DeviceParamData aParam, DeviceCalibration aCalib);

    public partial class fmxCalibration : DevExpress.XtraEditors.XtraForm
    {
        #region VARIABLES

        int SystemId = 0;
        DeviceParamData Param;
        DeviceCalibration Calib;

        public event CalibUpdateEvent OnUpdate = null;
        public event CalibCmdEvent OnCommand = null;

        #endregion

        #region CONSTRUCTORS

        public fmxCalibration()
        {
            InitializeComponent();
        }

        public fmxCalibration(int sId, DeviceCalibration aCalib)
        {
            InitializeComponent();

            SystemId = sId;
            Calib = aCalib;

            tmrDisplay.Enabled = true;
        }

        #endregion

        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        #region TIMER EVENT

        private void tmrDisplay_Tick(object sender, EventArgs e)
        {
            if (OnUpdate != null)
            {
                OnUpdate(this);
            }
        }

        #endregion

        #region PUBLIC FUCTIONS

        public void UpdateData(DeviceParamData aParam, DeviceCalibration aCalib)
        {
            Param = aParam;
            Calib = aCalib;
        }

        #endregion
    }
}