public static WindowsWiFiWrapper Create() { var obj = Platform.GetImplementation(Platform.PlatformImplementation.WiFi) as IWiFiWrapper; if (obj == null) { obj = new WindowsWiFiWrapper(); Logging.Info(obj.ToString()); obj.Initialize(); Platform.RegisterImplementation(Platform.PlatformImplementation.WiFi, obj); } return((WindowsWiFiWrapper)obj); }
private async void InitializeAsync() { try { WindowsWiFiWrapper.Create(); // initialize WiFi wrapper } catch (Exception ex) { if (App.Settings.IsNetworkActionsEnabled) { App.Settings.IsNetworkActionsEnabled = false; App.Settings.Save(); } Logging.Info("IMPORTANT: WiFi manager is not initialized. Probably, Windows-WiFi service stopped. (" + IVPNException.GetDetailedMessage(ex) + ")"); } MainViewModel.PropertyChanged += MainViewModel_PropertyChanged; if (Service.State == ServiceState.Uninitialized) { await InitViewModel.InitializeAsync(); } }