├── src └── MAUIWifiManager │ ├── images │ └── icon.png │ ├── docs │ └── README.md │ ├── IWifiNetworkService.shared.cs │ ├── NetworkData.cs │ ├── CrossWifiManager.shared.cs │ ├── MauiWifiManager.csproj │ ├── WifiNetworkService.apple.cs │ ├── WifiNetworkService.windows.cs │ └── WifiNetworkService.android.cs ├── samples ├── Resources │ ├── Images │ │ └── dotnet_bot.png │ ├── Fonts │ │ ├── OpenSans-Regular.ttf │ │ └── OpenSans-Semibold.ttf │ ├── AppIcon │ │ ├── appicon.svg │ │ └── appiconfg.svg │ ├── Raw │ │ └── AboutAssets.txt │ ├── Splash │ │ └── splash.svg │ └── Styles │ │ ├── Colors.xaml │ │ └── Styles.xaml ├── Services │ └── IGpsService.cs ├── Properties │ └── launchSettings.json ├── ConnectWifiContainer.xaml.cs ├── AppShell.xaml.cs ├── App.xaml.cs ├── Platforms │ ├── Android │ │ ├── Resources │ │ │ └── values │ │ │ │ └── colors.xml │ │ ├── MainApplication.cs │ │ ├── AndroidManifest.xml │ │ ├── Services │ │ │ └── GpsService.cs │ │ └── MainActivity.cs │ ├── iOS │ │ ├── AppDelegate.cs │ │ ├── Entitlements.plist │ │ ├── Program.cs │ │ ├── Services │ │ │ └── GpsService.cs │ │ └── Info.plist │ ├── MacCatalyst │ │ ├── AppDelegate.cs │ │ ├── Services │ │ │ └── GpsService.cs │ │ ├── Program.cs │ │ ├── Entitlements.plist │ │ └── Info.plist │ ├── Windows │ │ ├── App.xaml │ │ ├── app.manifest │ │ ├── App.xaml.cs │ │ ├── Services │ │ │ └── GpsService.cs │ │ └── Package.appxmanifest │ └── Tizen │ │ ├── Main.cs │ │ └── tizen-manifest.xml ├── AppShell.xaml ├── ConnectWifiContainer.xaml ├── NetworkData.cs ├── ScanQr.xaml ├── App.xaml ├── ConnectWifi.xaml.cs ├── ScanAndConnect.xaml.cs ├── MauiProgram.cs ├── ScanQr.xaml.cs ├── ScanAndConnect.xaml ├── DisconnectWifi.xaml.cs ├── DemoApp.sln ├── DisconnectWifi.xaml ├── ConnectWifi.xaml ├── NetworkInfo.xaml.cs ├── ScanListPage.xaml.cs ├── ScanListPage.xaml ├── DemoApp.csproj ├── MainPage.xaml.cs ├── NetworkInfo.xaml └── MainPage.xaml ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ ├── build-maui-app-ci.yml │ └── release-nuget.yml ├── LICENSE.md ├── .gitattributes ├── README.md └── .gitignore /src/MAUIWifiManager/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exendahal/maui_wifi_manager/HEAD/src/MAUIWifiManager/images/icon.png -------------------------------------------------------------------------------- /samples/Resources/Images/dotnet_bot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exendahal/maui_wifi_manager/HEAD/samples/Resources/Images/dotnet_bot.png -------------------------------------------------------------------------------- /samples/Resources/Fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exendahal/maui_wifi_manager/HEAD/samples/Resources/Fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /samples/Resources/Fonts/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exendahal/maui_wifi_manager/HEAD/samples/Resources/Fonts/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /samples/Services/IGpsService.cs: -------------------------------------------------------------------------------- 1 | namespace DemoApp.Services.Interfaces 2 | { 3 | public interface IGpsService 4 | { 5 | Task GpsStatus(); 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /samples/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Windows Machine": { 4 | "commandName": "MsixPackage", 5 | "nativeDebugging": false 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/MAUIWifiManager/docs/README.md: -------------------------------------------------------------------------------- 1 | .NET MAUI Wi-Fi Manager simplifies Wi-Fi management in cross-platform apps. With its APIs, you can easily connect to, manage, and retrieve Wi-Fi network information. -------------------------------------------------------------------------------- /samples/ConnectWifiContainer.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace DemoApp; 2 | 3 | public partial class ConnectWifiContainer : TabbedPage 4 | { 5 | public ConnectWifiContainer() 6 | { 7 | InitializeComponent(); 8 | } 9 | } -------------------------------------------------------------------------------- /samples/AppShell.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace DemoApp 2 | { 3 | public partial class AppShell : Shell 4 | { 5 | public AppShell() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace DemoApp 2 | { 3 | public partial class App : Application 4 | { 5 | public App() 6 | { 7 | InitializeComponent(); 8 | 9 | MainPage = new AppShell(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/Resources/AppIcon/appicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/Platforms/Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #512BD4 4 | #2B0B98 5 | #2B0B98 6 | -------------------------------------------------------------------------------- /samples/Platforms/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace DemoApp 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/Platforms/MacCatalyst/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace DemoApp 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/Platforms/MacCatalyst/Services/GpsService.cs: -------------------------------------------------------------------------------- 1 | using DemoApp.Services.Interfaces; 2 | 3 | namespace DemoApp.Platforms 4 | { 5 | public class GpsService : IGpsService 6 | { 7 | public Task GpsStatus() 8 | { 9 | return Task.FromResult(true); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/Platforms/Windows/App.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/AppShell.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/Platforms/iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.networking.wifi-info 6 | 7 | com.apple.developer.networking.HotspotConfiguration 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /samples/Platforms/Tizen/Main.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui; 2 | using Microsoft.Maui.Hosting; 3 | using System; 4 | 5 | namespace DemoApp 6 | { 7 | internal class Program : MauiApplication 8 | { 9 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 10 | 11 | static void Main(string[] args) 12 | { 13 | var app = new Program(); 14 | app.Run(args); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/ConnectWifiContainer.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/Platforms/Android/MainApplication.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Runtime; 3 | 4 | namespace DemoApp 5 | { 6 | [Application] 7 | public class MainApplication : MauiApplication 8 | { 9 | public MainApplication(IntPtr handle, JniHandleOwnership ownership) 10 | : base(handle, ownership) 11 | { 12 | } 13 | 14 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/Platforms/iOS/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace DemoApp 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/NetworkData.cs: -------------------------------------------------------------------------------- 1 | namespace DemoApp 2 | { 3 | public class NetworkDataModel 4 | { 5 | public int StatusId { get; set; } 6 | public string? Ssid { get; set; } 7 | public string? SsidName { get { return string.IsNullOrWhiteSpace(Ssid) ? "Unknown" : Ssid; } } 8 | public int IpAddress { get; set; } 9 | public string? GatewayAddress { get; set; } 10 | public object? NativeObject { get; set; } 11 | public object? Bssid { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/Platforms/MacCatalyst/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace DemoApp 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/ScanQr.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /samples/App.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: exendahal 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /samples/Resources/Raw/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories). Deployment of the asset to your application 3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. 4 | 5 | 6 | 7 | These files will be deployed with you package and will be accessible using Essentials: 8 | 9 | async Task LoadMauiAsset() 10 | { 11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); 12 | using var reader = new StreamReader(stream); 13 | 14 | var contents = reader.ReadToEnd(); 15 | } 16 | -------------------------------------------------------------------------------- /samples/Platforms/MacCatalyst/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.apple.security.app-sandbox 8 | 9 | 10 | com.apple.security.network.client 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/Platforms/Windows/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/Platforms/Tizen/tizen-manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | maui-appicon-placeholder 7 | 8 | 9 | 10 | 11 | http://tizen.org/privilege/internet 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: exendahal 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Device(please complete the following information):** 27 | - Device: [e.g. iPhone6] 28 | - OS: [e.g. iOS8.1] 29 | - Version [e.g. 22] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /samples/Platforms/Windows/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | 3 | // To learn more about WinUI, the WinUI project structure, 4 | // and more about our project templates, see: http://aka.ms/winui-project-info. 5 | 6 | namespace DemoApp.WinUI 7 | { 8 | /// 9 | /// Provides application-specific behavior to supplement the default Application class. 10 | /// 11 | public partial class App : MauiWinUIApplication 12 | { 13 | /// 14 | /// Initializes the singleton application object. This is the first line of authored code 15 | /// executed, and as such is the logical equivalent of main() or WinMain(). 16 | /// 17 | public App() 18 | { 19 | this.InitializeComponent(); 20 | } 21 | 22 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /samples/Platforms/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/Platforms/Windows/Services/GpsService.cs: -------------------------------------------------------------------------------- 1 | using DemoApp.Services.Interfaces; 2 | using Windows.Devices.Geolocation; 3 | 4 | namespace DemoApp.Platforms 5 | { 6 | public class GpsService : IGpsService 7 | { 8 | public async Task GpsStatus() 9 | { 10 | try 11 | { 12 | var accessStatus = await Geolocator.RequestAccessAsync(); 13 | if (accessStatus != GeolocationAccessStatus.Allowed) 14 | return false; 15 | 16 | var geolocator = new Geolocator(); 17 | var pos = await geolocator.GetGeopositionAsync(); 18 | return true; 19 | } 20 | catch (UnauthorizedAccessException) 21 | { 22 | return false; 23 | } 24 | catch 25 | { 26 | return false; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /samples/Platforms/iOS/Services/GpsService.cs: -------------------------------------------------------------------------------- 1 | using CoreLocation; 2 | using DemoApp.Services.Interfaces; 3 | 4 | namespace DemoApp.Platforms 5 | { 6 | public class GpsService : IGpsService 7 | { 8 | public Task GpsStatus() 9 | { 10 | if (CLLocationManager.LocationServicesEnabled) 11 | { 12 | if (CLLocationManager.Status == CLAuthorizationStatus.Authorized || CLLocationManager.Status == CLAuthorizationStatus.AuthorizedAlways || CLLocationManager.Status == CLAuthorizationStatus.AuthorizedWhenInUse) 13 | return Task.FromResult(true); 14 | else if (CLLocationManager.Status == CLAuthorizationStatus.Denied) 15 | return Task.FromResult(false); 16 | else 17 | return Task.FromResult(false); 18 | } 19 | else 20 | return Task.FromResult(false); 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/ConnectWifi.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace DemoApp; 2 | using MauiWifiManager; 3 | using MauiWifiManager.Abstractions; 4 | 5 | public partial class ConnectWifi : ContentPage 6 | { 7 | public ConnectWifi() 8 | { 9 | InitializeComponent(); 10 | } 11 | 12 | private async void ConnectBtnClicked(object sender, EventArgs e) 13 | { 14 | if (string.IsNullOrWhiteSpace(WifiSsid.Text) || string.IsNullOrWhiteSpace(WifiPassword.Text)) 15 | { 16 | await DisplayAlert("Empty SSID or Password", "SSID and Password cannot be empty", "OK"); 17 | return; 18 | } 19 | 20 | var response = await CrossWifiManager.Current.ConnectWifi(WifiSsid.Text, WifiPassword.Text); 21 | if (response.ErrorCode == WifiErrorCodes.Success) 22 | await DisplayAlert("Wi-Fi Info", response?.Data?.Ssid?.ToString(),"OK"); 23 | else 24 | await DisplayAlert("Wi-Fi Info", response.ErrorMessage, "OK"); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /samples/Platforms/Android/Services/GpsService.cs: -------------------------------------------------------------------------------- 1 | using Android.Content; 2 | using DemoApp.Services.Interfaces; 3 | 4 | namespace DemoApp.Platforms 5 | { 6 | public class GpsService : IGpsService 7 | { 8 | public async Task GpsStatus() 9 | { 10 | global::Android.Locations.LocationManager manager = (Android.Locations.LocationManager)Android.App.Application.Context.GetSystemService(Context.LocationService); 11 | if (manager.IsProviderEnabled(Android.Locations.LocationManager.GpsProvider)) 12 | return true; 13 | else 14 | { 15 | try 16 | { 17 | //This is not checked for Android 6 18 | return manager.IsLocationEnabled; 19 | } 20 | catch 21 | { 22 | 23 | } 24 | return false; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/Platforms/Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.OS; 4 | using Android.Runtime; 5 | 6 | namespace DemoApp 7 | { 8 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] 9 | public class MainActivity : MauiAppCompatActivity 10 | { 11 | protected override void OnCreate(Bundle savedInstanceState) 12 | { 13 | base.OnCreate(savedInstanceState); 14 | } 15 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) 16 | { 17 | Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 18 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.github/workflows/build-maui-app-ci.yml: -------------------------------------------------------------------------------- 1 | name: Build MAUI APP 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | paths-ignore: 8 | - "**.md" 9 | pull_request: 10 | branches: 11 | - "main" 12 | 13 | env: 14 | BUILD_CONFIGURATION: Release 15 | DOTNET_VERSION: 9.0.x 16 | CSPROJ_TO_BUILD: DemoApp.csproj 17 | jobs: 18 | build-sample-ci: 19 | 20 | runs-on: windows-latest 21 | 22 | steps: 23 | - uses: actions/checkout@v3 24 | 25 | - name: Setup .NET ${{ env.DOTNET_VERSION }} 26 | uses: actions/setup-dotnet@v2 27 | with: 28 | dotnet-version: ${{ env.DOTNET_VERSION }} 29 | 30 | - name: Install .NET MAUI Workload 31 | run: dotnet workload install maui 32 | 33 | - name: Restore dependencies 34 | run: dotnet restore samples\${{ env.CSPROJ_TO_BUILD }} 35 | 36 | - name: Build Demo App ${{ env.CSPROJ_TO_BUILD }} 37 | run: dotnet build samples\${{ env.CSPROJ_TO_BUILD }} -c ${{ env.BUILD_CONFIGURATION }} -f:net9.0-android 38 | -------------------------------------------------------------------------------- /samples/ScanAndConnect.xaml.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Maui.Views; 2 | using MauiWifiManager; 3 | using MauiWifiManager.Abstractions; 4 | 5 | namespace DemoApp; 6 | 7 | public partial class ScanAndConnect : ContentPage 8 | { 9 | public ScanAndConnect() 10 | { 11 | InitializeComponent(); 12 | } 13 | private async void ConnectBtnClicked(object sender, EventArgs e) 14 | { 15 | 16 | var popup = new ScanQr(); 17 | var result = await this.ShowPopupAsync(popup); 18 | var responseString = result?.ToString(); 19 | if (!string.IsNullOrWhiteSpace(responseString)) 20 | { 21 | string ssid = responseString.Split(':')[0]; 22 | string password = responseString.Split(':')[1]; 23 | var response = await CrossWifiManager.Current.ConnectWifi(ssid, password); 24 | if (response.ErrorCode == WifiErrorCodes.Success) 25 | { 26 | await DisplayAlert("Wi-Fi Info", response?.Data?.NativeObject?.ToString(), "OK"); 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /samples/MauiProgram.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Maui; 2 | using DemoApp.Platforms; 3 | using DemoApp.Services.Interfaces; 4 | using Microsoft.Extensions.Logging; 5 | using ZXing.Net.Maui.Controls; 6 | using MauiWifiManager; 7 | 8 | namespace DemoApp 9 | { 10 | public static class MauiProgram 11 | { 12 | public static MauiApp CreateMauiApp() 13 | { 14 | var builder = MauiApp.CreateBuilder(); 15 | builder 16 | .UseMauiApp() 17 | .UseBarcodeReader() 18 | .UseMauiCommunityToolkit() 19 | .UseMauiWifiManager() 20 | .ConfigureFonts(fonts => 21 | { 22 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); 23 | fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); 24 | }); 25 | 26 | #if DEBUG 27 | builder.Logging.AddDebug(); 28 | #endif 29 | builder.Services.AddTransient(); 30 | return builder.Build(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /samples/ScanQr.xaml.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Maui.Views; 2 | using ZXing.Net.Maui; 3 | 4 | namespace DemoApp; 5 | 6 | public partial class ScanQr : Popup 7 | { 8 | public ScanQr() 9 | { 10 | InitializeComponent(); 11 | barcodeReader.Options = new BarcodeReaderOptions 12 | { 13 | Formats = BarcodeFormats.TwoDimensional, 14 | AutoRotate = true, 15 | Multiple = true 16 | }; 17 | } 18 | 19 | private void BarcodesDetected(object sender, BarcodeDetectionEventArgs e) 20 | { 21 | var first = e.Results.FirstOrDefault(); 22 | if (first != null) 23 | { 24 | if (first.Value.StartsWith("WIFI:")) 25 | { 26 | var ssid = first.Value.Split(new[] { "S:" }, StringSplitOptions.None)[1].Split(';')[0]; 27 | var password = first.Value.Split(new[] { "P:" }, StringSplitOptions.None)[1].Split(';')[0]; 28 | string result = ssid + ":" +password; 29 | barcodeReader.IsDetecting = false; 30 | Close(result); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Santosh Dahal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /samples/ScanAndConnect.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 |