private void WlanService_WlanConnectionNotification(Wlan.WlanNotificationData notifyData, Wlan.WlanConnectionNotificationData connNotifyData)
        {
            var dot11Ssid = connNotifyData.dot11Ssid;
            var wlanNMAE  = WlanService.GetWlanNameBySsid(dot11Ssid);

            Debug.WriteLine(wlanNMAE);
        }
 private void DisconnectButton_OnClick(object sender, RoutedEventArgs e)
 {
     if (sender is FrameworkElement element && element.DataContext is WlanInfoItem wlanInfoItem)
     {
         WlanService.DisConnectToWlan(wlanInfoItem);
     }
 }
 public MainWindow()
 {
     InitializeComponent();
     Loaded     += MainWindow_Loaded;
     WlanService = new WlanService();
     WlanService.WlanConnectionNotification += WlanService_WlanConnectionNotification;
     WlanService.WlanNotification           += WlanService_WlanNotification;
     WlanService.WlanReasonNotification     += WlanService_WlanReasonNotification;
 }
示例#4
0
 private void InitializeServices()
 {
     if (_event != null)
     {
         _event.Dispose();
     }
     _wlan         = WlanService.Instance;
     _wpCollection = WallpaperCollection.ReadXml();
     _event        = new EventService(_wpCollection);
     _event.RegisterEvent();
 }
 private void WifiPasswardInputWindow_Comfirmed(object sender, EventArgs e)
 {
     if (sender is WifiPasswardInputWindow wifiInfoWindow)
     {
         var wlanInfoItem   = wifiInfoWindow.WlanInfoItem;
         var connectSuccess = WlanService.ConnectToWlan(wlanInfoItem, wifiInfoWindow.Password, wifiInfoWindow.IsAutoConnect, out var errorMsg);
         if (!connectSuccess)
         {
             MessageBox.Show(errorMsg);
         }
     }
 }