Exemplo n.º 1
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            bool isConnect = false;                                 // 连接是否成功

            if (cb_ConnectType.SelectedIndex == 0)
            {
                if (cb_ComNum.SelectedIndex >= 0 && cb_BPS.SelectedIndex >= 0)
                {
                    this.tb_ConnParam.Text = cb_ComNum.Text + ":" + cb_BPS.Text;
                    isConnect = CLReader.CreateSerialConn(this.tb_ConnParam.Text, contextForm);
                }
                // Helper.MyXmlHelper.UpdateInnerText(XMLFIENAME, "Root/ConnectDeviceT", "SerialConnect", tb_ConnParam.Text.Trim());
            }
            else if (cb_ConnectType.SelectedIndex == 1)
            {
                isConnect = CLReader.CreateTcpConn(tb_ConnParam.Text.Trim(), contextForm);
                ////Helper.MyXmlHelper.UpdateInnerText(XMLFIENAME, "Root/ConnectDeviceT", "TcpConnect", tb_ConnParam.Text.Trim());
            }
            else if (cb_ConnectType.SelectedIndex == 2)
            {
                if (cb_ComNum.SelectedIndex >= 0 && cb_BPS.SelectedIndex >= 0 && !String.IsNullOrEmpty(tb_485Address.Text))
                {
                    this.tb_ConnParam.Text = tb_485Address.Text.Trim() + ":" + cb_ComNum.Text + ":" + cb_BPS.Text;
                    isConnect = CLReader.Create485Conn(this.tb_ConnParam.Text, contextForm);
                }
                // Helper.MyXmlHelper.UpdateInnerText(XMLFIENAME, "Root/ConnectDeviceT", "_485Connect", tb_ConnParam.Text.Trim());
            }
            if (isConnect)                                          // 如果连接成功
            {
                ////if (contextForm.IsMultiConnect == false)            // 单读写器模式
                ////{
                ////    contextForm.CloseNowConnect();
                ////}
                ////else
                ////{
                if (!String.IsNullOrEmpty(contextForm.ConnID))
                {
                    ClouReaderAPI.CLReader.DIC_CONNECT[contextForm.ConnID].log = null;
                }
                ////}
                contextForm.ConnID = tb_ConnParam.Text.Trim();
                this.DialogResult  = DialogResult.OK;

                //if (this.DialogResult != DialogResult.OK)
                //{
                ////Save to Registry for the connection type
                //RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AssetSystemInfo");

                ////storing the values
                //key.SetValue("ConnectionType", cb_ConnectType.Text);
                //key.SetValue("ConnectionParam", cb_ComNum.Text);
                //key.SetValue("ConnectionParam2", cb_BPS.Text);
                //key.Close();
                //}
            }
            else
            {
                this.DialogResult = DialogResult.No;
            }
        }
        private void GetTagId()
        {
            List <string> listUsbDevicePath = CLReader.GetUsbHidDeviceList();

            if (listUsbDevicePath.Count > 0)
            {
                ConnIDs = listUsbDevicePath[0];
                if (CLReader.CreateUsbConn(ConnIDs, Handle, RFIDPrg))
                {
                    // MessageBox.Show("Connected");
                    // btnGetTagId .Text = "Ok";
                    eReadType eRType = new eReadType();
                    eRType     = eReadType.Single;
                    antennaNum = eAntennaNo._1;

                    int TID = 0;
                    TID = CLReader._Tag6C.GetEPC_TID(ConnIDs, antennaNum, eRType);
                    System.Threading.Thread.Sleep(1000);
                    if (TID != 0)
                    {
                        //  MessageBox.Show(TID.ToString());
                    }
                }
                else
                {
                    MessageBox.Show("Not connected");
                }
            }
            else
            {
                MessageBox.Show("No USB connections Found");
            }
            CLReader.CloseConn(ConnIDs);
            CLReader.CloseAllConnect();
        }
