diff --git a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj index a9acf16..7f941a6 100644 --- a/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj +++ b/DesktopNotifications.Apple/DesktopNotifications.Apple.csproj @@ -2,15 +2,15 @@ - netstandard2.0;net6.0 + net8.0 - netstandard2.0;net6.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 @@ -18,10 +18,20 @@ DesktopNotifications.Apple DesktopNotifications.Apple DesktopNotifications.Apple + README.md + DesktopNotificationsNet8.Apple + DesktopNotificationsNet8.Apple + 1.3.4 + + + 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 5d4adb2..2cb8ed6 100644 --- a/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj +++ b/DesktopNotifications.Avalonia/DesktopNotifications.Avalonia.csproj @@ -2,23 +2,27 @@ - netstandard2.0;net6.0 + net8.0 - netstandard2.0;netcoreapp3.1;net6.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 https://github.com/pr8x/DesktopNotifications + README.md + DesktopNotificationsNet8.Avalonia + DesktopNotificationsNet8.Avalonia + 1.3.4 - + @@ -26,5 +30,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 00ae838..dffd507 100644 --- a/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj +++ b/DesktopNotifications.FreeDesktop/DesktopNotifications.FreeDesktop.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + net8.0 - netstandard2.0;net6.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 @@ -15,14 +15,24 @@ true MIT https://github.com/pr8x/DesktopNotifications + README.md + DesktopNotificationsNet8.FreeDesktop + DesktopNotificationsNet8.FreeDesktop + 1.3.4 - + + + + 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 3419a0f..b15ed75 100644 --- a/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj +++ b/DesktopNotifications.Windows/DesktopNotifications.Windows.csproj @@ -2,19 +2,23 @@ - netstandard2.0;net6.0 + net8.0 - netstandard2.0;netcoreapp3.1;net6.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 + 1.3.4 + README.md + DesktopNotificationsNet8.Windows + DesktopNotificationsNet8.Windows @@ -29,8 +33,15 @@ - - + + + + + + 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.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.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 e5d62fa..3624a44 100644 --- a/DesktopNotifications/DesktopNotifications.csproj +++ b/DesktopNotifications/DesktopNotifications.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + net8.0 - netstandard2.0;net6.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 @@ -15,6 +15,17 @@ A cross-platform C# library for native desktop "toast" notifications. MIT https://github.com/pr8x/DesktopNotifications + 1.3.4 + 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) diff --git a/Example.Avalonia/Example.Avalonia.csproj b/Example.Avalonia/Example.Avalonia.csproj index 51da934..f80a362 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 @@ -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"> diff --git a/Example/Example.csproj b/Example/Example.csproj index 852399e..d61bdc5 100644 --- a/Example/Example.csproj +++ b/Example/Example.csproj @@ -2,10 +2,10 @@ - netstandard2.0;net6.0 + net8.0 - netstandard2.0;netcoreapp3.1;net6.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0