Ejemplo n.º 1
0
 public void useResult(string result)
 {
     if (this.InvokeRequired)
     {
         SetUsedCallback d = new SetUsedCallback(useResult);
         this.Invoke(d, new object[] { result });
     }
     else
     {
         result = result.Replace("\r\n", "");
         if (preValue != result)
         {
             if (string.Compare(result, "OK") == 0)
             {
                 CalcRequestCommand();
             }
             else
             {
                 bool txt;
                 txt = Convert.ToBoolean(Convert.ToInt16(result));
                 if (txt == true)
                 {
                     Button1.BackColor = System.Drawing.Color.Green;
                     Button1.Text      = "ON";
                 }
                 else
                 {
                     Button1.BackColor = System.Drawing.Color.Red;
                     Button1.Text      = "OFF";
                 }
                 preValue = result;
             }
         }
     }
 }
Ejemplo n.º 2
0
 public void useResult(string result)
 {
     if (link.enable == false)
     {
         return;
     }
     if (this.InvokeRequired)
     {
         SetUsedCallback d = new SetUsedCallback(useResult);
         this.Invoke(d, new object[] { result });
     }
     else
     {
         result = result.Replace("\r\n", "");
         if (preValue != result)
         {
             if (result.CompareTo("E6") == 0)
             {
                 Label1.Text = "No comment";
             }
             else
             {
                 Label1.Text = result;
             }
             preValue = result;
         }
     }
 }
Ejemplo n.º 3
0
        public void useResult(string result)
        {
            if (this.InvokeRequired)
            {
                SetUsedCallback d = new SetUsedCallback(useResult);
                this.Invoke(d, new object[] { result });
            }
            else
            {
                result = result.Replace("\r\n", "");
                if (preValue != result)
                {
                    if (string.Compare(result, "OK") == 0)
                    {
                        CalcCommand();
                    }
                    else
                    {
                        string txt = "";
                        switch (DataFormat)
                        {
                        case ".U":
                            txt = System.Convert.ToString(Convert.ToUInt16(result));
                            break;

                        case ".S":
                            txt = System.Convert.ToString(Convert.ToInt16(result));
                            break;

                        case ".D":
                            txt = System.Convert.ToString(Convert.ToUInt32(result));
                            break;

                        case ".L":
                            txt = System.Convert.ToString(Convert.ToInt32(result));
                            break;

                        case ".H":
                            txt = result;
                            break;

                        default:
                            txt = System.Convert.ToString(Convert.ToUInt16(result));
                            break;
                        }
                        txtValue.Text = txt;
                        preValue      = result;
                    }
                }
            }
        }