private void Handle_Disconnected(object sender, Co0nUtilZ.ProgressEventArgs e) { if (this.Disconnected != null) { this.Disconnected(); } }
private void Handle_DataReceived(object sender, Co0nUtilZ.ProgressEventArgs e) { if (e.Message.StartsWith("LED-Control ready.")) {//Schritt eins if (this.ControllerReady != null) { this.ControllerReady(); } if (this._okcount == 0) { this.tcpclient.SendData(this._ledcode + "\r\n"); //Set LEDs on } } else if (e.Message.StartsWith("command ok")) { this._okcount += 1; if (this._okcount == 1) { //Schritt zwei if (this._duration > 0) { //Set LEDs back to normal if duration is > 0. if it is set below zero, LEDs will stay on forever Thread.Sleep(this._duration); //Wait this.tcpclient.SendData("000\r\n"); //Set LEDS Off } else { //Exit directly Thread.Sleep(50); //Wait 50ms this.tcpclient.SendData("exit\r\n"); //Verbindung trennen } } else if (this._okcount == 2) { //Duration must be above Thread.Sleep(50); //Wait 50ms this.tcpclient.SendData("exit\r\n"); //Verbindung trennen } } else if (e.Message.StartsWith("good bye")) { if (this.Jobdone != null) { this.Jobdone(this, this._okshouldbe - this._okcount); //0 wenn Erfolg } } else if (e.Message.StartsWith("command error")) {//Fehler: ungültiger Befehl if (this.ErrorOccured != null) { this.ErrorOccured(this, new Co0nUtilZ.ErrorEventArgs("Error: " + e.Message)); } } else { if (this.otherMessagereceived != null) { this.otherMessagereceived(this, new Co0nUtilZ.ProgressEventArgs(0, e.Message)); } } }
private void Handle_DataReceived(object sender, Co0nUtilZ.ProgressEventArgs e) { if (e.Message.StartsWith("LED-Control ready.")) { this.GUIswitchLEDControllerReady(true); } else if (e.Message.StartsWith("good bye")) { this.Handle_Disconnected(this, new Co0nUtilZ.ProgressEventArgs(-9)); } }
private static void Handle_MsgReceived(object sender, Co0nUtilZ.ProgressEventArgs e) { Console.WriteLine("\r\nUnerwartete Antwort: " + e.Message); }
private void Handle_DataSent(object sender, Co0nUtilZ.ProgressEventArgs e) { }
private void Handle_Disconnected(object sender, Co0nUtilZ.ProgressEventArgs e) { this.GUIswitchDisConnected(false); this.GUIswitchLEDControllerReady(false); }
private void Handle_Connected(object sender, Co0nUtilZ.ProgressEventArgs e) { this.GUIswitchDisConnected(true); }
private void Handle_Connected(object sender, Co0nUtilZ.ProgressEventArgs e) { }