public WlanClient()
 {
     Wlan.ThrowIfError(Wlan.WlanOpenHandle(1U, IntPtr.Zero, out this.negotiatedVersion, out this.clientHandle));
     try
     {
         this.wlanNotificationCallback = new Wlan.WlanNotificationCallbackDelegate(this.OnWlanNotification);
         Wlan.WlanNotificationSource prevNotifSource;
         Wlan.ThrowIfError(Wlan.WlanRegisterNotification(this.clientHandle, Wlan.WlanNotificationSource.All, false, this.wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevNotifSource));
     }
     catch
     {
         this.Close();
         throw;
     }
 }
示例#2
0
 /// <summary>
 /// Creates a new instance of a Native Wifi service client.
 /// </summary>
 public WlanClient()
 {
     Wlan.ThrowIfError(
         Wlan.WlanOpenHandle(Wlan.WLAN_CLIENT_VERSION_XP_SP2, IntPtr.Zero, out negotiatedVersion, out clientHandle));
     try
     {
         Wlan.WlanNotificationSource prevSrc;
         wlanNotificationCallback = OnWlanNotification;
         Wlan.ThrowIfError(
             Wlan.WlanRegisterNotification(clientHandle, Wlan.WlanNotificationSource.All, false, wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevSrc));
     }
     catch
     {
         Close();
         throw;
     }
 }