MpCoding.WPF.Notification.Service 1.0.0

Additional Details

resource dictionary was not correctly added to the package.

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MpCoding.WPF.Notification.Service --version 1.0.0                
NuGet\Install-Package MpCoding.WPF.Notification.Service -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MpCoding.WPF.Notification.Service" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MpCoding.WPF.Notification.Service --version 1.0.0                
#r "nuget: MpCoding.WPF.Notification.Service, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MpCoding.WPF.Notification.Service as a Cake Addin
#addin nuget:?package=MpCoding.WPF.Notification.Service&version=1.0.0

// Install MpCoding.WPF.Notification.Service as a Cake Tool
#tool nuget:?package=MpCoding.WPF.Notification.Service&version=1.0.0                

Wpf.Notification.Service

When using MpCoding.WPF.Notification,

please add the below resource dictionary directly.

<ResourceDictionary.MergedDictionaries>
	<ResourceDictionary Source="pack://application:,,,/MpCoding.WPF.Notification;component/Resources/NotificationView.xaml" />
</ResourceDictionary.MergedDictionaries>  

Dependency Injection Integration:

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MpCoding.WPF.Notification.Abstractions;
using MpCoding.WPF.Notification.Servicers;

public partial class App : Application
    {
        private readonly IHost _host;

        public App()
        {
            _host = Host.CreateDefaultBuilder().ConfigureServices(services =>
            {
                services.AddSingleton<INotificationDialogService, NotificationDialogService>(); // Add this Dependency Injection
                services.AddSingleton<MainWindow>();
            }).Build();
        }

        protected override void OnStartup(StartupEventArgs e)
        {
            _host.Start();

            MainWindow = _host.Services.GetRequiredService<MainWindow>();
            MainWindow.Show();

            base.OnStartup(e);
        }
    }

Show Notification Dialog

INotification ShowDialog(
       string title,
       string message,
       NotificationIcon icon,
       DisplayType type,
       bool hideIcon = false,
       bool blurOtherWindows = false);

Send Notification Toast

bool SendToast(
        string title,
        string message,
        NotificationIcon icon = NotificationIcon.Info,
        bool hideIcon = false,
        bool autoClose = true,
        int display_seconds = 7);

Example :-

private INotificationDialogService _ds;

public MainWindow(INotificationDialogService ds)
{
    InitializeComponent();
    _ds = ds;
}
  1. Success Notify
var result = _ds.ShowDialog("Success", "Success dialog", NotificationIcon.Success, DisplayType.ShowInfo, false, false);
  1. Info Notify
var result = _ds.ShowDialog("Info", "Information dialog", NotificationIcon.Info, DisplayType.ShowInfo, false);
  1. Warning Notify
var result = _ds.ShowDialog("Warning", "Warning dialog", NotificationIcon.Warning, DisplayType.ShowInfo, false, false);
  1. Error Notify
var result = _ds.ShowDialog("Error", "Error dialog", NotificationIcon.Error, DisplayType.ShowInfo, false, true);
  1. Confirm Notify
var result = _ds.ShowDialog("Error", "Get Error Confirmation", NotificationIcon.Error, DisplayType.GetConfirmation, false, true);
  1. Success Toase Send
var result = _ds.SendToast("Success", "Success Toast msg", NotificationIcon.Success);

etc.

Demo Video

https://youtu.be/leP_EuEThrk

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 98 10/8/2024

A simple Notification service for Wpf Applications