MpCoding.WPF.Notification.Service
1.0.2
dotnet add package MpCoding.WPF.Notification.Service --version 1.0.2
NuGet\Install-Package MpCoding.WPF.Notification.Service -Version 1.0.2
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.2" />
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.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MpCoding.WPF.Notification.Service, 1.0.2"
#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.2 // Install MpCoding.WPF.Notification.Service as a Cake Tool #tool nuget:?package=MpCoding.WPF.Notification.Service&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Wpf.Notification.Service
When using MpCoding.WPF.Notification,
please add the below resource dictionary directly.
<Application
xmlns:mpdn="http://schemas.mpcoding.com/mpcoding/wpf/notification">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<mpdn:CommonDictionary Source="pack://application:,,,/MpCoding.WPF.Notification;component/Resources/NotificationView.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
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;
}
- Success Notify
var result = _ds.ShowDialog("Success", "Success dialog", NotificationIcon.Success, DisplayType.ShowInfo, false, false);
- Info Notify
var result = _ds.ShowDialog("Info", "Information dialog", NotificationIcon.Info, DisplayType.ShowInfo, false);
- Warning Notify
var result = _ds.ShowDialog("Warning", "Warning dialog", NotificationIcon.Warning, DisplayType.ShowInfo, false, false);
- Error Notify
var result = _ds.ShowDialog("Error", "Error dialog", NotificationIcon.Error, DisplayType.ShowInfo, false, true);
- Confirm Notify
var result = _ds.ShowDialog("Error", "Get Error Confirmation", NotificationIcon.Error, DisplayType.GetConfirmation, false, true);
- Success Toase Send
var result = _ds.SendToast("Success", "Success Toast msg", NotificationIcon.Success);
etc.
Demo Video
Product | Versions 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.
-
net6.0-windows7.0
- Microsoft.Xaml.Behaviors.Wpf (>= 1.1.122)
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 | 107 | 10/8/2024 |
Project updated, Bug fix