From 89833240720ff069f185c93ea2e8d3854fafe540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6llinger?= Date: Tue, 8 Oct 2024 15:35:16 +0200 Subject: [PATCH 1/4] Update target frameworks to net8.0 for all projects --- .../DesktopNotifications.Apple.csproj | 4 ++-- .../DesktopNotifications.Avalonia.csproj | 4 ++-- .../DesktopNotifications.FreeDesktop.csproj | 4 ++-- .../DesktopNotifications.Windows.csproj | 5 +++-- DesktopNotifications.Windows/ShellLink.cs | 20 +++++++++++++++---- .../DesktopNotifications.csproj | 4 ++-- Example.Avalonia/Example.Avalonia.csproj | 4 ++-- Example/Example.csproj | 4 ++-- 8 files changed, 31 insertions(+), 18 deletions(-) diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj index a9acf16..89f7d7d 100644 --- a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 - netstandard2.0;net6.0-windows10.0.17763.0 + netstandard2.0;net8.0-windows10.0.17763.0 diff --git a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj index 5d4adb2..12c9041 100644 --- a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj +++ b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 - netstandard2.0;netcoreapp3.1;net6.0-windows10.0.17763.0 + netstandard2.0;net8.0-windows10.0.17763.0 diff --git a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj index 00ae838..3ccf645 100644 --- a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj +++ b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 - netstandard2.0;net6.0-windows10.0.17763.0 + netstandard2.0;net8.0-windows10.0.17763.0 diff --git a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj index 3419a0f..8d03303 100644 --- a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj +++ b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 - netstandard2.0;netcoreapp3.1;net6.0-windows10.0.17763.0 + netstandard2.0;net8.0-windows10.0.17763.0 @@ -15,6 +15,7 @@ A cross-platform C# library for native desktop "toast" notifications. MIT https://github.com/pr8x/DesktopNotifications + netstandard2.0;netcoreapp3.1;net8.0-windows10.0.17763.0 diff --git a/DesktopNotifications.Windows/ShellLink.cs b/DesktopNotifications.Windows/ShellLink.cs index 16ece8c..81d249e 100644 --- a/DesktopNotifications.Windows/ShellLink.cs +++ b/DesktopNotifications.Windows/ShellLink.cs @@ -413,8 +413,14 @@ public void Save(string file) { throw new ArgumentNullException(nameof(file)); } - - PersistFile.Save(file, true); + try + { + PersistFile.Save(file, true); + } + catch(Exception e) + { + Console.WriteLine(e.Message); + } } // Load shortcut file. @@ -424,8 +430,14 @@ public void Load(string file) { throw new FileNotFoundException("File is not found.", file); } - - PersistFile.Load(file, STGM_READ); + try + { + PersistFile.Load(file, STGM_READ); + } + catch(Exception e) + { + Console.WriteLine(e.Message); + } } // Verify if operation succeeded. diff --git a/DesktopNotifications/DesktopNotifications.csproj b/DesktopNotifications/DesktopNotifications.csproj index e5d62fa..e8788ac 100644 --- a/DesktopNotifications/DesktopNotifications.csproj +++ b/DesktopNotifications/DesktopNotifications.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 - netstandard2.0;net6.0-windows10.0.17763.0 + netstandard2.0;net8.0-windows10.0.17763.0 diff --git a/Example.Avalonia/Example.Avalonia.csproj b/Example.Avalonia/Example.Avalonia.csproj index 51da934..0a15234 100644 --- a/Example.Avalonia/Example.Avalonia.csproj +++ b/Example.Avalonia/Example.Avalonia.csproj @@ -2,10 +2,10 @@ - netcoreapp3.1;net6.0 + net8.0 - netcoreapp3.1;net6.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 diff --git a/Example/Example.csproj b/Example/Example.csproj index 852399e..53f2fa1 100644 --- a/Example/Example.csproj +++ b/Example/Example.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 - netstandard2.0;netcoreapp3.1;net6.0-windows10.0.17763.0 + netstandard2.0;net8.0-windows10.0.17763.0 From 2bcecd06d7536148b8bd58dff1e3df873dfb5c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6llinger?= Date: Thu, 10 Oct 2024 14:44:52 +0200 Subject: [PATCH 2/4] - Updated Nuget packages - Removed .NET Core 3.5 --- .../DesktopNotifications.Avalonia.csproj | 2 +- .../DesktopNotifications.FreeDesktop.csproj | 2 +- .../DesktopNotifications.Windows.csproj | 7 ++++--- Example.Avalonia/Example.Avalonia.csproj | 8 ++++---- Example.Avalonia/MainWindow.axaml | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj index 12c9041..8cfe818 100644 --- a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj +++ b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj @@ -18,7 +18,7 @@ - + diff --git a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj index 3ccf645..52a6e01 100644 --- a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj +++ b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj @@ -18,7 +18,7 @@ - + diff --git a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj index 8d03303..8636ed3 100644 --- a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj +++ b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj @@ -15,7 +15,7 @@ A cross-platform C# library for native desktop "toast" notifications. MIT https://github.com/pr8x/DesktopNotifications - netstandard2.0;netcoreapp3.1;net8.0-windows10.0.17763.0 + netstandard2.0;net8.0-windows10.0.17763.0 @@ -30,8 +30,9 @@ - - + + + \ No newline at end of file diff --git a/Example.Avalonia/Example.Avalonia.csproj b/Example.Avalonia/Example.Avalonia.csproj index 0a15234..f80a362 100644 --- a/Example.Avalonia/Example.Avalonia.csproj +++ b/Example.Avalonia/Example.Avalonia.csproj @@ -14,10 +14,10 @@ enable - - - - + + + + diff --git a/Example.Avalonia/MainWindow.axaml b/Example.Avalonia/MainWindow.axaml index c7d249d..aad0521 100644 --- a/Example.Avalonia/MainWindow.axaml +++ b/Example.Avalonia/MainWindow.axaml @@ -3,7 +3,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="400" - Width="400" Height="500" + Width="400" Height="600" x:Class="Example.Avalonia.MainWindow" Title="Example.Avalonia"> From e84b03efcb0b1e43e6d53b0c7db89d138c28e7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6llinger?= Date: Thu, 10 Oct 2024 15:30:43 +0200 Subject: [PATCH 3/4] created new nuget packages --- .../DesktopNotifications.Apple.csproj | 10 ++++ DesktopNotifications.Apple/LICENSE.md | 21 +++++++++ DesktopNotifications.Apple/README.md | 46 +++++++++++++++++++ .../DesktopNotifications.Avalonia.csproj | 11 ++++- DesktopNotifications.Avalonia/LICENSE.md | 21 +++++++++ DesktopNotifications.Avalonia/README.md | 46 +++++++++++++++++++ .../DesktopNotifications.FreeDesktop.csproj | 9 ++++ DesktopNotifications.FreeDesktop/LICENSE.md | 21 +++++++++ DesktopNotifications.FreeDesktop/README.md | 46 +++++++++++++++++++ .../DesktopNotifications.Windows.csproj | 10 ++++ DesktopNotifications.Windows/LICENSE.md | 21 +++++++++ DesktopNotifications.Windows/README.md | 46 +++++++++++++++++++ DesktopNotifications.sln | 6 +-- .../DesktopNotifications.csproj | 11 +++++ DesktopNotifications/LICENSE.md | 21 +++++++++ DesktopNotifications/README.md | 46 +++++++++++++++++++ 16 files changed, 388 insertions(+), 4 deletions(-) create mode 100644 DesktopNotifications.Apple/LICENSE.md create mode 100644 DesktopNotifications.Apple/README.md create mode 100644 DesktopNotifications.Avalonia/LICENSE.md create mode 100644 DesktopNotifications.Avalonia/README.md create mode 100644 DesktopNotifications.FreeDesktop/LICENSE.md create mode 100644 DesktopNotifications.FreeDesktop/README.md create mode 100644 DesktopNotifications.Windows/LICENSE.md create mode 100644 DesktopNotifications.Windows/README.md create mode 100644 DesktopNotifications/LICENSE.md create mode 100644 DesktopNotifications/README.md diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj index 89f7d7d..53c9732 100644 --- a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj @@ -18,10 +18,20 @@ DesktopNotifications.Apple DesktopNotifications.Apple DesktopNotifications.Apple + README.md + DesktopNotificationsNet8.Apple + DesktopNotificationsNet8.Apple + 1.3.2 + + + True + \ + + \ No newline at end of file diff --git a/DesktopNotifications.Apple/LICENSE.md b/DesktopNotifications.Apple/LICENSE.md new file mode 100644 index 0000000..a52aeea --- /dev/null +++ b/DesktopNotifications.Apple/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Luis von der Eltz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/DesktopNotifications.Apple/README.md b/DesktopNotifications.Apple/README.md new file mode 100644 index 0000000..b68d2e4 --- /dev/null +++ b/DesktopNotifications.Apple/README.md @@ -0,0 +1,46 @@ +# DesktopNotifications + +A cross-platform C# library for native desktop "toast" notifications. + +[![Build](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml) +[![Nuget](https://img.shields.io/nuget/v/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) +[![Nuget](https://img.shields.io/nuget/dt/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) + +[Screenshot (Linux)](.github/images/linux_demo_image_06_02_21.png?raw=true) + +[Screenshot (Windows)](.github/images/win_demo_image_06_02_21.png?raw=true) + +# Features + +| | Windows | Linux (FreeDesktop.DBus) | OSX | +|--------------------------|---------|---------------------|-----| +| Show notifications | ✓ | ✓ | ✕ | +| Hide notifications | ✓ | ✓ | ✕ | +| Schedule notifications | ✓ | ✓* | ✕ | +| Launch actions | ✓** | ✕ | ✕ | +| Replacing notifications | ✕ | ✕ | ✕ | +| Buttons | ✓ | ✓ | ✕ | +| Audio | ✕ | ✕ | ✕ | +| Images | ✓ | ✓*** | ✕ | + + * Scheduled notifications will only be delivered while the application is running. + ** This is currently not supported when targeting .netstandard + *** If supported by the notification server + +# Application Context + +Most operating systems require you to register the application in some form before you can actually send notifications. This registration process is handled by the `ApplicationContext`. On Windows (see `WindowsApplicationContext`) it will create and assign a [Application User Model Id](https://docs.microsoft.com/en-us/windows/win32/shell/appids) to the current process and associate a shell link in the start menu with it. This will cause your application to appear in the Windows Start Menu. On Linux/FreeDesktop.DBUS, the application context is just holding the name and optional icon of your application. + +# Avalonia + +The `DesktopNotifications.Avalonia` package offers support for the [Avalonia](https://github.com/AvaloniaUI/Avalonia) project. It doesn't do much on its own, it just provides helpers to register +the `INotificationManager` with the application builder. You can see an example of it in the Example.Avalonia project. + + +# Help wanted + +My MacBook Pro is 11 years old now and it does not run OSX Mojave or higher. Unfortunately, Apple deprecated `NSUserNotificationCenter` with OSX 10.14 and I suppose they want us to use the newer `UNUserNotificationCenter` API instead. I would kindly appreciate any contributions from folks that own a more modern Mac and are interested in implementing the OSX backend using the new API. + +# License + +See [License](LICENSE.md) diff --git a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj index 8cfe818..66de05e 100644 --- a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj +++ b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj @@ -15,6 +15,9 @@ true MIT https://github.com/pr8x/DesktopNotifications + README.md + DesktopNotificationsNet8.Avalonia + DesktopNotificationsNet8.Avalonia @@ -26,5 +29,11 @@ - + + + + True + \ + + \ No newline at end of file diff --git a/DesktopNotifications.Avalonia/LICENSE.md b/DesktopNotifications.Avalonia/LICENSE.md new file mode 100644 index 0000000..a52aeea --- /dev/null +++ b/DesktopNotifications.Avalonia/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Luis von der Eltz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/DesktopNotifications.Avalonia/README.md b/DesktopNotifications.Avalonia/README.md new file mode 100644 index 0000000..b68d2e4 --- /dev/null +++ b/DesktopNotifications.Avalonia/README.md @@ -0,0 +1,46 @@ +# DesktopNotifications + +A cross-platform C# library for native desktop "toast" notifications. + +[![Build](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml) +[![Nuget](https://img.shields.io/nuget/v/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) +[![Nuget](https://img.shields.io/nuget/dt/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) + +[Screenshot (Linux)](.github/images/linux_demo_image_06_02_21.png?raw=true) + +[Screenshot (Windows)](.github/images/win_demo_image_06_02_21.png?raw=true) + +# Features + +| | Windows | Linux (FreeDesktop.DBus) | OSX | +|--------------------------|---------|---------------------|-----| +| Show notifications | ✓ | ✓ | ✕ | +| Hide notifications | ✓ | ✓ | ✕ | +| Schedule notifications | ✓ | ✓* | ✕ | +| Launch actions | ✓** | ✕ | ✕ | +| Replacing notifications | ✕ | ✕ | ✕ | +| Buttons | ✓ | ✓ | ✕ | +| Audio | ✕ | ✕ | ✕ | +| Images | ✓ | ✓*** | ✕ | + + * Scheduled notifications will only be delivered while the application is running. + ** This is currently not supported when targeting .netstandard + *** If supported by the notification server + +# Application Context + +Most operating systems require you to register the application in some form before you can actually send notifications. This registration process is handled by the `ApplicationContext`. On Windows (see `WindowsApplicationContext`) it will create and assign a [Application User Model Id](https://docs.microsoft.com/en-us/windows/win32/shell/appids) to the current process and associate a shell link in the start menu with it. This will cause your application to appear in the Windows Start Menu. On Linux/FreeDesktop.DBUS, the application context is just holding the name and optional icon of your application. + +# Avalonia + +The `DesktopNotifications.Avalonia` package offers support for the [Avalonia](https://github.com/AvaloniaUI/Avalonia) project. It doesn't do much on its own, it just provides helpers to register +the `INotificationManager` with the application builder. You can see an example of it in the Example.Avalonia project. + + +# Help wanted + +My MacBook Pro is 11 years old now and it does not run OSX Mojave or higher. Unfortunately, Apple deprecated `NSUserNotificationCenter` with OSX 10.14 and I suppose they want us to use the newer `UNUserNotificationCenter` API instead. I would kindly appreciate any contributions from folks that own a more modern Mac and are interested in implementing the OSX backend using the new API. + +# License + +See [License](LICENSE.md) diff --git a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj index 52a6e01..76520a2 100644 --- a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj +++ b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj @@ -15,6 +15,9 @@ true MIT https://github.com/pr8x/DesktopNotifications + README.md + DesktopNotificationsNet8.FreeDesktop + DesktopNotificationsNet8.FreeDesktop @@ -25,4 +28,10 @@ + + + True + \ + + \ No newline at end of file diff --git a/DesktopNotifications.FreeDesktop/LICENSE.md b/DesktopNotifications.FreeDesktop/LICENSE.md new file mode 100644 index 0000000..a52aeea --- /dev/null +++ b/DesktopNotifications.FreeDesktop/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Luis von der Eltz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/DesktopNotifications.FreeDesktop/README.md b/DesktopNotifications.FreeDesktop/README.md new file mode 100644 index 0000000..b68d2e4 --- /dev/null +++ b/DesktopNotifications.FreeDesktop/README.md @@ -0,0 +1,46 @@ +# DesktopNotifications + +A cross-platform C# library for native desktop "toast" notifications. + +[![Build](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml) +[![Nuget](https://img.shields.io/nuget/v/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) +[![Nuget](https://img.shields.io/nuget/dt/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) + +[Screenshot (Linux)](.github/images/linux_demo_image_06_02_21.png?raw=true) + +[Screenshot (Windows)](.github/images/win_demo_image_06_02_21.png?raw=true) + +# Features + +| | Windows | Linux (FreeDesktop.DBus) | OSX | +|--------------------------|---------|---------------------|-----| +| Show notifications | ✓ | ✓ | ✕ | +| Hide notifications | ✓ | ✓ | ✕ | +| Schedule notifications | ✓ | ✓* | ✕ | +| Launch actions | ✓** | ✕ | ✕ | +| Replacing notifications | ✕ | ✕ | ✕ | +| Buttons | ✓ | ✓ | ✕ | +| Audio | ✕ | ✕ | ✕ | +| Images | ✓ | ✓*** | ✕ | + + * Scheduled notifications will only be delivered while the application is running. + ** This is currently not supported when targeting .netstandard + *** If supported by the notification server + +# Application Context + +Most operating systems require you to register the application in some form before you can actually send notifications. This registration process is handled by the `ApplicationContext`. On Windows (see `WindowsApplicationContext`) it will create and assign a [Application User Model Id](https://docs.microsoft.com/en-us/windows/win32/shell/appids) to the current process and associate a shell link in the start menu with it. This will cause your application to appear in the Windows Start Menu. On Linux/FreeDesktop.DBUS, the application context is just holding the name and optional icon of your application. + +# Avalonia + +The `DesktopNotifications.Avalonia` package offers support for the [Avalonia](https://github.com/AvaloniaUI/Avalonia) project. It doesn't do much on its own, it just provides helpers to register +the `INotificationManager` with the application builder. You can see an example of it in the Example.Avalonia project. + + +# Help wanted + +My MacBook Pro is 11 years old now and it does not run OSX Mojave or higher. Unfortunately, Apple deprecated `NSUserNotificationCenter` with OSX 10.14 and I suppose they want us to use the newer `UNUserNotificationCenter` API instead. I would kindly appreciate any contributions from folks that own a more modern Mac and are interested in implementing the OSX backend using the new API. + +# License + +See [License](LICENSE.md) diff --git a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj index 8636ed3..44984f5 100644 --- a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj +++ b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj @@ -16,6 +16,10 @@ MIT https://github.com/pr8x/DesktopNotifications netstandard2.0;net8.0-windows10.0.17763.0 + 1.3.2 + README.md + DesktopNotificationsNet8.Windows + DesktopNotificationsNet8.Windows @@ -35,4 +39,10 @@ + + + True + \ + + \ No newline at end of file diff --git a/DesktopNotifications.Windows/LICENSE.md b/DesktopNotifications.Windows/LICENSE.md new file mode 100644 index 0000000..a52aeea --- /dev/null +++ b/DesktopNotifications.Windows/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Luis von der Eltz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/DesktopNotifications.Windows/README.md b/DesktopNotifications.Windows/README.md new file mode 100644 index 0000000..b68d2e4 --- /dev/null +++ b/DesktopNotifications.Windows/README.md @@ -0,0 +1,46 @@ +# DesktopNotifications + +A cross-platform C# library for native desktop "toast" notifications. + +[![Build](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml) +[![Nuget](https://img.shields.io/nuget/v/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) +[![Nuget](https://img.shields.io/nuget/dt/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) + +[Screenshot (Linux)](.github/images/linux_demo_image_06_02_21.png?raw=true) + +[Screenshot (Windows)](.github/images/win_demo_image_06_02_21.png?raw=true) + +# Features + +| | Windows | Linux (FreeDesktop.DBus) | OSX | +|--------------------------|---------|---------------------|-----| +| Show notifications | ✓ | ✓ | ✕ | +| Hide notifications | ✓ | ✓ | ✕ | +| Schedule notifications | ✓ | ✓* | ✕ | +| Launch actions | ✓** | ✕ | ✕ | +| Replacing notifications | ✕ | ✕ | ✕ | +| Buttons | ✓ | ✓ | ✕ | +| Audio | ✕ | ✕ | ✕ | +| Images | ✓ | ✓*** | ✕ | + + * Scheduled notifications will only be delivered while the application is running. + ** This is currently not supported when targeting .netstandard + *** If supported by the notification server + +# Application Context + +Most operating systems require you to register the application in some form before you can actually send notifications. This registration process is handled by the `ApplicationContext`. On Windows (see `WindowsApplicationContext`) it will create and assign a [Application User Model Id](https://docs.microsoft.com/en-us/windows/win32/shell/appids) to the current process and associate a shell link in the start menu with it. This will cause your application to appear in the Windows Start Menu. On Linux/FreeDesktop.DBUS, the application context is just holding the name and optional icon of your application. + +# Avalonia + +The `DesktopNotifications.Avalonia` package offers support for the [Avalonia](https://github.com/AvaloniaUI/Avalonia) project. It doesn't do much on its own, it just provides helpers to register +the `INotificationManager` with the application builder. You can see an example of it in the Example.Avalonia project. + + +# Help wanted + +My MacBook Pro is 11 years old now and it does not run OSX Mojave or higher. Unfortunately, Apple deprecated `NSUserNotificationCenter` with OSX 10.14 and I suppose they want us to use the newer `UNUserNotificationCenter` API instead. I would kindly appreciate any contributions from folks that own a more modern Mac and are interested in implementing the OSX backend using the new API. + +# License + +See [License](LICENSE.md) diff --git a/DesktopNotifications.sln b/DesktopNotifications.sln index 733a4fe..6b7ee64 100644 --- a/DesktopNotifications.sln +++ b/DesktopNotifications.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30804.86 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35013.160 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopNotifications", "DesktopNotifications\DesktopNotifications.csproj", "{64E5A8ED-29CB-4114-B1B8-EC14512EB15E}" EndProject @@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopNotifications.Apple" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopNotifications.Avalonia", "DesktopNotifications.Avalonia\DesktopNotifications.Avalonia.csproj", "{5D9904D2-E102-409D-AAFE-394A3DED40D9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Avalonia", "Example.Avalonia\Example.Avalonia.csproj", "{4408FE39-C5AF-453D-B6EE-E1A42504264A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.Avalonia", "Example.Avalonia\Example.Avalonia.csproj", "{4408FE39-C5AF-453D-B6EE-E1A42504264A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/DesktopNotifications/DesktopNotifications.csproj b/DesktopNotifications/DesktopNotifications.csproj index e8788ac..2607d32 100644 --- a/DesktopNotifications/DesktopNotifications.csproj +++ b/DesktopNotifications/DesktopNotifications.csproj @@ -15,6 +15,17 @@ A cross-platform C# library for native desktop "toast" notifications. MIT https://github.com/pr8x/DesktopNotifications + 1.3.2 + README.md + DesktopNotificationsNet8 + DesktopNotificationsNet8 + + + + True + \ + + \ No newline at end of file diff --git a/DesktopNotifications/LICENSE.md b/DesktopNotifications/LICENSE.md new file mode 100644 index 0000000..a52aeea --- /dev/null +++ b/DesktopNotifications/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Luis von der Eltz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/DesktopNotifications/README.md b/DesktopNotifications/README.md new file mode 100644 index 0000000..b68d2e4 --- /dev/null +++ b/DesktopNotifications/README.md @@ -0,0 +1,46 @@ +# DesktopNotifications + +A cross-platform C# library for native desktop "toast" notifications. + +[![Build](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/pr8x/DesktopNotifications/actions/workflows/build.yml) +[![Nuget](https://img.shields.io/nuget/v/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) +[![Nuget](https://img.shields.io/nuget/dt/DesktopNotifications)](https://www.nuget.org/packages/DesktopNotifications/) + +[Screenshot (Linux)](.github/images/linux_demo_image_06_02_21.png?raw=true) + +[Screenshot (Windows)](.github/images/win_demo_image_06_02_21.png?raw=true) + +# Features + +| | Windows | Linux (FreeDesktop.DBus) | OSX | +|--------------------------|---------|---------------------|-----| +| Show notifications | ✓ | ✓ | ✕ | +| Hide notifications | ✓ | ✓ | ✕ | +| Schedule notifications | ✓ | ✓* | ✕ | +| Launch actions | ✓** | ✕ | ✕ | +| Replacing notifications | ✕ | ✕ | ✕ | +| Buttons | ✓ | ✓ | ✕ | +| Audio | ✕ | ✕ | ✕ | +| Images | ✓ | ✓*** | ✕ | + + * Scheduled notifications will only be delivered while the application is running. + ** This is currently not supported when targeting .netstandard + *** If supported by the notification server + +# Application Context + +Most operating systems require you to register the application in some form before you can actually send notifications. This registration process is handled by the `ApplicationContext`. On Windows (see `WindowsApplicationContext`) it will create and assign a [Application User Model Id](https://docs.microsoft.com/en-us/windows/win32/shell/appids) to the current process and associate a shell link in the start menu with it. This will cause your application to appear in the Windows Start Menu. On Linux/FreeDesktop.DBUS, the application context is just holding the name and optional icon of your application. + +# Avalonia + +The `DesktopNotifications.Avalonia` package offers support for the [Avalonia](https://github.com/AvaloniaUI/Avalonia) project. It doesn't do much on its own, it just provides helpers to register +the `INotificationManager` with the application builder. You can see an example of it in the Example.Avalonia project. + + +# Help wanted + +My MacBook Pro is 11 years old now and it does not run OSX Mojave or higher. Unfortunately, Apple deprecated `NSUserNotificationCenter` with OSX 10.14 and I suppose they want us to use the newer `UNUserNotificationCenter` API instead. I would kindly appreciate any contributions from folks that own a more modern Mac and are interested in implementing the OSX backend using the new API. + +# License + +See [License](LICENSE.md) From df6fa54af02b75566f4f943f9eb40846e351dbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6llinger?= Date: Fri, 11 Oct 2024 09:12:41 +0200 Subject: [PATCH 4/4] remove .net 2.0 --- .../DesktopNotifications.Apple.csproj | 8 ++++---- .../DesktopNotifications.Avalonia.csproj | 7 ++++--- .../DesktopNotifications.FreeDesktop.csproj | 5 +++-- .../DesktopNotifications.Windows.csproj | 9 ++++----- DesktopNotifications/DesktopNotifications.csproj | 6 +++--- Example/Example.csproj | 4 ++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj index 53c9732..7f941a6 100644 --- a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj @@ -2,15 +2,15 @@ - netstandard2.0;net8.0 + net8.0 - netstandard2.0;net8.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 enable - 8.0 + latest true A cross-platform C# library for native desktop "toast" notifications. MIT @@ -21,7 +21,7 @@ README.md DesktopNotificationsNet8.Apple DesktopNotificationsNet8.Apple - 1.3.2 + 1.3.4 diff --git a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj index 66de05e..2cb8ed6 100644 --- a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj +++ b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj @@ -2,15 +2,15 @@ - netstandard2.0;net8.0 + net8.0 - netstandard2.0;net8.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 enable - 8.0 + latest A cross-platform C# library for native desktop "toast" notifications. true MIT @@ -18,6 +18,7 @@ README.md DesktopNotificationsNet8.Avalonia DesktopNotificationsNet8.Avalonia + 1.3.4 diff --git a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj index 76520a2..dffd507 100644 --- a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj +++ b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net8.0 + net8.0 - netstandard2.0;net8.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 @@ -18,6 +18,7 @@ README.md DesktopNotificationsNet8.FreeDesktop DesktopNotificationsNet8.FreeDesktop + 1.3.4 diff --git a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj index 44984f5..b15ed75 100644 --- a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj +++ b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj @@ -2,21 +2,20 @@ - netstandard2.0;net8.0 + net8.0 - netstandard2.0;net8.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 - 8.0 + latest enable true A cross-platform C# library for native desktop "toast" notifications. MIT https://github.com/pr8x/DesktopNotifications - netstandard2.0;net8.0-windows10.0.17763.0 - 1.3.2 + 1.3.4 README.md DesktopNotificationsNet8.Windows DesktopNotificationsNet8.Windows diff --git a/DesktopNotifications/DesktopNotifications.csproj b/DesktopNotifications/DesktopNotifications.csproj index 2607d32..3624a44 100644 --- a/DesktopNotifications/DesktopNotifications.csproj +++ b/DesktopNotifications/DesktopNotifications.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net8.0 + net8.0 - netstandard2.0;net8.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 @@ -15,7 +15,7 @@ A cross-platform C# library for native desktop "toast" notifications. MIT https://github.com/pr8x/DesktopNotifications - 1.3.2 + 1.3.4 README.md DesktopNotificationsNet8 DesktopNotificationsNet8 diff --git a/Example/Example.csproj b/Example/Example.csproj index 53f2fa1..d61bdc5 100644 --- a/Example/Example.csproj +++ b/Example/Example.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net8.0 + net8.0 - netstandard2.0;net8.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0