Exemplo n.º 3
0
        // 添加连接事件
        private void contextItem_addConn_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.No;
            TreeNode     tn = tv_ConnectList.SelectedNode;

            //
            if (tn.Name.Equals("SerialRoot"))
            {
                MyForm.Dialog.AddSerial dialog = new MyForm.Dialog.AddSerial(this);
                dr = dialog.ShowDialog(this);
            }
            else if (tn.Name.Equals("RootTcpClient"))
            {
                CLReader.CreateTcpConn("10.8.170.120:7206", this);
            }
            else if (tn.Name.Equals("RootTcpServer"))
            {
            }
            else
            {
            }
            if (dr == DialogResult.OK)
            {
                FlushTreeView();
            }
        }
Exemplo n.º 4
0
        public bool Usbconnect()
        {
            var listUsbDevicePath = CLReader.GetUsbHidDeviceList();

            bool isConnect = CLReader.CreateUsbConn(listUsbDevicePath[0], (IntPtr)1000, new AsynchronousMessage());

            this.ConnID = listUsbDevicePath[0];

            return(isConnect);
        }
Exemplo n.º 5
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            string param = this.tb_SerialParam.Text.Trim();

            if (CLReader.CreateSerialConn(param, contextForm))
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.No;
            }
        }
Exemplo n.º 6
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            bool isConnect = false;                                 // 连接是否成功

            if (cb_ConnectType.SelectedIndex == 0)
            {
                if (cb_ComNum.SelectedIndex >= 0 && cb_BPS.SelectedIndex >= 0)
                {
                    this.tb_ConnParam.Text = cb_ComNum.Text + ":" + cb_BPS.Text;
                    isConnect = CLReader.CreateSerialConn(this.tb_ConnParam.Text, contextForm);
                }
                // Helper.MyXmlHelper.UpdateInnerText(XMLFIENAME, "Root/AddConnect", "SerialConnect", tb_ConnParam.Text.Trim());
            }
            else if (cb_ConnectType.SelectedIndex == 1)
            {
                isConnect = CLReader.CreateTcpConn(tb_ConnParam.Text.Trim(), contextForm);
                Helper.MyXmlHelper.UpdateInnerText(XMLFIENAME, "Root/AddConnect", "TcpConnect", tb_ConnParam.Text.Trim());
            }
            else if (cb_ConnectType.SelectedIndex == 2)
            {
                if (cb_ComNum.SelectedIndex >= 0 && cb_BPS.SelectedIndex >= 0 && !String.IsNullOrEmpty(tb_485Address.Text))
                {
                    this.tb_ConnParam.Text = tb_485Address.Text.Trim() + ":" + cb_ComNum.Text + ":" + cb_BPS.Text;
                    isConnect = CLReader.Create485Conn(this.tb_ConnParam.Text, contextForm);
                }
                // Helper.MyXmlHelper.UpdateInnerText(XMLFIENAME, "Root/AddConnect", "_485Connect", tb_ConnParam.Text.Trim());
            }
            if (isConnect)                                          // 如果连接成功
            {
                if (contextForm.IsMultiConnect == false)            // 单读写器模式
                {
                    contextForm.CloseNowConnect();
                }
                else
                {
                    if (!String.IsNullOrEmpty(contextForm.ConnID))
                    {
                        ClouReaderAPI.CLReader.DIC_CONNECT[contextForm.ConnID].log = null;
                    }
                }
                contextForm.ConnID = tb_ConnParam.Text.Trim();
                this.DialogResult  = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.No;
            }
        }
