private void FMain_FormClosing(object sender, FormClosingEventArgs e) { Trace.TraceInformation("-------------------------------------------Closed by user------------------------------------------"); udpListener.DataReceived -= UDPDataReceived; udpListener.StopListener(); Application.DoEvents(); }
private static void StopListener() { if (listener != null) { listener.StopListener(); } }
private void StopUDPpListener() { if (UDPListener != null) { UDPListener.DeviceNotificationRecieved -= HandleUDP; UDPListener.StopListener(); } }
public ItemDetailViewModel() { Title = "UDPData"; StartListener = new Command((object arg) => { if (listener == null) { listener = new UDPListener(); listener.OnReceive += Listener_OnReceive; listener.OnStart += Listener_OnStart; listener.OnStop += Listener_OnStop; } listener.StartListener(); }, CanExecuteStartListener); StopListener = new Command((object arg) => { if (listener != null) { listener.StopListener(); } }, CanExecuteStopListener); }