示例#1
0
        void textBoxStatus_TextChanged(object sender, EventArgs e)
        {
            string sTemp = "";

            foreach (char c in textBoxStatus.Text)
            {
                if (IsHex(c))
                {
                    sTemp += c;
                }
            }

            textBoxStatus.Text = sTemp;

            if (!string.IsNullOrEmpty(sTemp.Trim()))
            {
                _comboBoxStatusEnable = false;
                int nValue = Convert.ToInt32(sTemp, 16);

                ServiceStatusItem i = ServiceStatusItems.Find(item => Convert.ToInt32(item.Value) == nValue);

                if (i != null)
                {
                    comboBoxStatus.Text = i.Name;
                }
                else
                {
                    comboBoxStatus.Text = _sUserDefined;
                }
                _comboBoxStatusEnable = true;
            }
        }
示例#2
0
 void comboBoxStatus_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_comboBoxStatusEnable)
     {
         ServiceStatusItem item = comboBoxStatus.SelectedItem as ServiceStatusItem;
         if (Convert.ToInt32(item.Value) == -1)
         {
             textBoxStatus.Text = "0000";
         }
         else
         {
             textBoxStatus.Text = item.ToHexValue();
         }
     }
 }
示例#3
0
        public void InitializeServiceStatusItems()
        {
            comboBoxStatus.Items.Clear();
            foreach (ServiceStatusItem item in ServiceStatusItems)
            {
                comboBoxStatus.Items.Add(item);
            }
            comboBoxStatus.SelectedIndex = 0;

            // Find the user defined item in the list (-1)
            ServiceStatusItem i = ServiceStatusItems.Find(item => Convert.ToInt32(item.Value) == -1);

            if (i != null)
            {
                _sUserDefined = i.Name;
            }
        }