Пример #1
0
        private void myTimer_Tick(object sender, EventArgs e)
        {
            foreach (Control item in Controls)
            {
                if (item is Label && item.Tag != null)
                {
                    string[] res   = item.Tag.ToString().Split('_');
                    int      index = Convert.ToInt32(res[1]);
                    if (CommonMethods.CurrentValue.Count > 0 && CommonMethods.CurrentValue.ContainsKey(index))
                    {
                        FlowData flowData = CommonMethods.CurrentValue[index];
                        switch (res[0])
                        {
                        case "Temp": item.Text = flowData.Temp.ToString() + " ℃"; break;

                        case "Pressure": item.Text = flowData.Pressure.ToString() + " Bar"; break;

                        case "FlowInstant": item.Text = flowData.FlowInstant.ToString() + " m3/h"; break;

                        case "FlowTotal": item.Text = flowData.FlowTotal.ToString() + " m3/h"; break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
Пример #2
0
 private FlowData Analyse(byte[] byteArray)
 {
     if (byteArray != null && byteArray.Length == 16)
     {
         FlowData flowData = new FlowData();
         flowData.Temp        = ByteToFloatByPoint(new byte[] { byteArray[0], byteArray[1], byteArray[2], byteArray[3] });
         flowData.Pressure    = ByteToFloatByPoint(new byte[] { byteArray[4], byteArray[5], byteArray[6], byteArray[7] });
         flowData.FlowInstant = ByteToFloatByPoint(new byte[] { byteArray[8], byteArray[9], byteArray[10], byteArray[11] });
         flowData.FlowTotal   = ByteToFloatByPoint(new byte[] { byteArray[12], byteArray[13], byteArray[14], byteArray[15] });
         return(flowData);
     }
     else
     {
         return(null);
     }
 }