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 CowainHmi
{
    public partial class S1扫码枪 : S1公共背景
    {
        private string DB = "DB1111";

        public S1扫码枪()
        {
            InitializeComponent();
        }
        private void S1视觉_Load(object sender, EventArgs e)
        {
            this.btnTrig.开关功能.地址[0] = $"{DB}.0.0";
            this.btnTrig.监控地址 = $"{DB}.0.0";
            this.lblReady.指示灯地址 = $"{DB}.2.0";
            this.lblError.指示灯地址 = $"{DB}.2.1";
            this.txtResult.监控地址 = $"{DB}.4";
            this.txtErrorCode.监控地址 = $"{DB}.6";
            this.txtSN.监控地址= $"{DB}.12";
            this.txtRcvLength.监控地址 = $"{DB}.10";
            this.lblErr0.指示灯地址 = $"{DB}.8.0";
            this.lblErr1.指示灯地址 = $"{DB}.8.1";
            this.lblErr2.指示灯地址 = $"{DB}.8.2";
            this.lblErr3.指示灯地址 = $"{DB}.8.3";
            this.lblErr4.指示灯地址 = $"{DB}.8.4";


        }




        private async void btnTrig_MouseDown(object sender, MouseEventArgs e)
        {
            PCHMI.RT.SEND_BIT(0, $"{DB}.0.0", 0);
            await Task.Delay(200);
            PCHMI.OPTLOG.WLOG($"手动触发了扫码，地址：{DB}.0.0");
            PCHMI.RT.SEND_BIT(0, $"{DB}.0.0", 1);
        }

        private async void btnTrig_MouseUp(object sender, MouseEventArgs e)
        {
            await Task.Delay(500);
            PCHMI.RT.SEND_BIT(0, $"{DB}.0.0", 0);
        }
    }
}
