void Display(string s) { try { double en = double.Parse(s); chart1.Series[0].Points.AddY(en); if (en > 40) { EmailSend.SendMail("*****@*****.**", "Culprit detected", "Invalid License " + DateTime.Now, ""); } } catch { } }
void Display(string s) { try { double en = double.Parse(s); chart1.Series[0].Points.AddY(en); if (en > 40) { EmailSend.SendMail("*****@*****.**", "Fire at home Alarm", "Fire at Home Alarm " + DateTime.Now, ""); } //string s = UpdateThingSpeakData(new string[] { "40", "40" }, "C606GJW98AWMN9P9"); string s1 = UpdateThingSpeakData(new string[] { en.ToString() }, "SCLQDRSCCSDEVYH2"); } catch { } }
private void btnUnlock_Click(object sender, EventArgs e) { if (!label4.Text.Contains("Unknown")) { serialPort1.WriteLine("6"); btnLock.BackColor = ac; btnUnlock.BackColor = Color.Green; } else { //// Send a Mail (new System.Speech.Synthesis.SpeechSynthesizer()).SpeakAsync("Unauthorized Attempt!!!"); String fileName = ".\\Unknown\\Image_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".jpg";//Save the filename first on imageBoxFrameGrabber.Image.Save(fileName); EmailSend.SendMail("*****@*****.**", "Unknown Person", "Unknown person attempting unlock " + DateTime.Now, fileName); /////// } }
void mc_MqttMsgPublishReceived(object sender, uPLibrary.Networking.M2Mqtt.Messages.MqttMsgPublishEventArgs e) { //throw new NotImplementedException(); //MessageBox.Show(GetString(e.Message)); string s = ""; try { byte b = e.Message[0]; //e.Retain = false; s = (b - 48).ToString(); } catch { return; } this.Invoke((MethodInvoker) delegate { if (s.Equals("1")) { btnBulbOn_Click(btnBulbOn, new EventArgs()); } if (s.Equals("2")) { btnBulbOff_Click(btnConnect, new EventArgs()); } if (s.Equals("3")) { btnFanOn_Click(btnFanOn, new EventArgs()); } if (s.Equals("4")) { btnFanOff_Click(btnFanOff, new EventArgs()); } if (s.Equals("0")) { btnAllOff_Click(btnAllOff, new EventArgs()); } if (s.Equals("5")) { if (grpDoor.Enabled) { btnLock_Click(btnAllOff, new EventArgs()); } else { (new System.Speech.Synthesis.SpeechSynthesizer()).SpeakAsync("Unauthorized Attempt!!!"); } } if (s.Equals("6")) { if (grpDoor.Enabled) { btnUnlock_Click(btnAllOff, new EventArgs()); } else { (new System.Speech.Synthesis.SpeechSynthesizer()).SpeakAsync("Unauthorized Attempt!!!"); String fileName = ".\\Unknown\\Image_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".jpg";//Save the filename first on imageBoxFrameGrabber.Image.Save(fileName); EmailSend.SendMail("*****@*****.**", "Unknown Person", "Unknown person attempting unlock " + DateTime.Now, fileName); } } }); }