示例#1
0
 /// <summary>
 /// left_Click_
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btleft_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (listBoxAddr.SelectedIndex < 0)
         {
             return;
         }
         ComboBindData item     = (ComboBindData)(this.listBoxAddr.SelectedItem);
         bool          isExists = false;
         foreach (ComboBindData o in listBoxChooseAddr.Items)
         {
             if (o.ValueMember == item.ValueMember)
             {
                 isExists = true;
                 break;
             }
         }
         if (!isExists)
         {
             this.listBoxChooseAddr.Items.Add(new ComboBindData(item.DisplayMember, item.ValueMember));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
        /// <summary>
        /// Set Epc Filter
        /// </summary>
        private void SetEpcFilter()
        {
            string errInfo = "";
            string strhex  = FormatConvert.HaxToStr(tvEpcData.Text.Trim());

            if (strhex == "" ||
                strhex.Length != 24)
            {
                AddToStatusAsync("Input tag EPC(12-byte)!");
                tvEpcData.Focus();
                return;
            }
            if (listBoxChooseAddr.Items.Count < 1)
            {
                AddToStatusAsync("Select matched data!");
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();
            try
            {
                byte[] match = new byte[this.listBoxAddr.Items.Count];
                for (int i = 0; i < match.Length; i++)
                {
                    match[i] = 0x00;
                }
                foreach (object o in this.listBoxChooseAddr.Items)
                {
                    ComboBindData item = (ComboBindData)o;
                    int           iadd = Convert.ToInt32(item.ValueMember);
                    match[iadd] = 0xFF;
                }
                byte[] bcode = Util.ConvertHexStringToByteArray(strhex);

                if (RfidConfig.SetEpcFilter(0x00, bcode, match, out errInfo))
                {
                    AddToStatusAsync("Configure EPC match completed.");
                    FormatConvert.SoundSucceed();
                    Close();
                }
                else
                {
                    FormatConvert.SoundError();
                    AddToStatusAsync("Configure EPC match failed!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Cursor.Current = Cursors.Default;
        }
示例#3
0
        /// <summary>
        /// Move Point
        /// </summary>
        private void UiMovePoint()
        {
            if (lbdisplay.SelectedIndex < 0)
            {
                return;
            }
            ComboBindData selB = (ComboBindData)lbdisplay.SelectedItem;

            if (selB != null)
            {
                lbdisplay.Items.Remove(selB);
            }
        }
示例#4
0
        /// <summary>
        /// Frequency Query Display
        /// </summary>
        /// <param name="val"></param>
        /// <returns></returns>
        private string FrequencyQueryDisplay(int val)
        {
            string result = val.ToString();

            try
            {
                ComboBindData bindA    = freqListLB[0];
                ComboBindData bindB    = freqListLB[1];
                int           aVal     = Convert.ToInt32(bindA.ValueMember);
                double        aShow    = Convert.ToDouble(bindA.DisplayMember);
                int           bVal     = Convert.ToInt32(bindB.ValueMember);
                double        bShow    = Convert.ToDouble(bindB.DisplayMember);
                int           stepVal  = bVal - aVal;
                double        stepShow = bShow - aShow;

                double curFreq = aShow + (val - aVal) * stepShow;
                result = curFreq.ToString("F3");
            }
            catch { }
            return(result);
        }
示例#5
0
        /// <summary>
        /// Set Frequency
        /// </summary>
        private void SetFrequency()
        {
            string errInfo = "";

            if (lbdisplay.Items.Count < 1)
            {
                AddToStatusAsync("No frequency.");
                return;
            }
            List <byte> freqList = new List <byte>();

            foreach (object b in lbdisplay.Items)
            {
                ComboBindData cbd = (ComboBindData)b;
                freqList.Add(Convert.ToByte(cbd.ValueMember));
            }
            if (freqList.Count > 0)
            {
                if (RfidConfig.SetFrequency(freqList.ToArray(), out errInfo))
                {
                    AddToStatusAsync("Set frequency completed.");
                    FormatConvert.SoundSucceed();
                    Close();
                    return;
                }
                else
                {
                    AddToStatusAsync("Set Failed," + errInfo);
                    FormatConvert.SoundError();
                }
            }
            else
            {
                AddToStatusAsync("No frequency.");
            }
        }