Exemplo n.º 7
0
        private void btnConnectUSB_Click(object sender, EventArgs e)
        {
            List <string> listUsbDevicePath = CLReader.GetUsbHidDeviceList();

            comboBox1.DataSource = listUsbDevicePath;
            int i = listUsbDevicePath.Count;

            textBox3.Text = i.ToString();

            if (listUsbDevicePath.Count > 0)
            {
                ConnIDs = listUsbDevicePath[0];
                if (CLReader.CreateUsbConn(ConnIDs, Handle, RFIDPrg))
                {
                    MessageBox.Show("Connected");
                    eReadType eRType = new eReadType();
                    eRType     = eReadType.Inventory;
                    antennaNum = eAntennaNo._1;

                    int TID = 0;
                    TID = CLReader._Tag6C.GetEPC_TID(ConnIDs, antennaNum, eRType);
                    if (TID != 0)
                    {
                        MessageBox.Show("Data Read");
                    }
                }
                else
                {
                    MessageBox.Show("Not connected");
                }
            }
            else
            {
                MessageBox.Show("No USB connections Found");
            }

            CLReader.CloseConn(ConnIDs);
            CLReader.CloseAllConnect();

            btnReturnButton.Visible = true;
            //this.Close();
        }
Exemplo n.º 8
0
        public void AddNewStudent()
        {
            txtName.ReadOnly                   = false;
            txtClass.ReadOnly                  = false;
            txtRollNos.ReadOnly                = false;
            txtClassTeacher.ReadOnly           = false;
            txtClassTeacherContactNos.ReadOnly = false;
            txtGuardianName.ReadOnly           = false;
            txtGuardiancontactNumber.ReadOnly  = false;
            txtHomeAddress.ReadOnly            = false;
            txtSiblingInformation.ReadOnly     = false;
            txtJoinedSchoolDate.ReadOnly       = false;
            txtBloodGroup.ReadOnly             = false;
            txtWarnings.ReadOnly               = false;
            txtNotes.ReadOnly                  = false;
            txtEntryTime.ReadOnly              = false;
            txtExitTime.ReadOnly               = false;
            txtDate.ReadOnly                   = false;
            txtLastNotedLocation.ReadOnly      = false;
            txtAttendenceInDays.ReadOnly       = false;
            txtGender.ReadOnly                 = false;
            txtAadharNos.ReadOnly              = false;

            panel3.Visible        = false;
            btnSaveNExit.Visible  = true;
            isAddingNewStudent    = true;
            GetRFID_panel.Visible = true;

            if (GetRFID_panel.Visible == true)
            {
                #region READRFID

                //Show RFID reading first.
                GetRFID_panel.Width  = 800;
                GetRFID_panel.Height = 800;

                //Disable exit button and background.
                btnExitButton.Visible = false;

                ProgramCLUSB  RFIDPrg           = new ProgramCLUSB();
                List <string> listUsbDevicePath = new List <string>();

                string     ConnIDs    = "";
                eAntennaNo antennaNum = eAntennaNo._1;
                eReadType  eRType     = eReadType.Single;


                try
                {
                    listUsbDevicePath = CLReader.GetUsbHidDeviceList();
                }
                catch (Exception eee)
                {
                    MessageBox.Show(eee.ToString());
                }



                if (listUsbDevicePath.Count > 0)
                {
                    ConnIDs = listUsbDevicePath[0];

                    if (CLReader.CreateUsbConn(ConnIDs, Handle, RFIDPrg))
                    {
                        MessageBox.Show("Connected");


                        int TID = 0;

                        TID = CLReader._Tag6C.GetEPC_TID(ConnIDs, antennaNum, eRType);


                        if (TID > 0)
                        {
                            MessageBox.Show("Data Read");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Not connected");
                    }
                }
                else
                {
                    MessageBox.Show("No USB connections Found");
                }


                scanID.Text = "ID of Tag =" + TagRead;

                CLReader.CloseConn(ConnIDs);
                CLReader.CloseAllConnect();
                btnExitButton.Visible = true;
                txtStudentId.Text     = TagRead;



                btnSaveNExit.Visible = true;
                btnSaveNExit.Enabled = true;
            }


            #endregion
        }