diff --git a/Auth/AuthServices/AuthServices.csproj b/Auth/AuthServices/AuthServices.csproj index 17dac02d..1c8fb5f6 100644 --- a/Auth/AuthServices/AuthServices.csproj +++ b/Auth/AuthServices/AuthServices.csproj @@ -5,7 +5,7 @@ - + diff --git a/Auth/MauiAuth/MauiAuth.csproj b/Auth/MauiAuth/MauiAuth.csproj index 3ce1bc7b..0618a01b 100644 --- a/Auth/MauiAuth/MauiAuth.csproj +++ b/Auth/MauiAuth/MauiAuth.csproj @@ -25,7 +25,7 @@ - + diff --git a/Auth/MauiAuthBlazor/MauiAuthBlazor.csproj b/Auth/MauiAuthBlazor/MauiAuthBlazor.csproj index d05c969a..db3e97bb 100644 --- a/Auth/MauiAuthBlazor/MauiAuthBlazor.csproj +++ b/Auth/MauiAuthBlazor/MauiAuthBlazor.csproj @@ -26,7 +26,7 @@ - + diff --git a/Database/MauiTaskListApp/MauiTaskListApp.csproj b/Database/MauiTaskListApp/MauiTaskListApp.csproj index b1fbf980..fde3e343 100644 --- a/Database/MauiTaskListApp/MauiTaskListApp.csproj +++ b/Database/MauiTaskListApp/MauiTaskListApp.csproj @@ -30,7 +30,7 @@ - + diff --git a/DynamicFab/DynamicFab.csproj b/DynamicFab/DynamicFab.csproj index 7b5de69d..aaf63c81 100644 --- a/DynamicFab/DynamicFab.csproj +++ b/DynamicFab/DynamicFab.csproj @@ -26,7 +26,7 @@ - + diff --git a/IPTVPlayer/IPTVPlayer.csproj b/IPTVPlayer/IPTVPlayer.csproj index 2bf33724..6f90c74b 100644 --- a/IPTVPlayer/IPTVPlayer.csproj +++ b/IPTVPlayer/IPTVPlayer.csproj @@ -32,8 +32,8 @@ - - + + diff --git a/KanbanBoard/KanbanBoard.csproj b/KanbanBoard/KanbanBoard.csproj index 8b5bf920..6569fcbc 100644 --- a/KanbanBoard/KanbanBoard.csproj +++ b/KanbanBoard/KanbanBoard.csproj @@ -27,7 +27,7 @@ - + all diff --git a/MauiAnimation/MauiAnimation.csproj b/MauiAnimation/MauiAnimation.csproj index e91c78bb..bf4a8e35 100644 --- a/MauiAnimation/MauiAnimation.csproj +++ b/MauiAnimation/MauiAnimation.csproj @@ -27,7 +27,7 @@ - + diff --git a/MauiBank/MauiBank.csproj b/MauiBank/MauiBank.csproj index a08d17f9..965755ea 100644 --- a/MauiBank/MauiBank.csproj +++ b/MauiBank/MauiBank.csproj @@ -32,7 +32,7 @@ - + diff --git a/MauiBells/MauiBells.csproj b/MauiBells/MauiBells.csproj index e4e7a78b..08308189 100644 --- a/MauiBells/MauiBells.csproj +++ b/MauiBells/MauiBells.csproj @@ -31,7 +31,7 @@ - + diff --git a/MauiBluetooth/MauiBluetooth.csproj b/MauiBluetooth/MauiBluetooth.csproj index 0c4fe906..6338dbc1 100644 --- a/MauiBluetooth/MauiBluetooth.csproj +++ b/MauiBluetooth/MauiBluetooth.csproj @@ -26,9 +26,9 @@ - + - + diff --git a/MauiCaptcha/MauiCaptcha.csproj b/MauiCaptcha/MauiCaptcha.csproj index 6c82c667..139c14d7 100644 --- a/MauiCaptcha/MauiCaptcha.csproj +++ b/MauiCaptcha/MauiCaptcha.csproj @@ -32,7 +32,7 @@ - + diff --git a/MauiLocalization/MauiLocalization.csproj b/MauiLocalization/MauiLocalization.csproj index b288e5f3..5111658f 100644 --- a/MauiLocalization/MauiLocalization.csproj +++ b/MauiLocalization/MauiLocalization.csproj @@ -29,7 +29,7 @@ - + diff --git a/MauiMaps/MauiMaps.csproj b/MauiMaps/MauiMaps.csproj index a05b31e6..29b0ccec 100644 --- a/MauiMaps/MauiMaps.csproj +++ b/MauiMaps/MauiMaps.csproj @@ -29,9 +29,9 @@ - + - + diff --git a/MauiMultiWindow/MauiMultiWindow.csproj b/MauiMultiWindow/MauiMultiWindow.csproj index 99871bcb..47d21918 100644 --- a/MauiMultiWindow/MauiMultiWindow.csproj +++ b/MauiMultiWindow/MauiMultiWindow.csproj @@ -25,6 +25,6 @@ - + \ No newline at end of file diff --git a/MauiNotifications/App.xaml b/MauiNotifications/App.xaml new file mode 100644 index 00000000..30f427dc --- /dev/null +++ b/MauiNotifications/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/MauiNotifications/App.xaml.cs b/MauiNotifications/App.xaml.cs new file mode 100644 index 00000000..e3fe7a35 --- /dev/null +++ b/MauiNotifications/App.xaml.cs @@ -0,0 +1,20 @@ +namespace MauiNotifications; + +public partial class App +{ + private readonly DeviceInstallationService deviceInstallationService; + + public App(DeviceInstallationService deviceInstallationService) + { + this.deviceInstallationService = deviceInstallationService; + InitializeComponent(); + + MainPage = new AppShell(); + } + + protected override async void OnStart() + { + base.OnStart(); + await deviceInstallationService.RegisterDevice(); + } +} \ No newline at end of file diff --git a/MauiNotifications/AppShell.xaml b/MauiNotifications/AppShell.xaml new file mode 100644 index 00000000..b07f536d --- /dev/null +++ b/MauiNotifications/AppShell.xaml @@ -0,0 +1,15 @@ + + + + + + diff --git a/MauiNotifications/AppShell.xaml.cs b/MauiNotifications/AppShell.xaml.cs new file mode 100644 index 00000000..4481b486 --- /dev/null +++ b/MauiNotifications/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace MauiNotifications; + +public partial class AppShell : Shell +{ + public AppShell() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/MauiNotifications/DeviceInstallationService.cs b/MauiNotifications/DeviceInstallationService.cs new file mode 100644 index 00000000..57eef5cd --- /dev/null +++ b/MauiNotifications/DeviceInstallationService.cs @@ -0,0 +1,22 @@ +namespace MauiNotifications; + +using Microsoft.Azure.NotificationHubs; + +public partial class DeviceInstallationService(IConnectivity connectivity, INotificationHubClient notificationHubClient) +{ + public async Task RegisterDevice() + { + if (connectivity.NetworkAccess != NetworkAccess.Internet) + { + return; + } + + var installation = await GetInstallation(); + if (installation == null) + { + return; + } + + await notificationHubClient.CreateOrUpdateInstallationAsync(installation); + } +} \ No newline at end of file diff --git a/MauiNotifications/MainPage.xaml b/MauiNotifications/MainPage.xaml new file mode 100644 index 00000000..a7535c0a --- /dev/null +++ b/MauiNotifications/MainPage.xaml @@ -0,0 +1,36 @@ + + + + + + + +