コード例 #1
0
ファイル: Client.cs プロジェクト: vinodmishra/Broadlink.NET
 /// <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ı!");
     }
 }
コード例 #2
0
 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ı!");
     }
 }
コード例 #3
0
 /// <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)
     {
     }
 }