Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: 287396159/A
        private void searchDeviceAllInfo()
        {
            if (device is CardDevice)
            {
                if (deviceCom is CardDeviceCom)
                {
                    CardDeviceCom cardDeviceCom = deviceCom as CardDeviceCom;

                    cardDeviceCom.sendShowCardDeviceCom();
                    Thread.Sleep(120);
                    cardDeviceCom.sendSearchRangeTime();
                    Thread.Sleep(120);
                    cardDeviceCom.sendSearchStillTime();
                    Thread.Sleep(120);
                    cardDeviceCom.sendSearchAccRange();
                }
            }
            else if (device is WarningDevice)
            {
                if (deviceCom is WarningDeviceCom)
                {
                    WarningDeviceCom warningDeviceCom = deviceCom as WarningDeviceCom;

                    warningDeviceCom.sendSerachWarningLinkTimeCom();
                    Thread.Sleep(120);
                    warningDeviceCom.sendSerachWarningSafeDistanceCom();
                    Thread.Sleep(120);
                    warningDeviceCom.sendSerachWarningVolumeCom();
                    Thread.Sleep(120);
                    warningDeviceCom.sendSerachWarningCardsCom();
                }
            }
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: 287396159/A
 private void Button13_Click(object sender, EventArgs e)
 {
     //MessageBox.Show("Button13_Click");
     //read card
     if (device is WarningDevice && deviceCom is WarningDeviceCom)
     {
         WarningDeviceCom warningDeviceCom = deviceCom as WarningDeviceCom;
         clickEventNum = CLICKEVENTNUM.GETWARNCARD;
         warningDeviceCom.sendSerachWarningCardsCom();
     }
 }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: 287396159/A
        private void Button14_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("Button14_Click");
            //Add card

            string idStr = textBox5.Text;

            byte[] id = getID(idStr, 3);
            if (id != null)
            {
                string endId = idStr.PadLeft(6, '0').Substring(2, 4);
                if ("0000" != endId && !"FFFF".Equals(endId.ToUpper()))
                {
                    if (device is WarningDevice && deviceCom is WarningDeviceCom)
                    {
                        WarningDeviceCom warningDeviceCom = deviceCom as WarningDeviceCom;
                        clickEventNum = CLICKEVENTNUM.ADDWARNCARD;
                        warningDeviceCom.sendSerachWarningCardsCom();
                        //byte[] setCardBytes = new byte[300];
                        //ListViewItem listViewItem = new ListViewItem();
                        //listViewItem.Text = getID(id);
                        //listViewItem.BackColor = Color.DeepSkyBlue;
                        //listView3.Items.Add(listViewItem);
                        //for (int i = 0; i < listView3.Items.Count; i++)
                        //{
                        //    string cardIDStr = listView3.Items[i].Text;
                        //    byte[] cardIDBytes = getID(cardIDStr, 3);
                        //    setCardBytes[i * 3] = cardIDBytes[0];
                        //    setCardBytes[i * 3 + 1] = cardIDBytes[1];
                        //    setCardBytes[i * 3 + 2] = cardIDBytes[2];
                        //}
                        //warningDeviceCom.sendSetWarningCardsCom(setCardBytes);
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect format!");
                }
            }
            else
            {
                MessageBox.Show("Incorrect format!");
            }
        }