/// <summary> /// Discover Broadlink Device /// </summary> /// <returns>Triggered Event <see cref="DeviceHandler" /></returns> public async Task DiscoverAsync() { try { if (ClientSocket == null) { bool internetVarmi = HelperMy.IsInternetAvailable; if (!internetVarmi) { HelperMy.Notification(Color.Red, "İnternet bağlantısı yok!"); } do { internetVarmi = HelperMy.IsInternetAvailable; if (internetVarmi) { ClientSocket = new MyUdpSocketReceiver(); ClientSocket.MessageReceived += new EventHandler <UdpReceiveResult>(ClientSocket_MessageReceived); await ClientSocket.StartListeningAsync(); } else { await Task.Delay(500); } } while (!internetVarmi); } await SendDiscoveryPacketAsync(); } catch (Exception) { HelperMy.Notification(Color.Red, "Soket Bağlantısı Kurulamadı!"); } }
private async Task Start_ClientListenAsync() { try { bool internetVarmi = true; if (!internetVarmi) { HelperMy.Notification(Color.Red, "İnternet bağlantısı yok!"); } do { internetVarmi = true; if (internetVarmi) { ClientSocket = new MyUdpSocketReceiver(); ClientSocket.MessageReceived += new EventHandler <UdpReceiveResult>(ClientSocket_MessageReceived); await ClientSocket.StartListeningAsync(); } else { await Task.Delay(500); } } while (!internetVarmi); } catch (Exception) { HelperMy.Notification(Color.Red, "Soket Bağlantısı Kurulamadı!"); } }
/// <summary> /// Discover Broadlink Device /// </summary> /// <returns>Triggered Event <see cref="DeviceHandler" /></returns> public async Task DiscoverAsync() { try { if (ClientSocket == null) { ClientSocket = new MyUdpSocketReceiver(); ClientSocket.MessageReceived += new EventHandler <UdpReceiveResult>(ClientSocket_MessageReceived); await ClientSocket.StartListeningAsync(); } await SendDiscoveryPacketAsync(); } catch (Exception) { } }