//create your own data handler for your project needs private void handleTempSensorData(string strData, string strTime, string ID) { int max = Convert.ToInt32(retrieveTempSetting()[0]); int warn = Convert.ToInt32(retrieveTempSetting()[1]); //update GUI component in any tabs string strtempValue = extractStringValue(strData, ID); float ftempValue = extractFlotValue(strData, ID); if (ftempValue > max) { tbtemp.BackColor = Color.Red; tbtemp.ForeColor = Color.White; TempStatus = "OVER MAX! Activating Reduction now"; if (!lbLiveStatus.Items.Contains(TempStatus)) { lbLiveStatus.Items.Insert(0, TempStatus); } dataComms.sendData("BUZZ"); Console.WriteLine("BUZZING"); } else if (ftempValue > warn) { TempStatus = "warning!!"; dataComms.sendData("WARN"); } else { tbtemp.BackColor = Color.FromArgb(0, 192, 0); tbtemp.ForeColor = Color.Black; if (lbLiveStatus.Items.Contains(TempStatus)) { lbLiveStatus.Items.Remove(TempStatus); } dataComms.sendData("Normal"); } //string temp = strtempValue.Substring(0, 5) + "°C"; tbtemp.Text = strtempValue + "°C"; retrieveTempSetting(); saveTempSensorDataToDB(strTime, strtempValue, strtempValue); }
private void sendDataToWindows(string strDataOut) { try { datacomms.sendData(strDataOut); Debug.WriteLine("Sending Msg : " + strDataOut); } catch (Exception) { Debug.WriteLine("ERROR. DId u forget to initcomms()?"); } }