public MainWindow() { InitializeComponent(); for (int i = 0; i < sTX.Length; i++) { sTX[i] = Convert.ToByte(false); } SendStates(sRX); updater = new Updater(); UDP_RX _RX = new UDP_RX(); this.SuscribeToEvent(_RX); Thread trh = new Thread(_RX.Listen); trh.IsBackground = true; trh.Start(); //this.Dispatcher.Invoke(() => { this.SuscribeToEvent(_RX); }); //Thread t = new Thread(_RX.Listen); //t.SetApartmentState(ApartmentState.STA); //t.Start(); //UDP_RX.fan1 = fan1; }
public void SuscribeToEvent(UDP_RX reciever) { reciever.DataReceivedEvent += receiver_DataReceivedEvent; }