using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
public static class DialogServiceExtensions
{
///
/// Shows a modal dialog using a .
///
///
/// The name of the dialog to show.
/// The parameters to pass to the dialog.
/// The action to perform when the dialog is closed.
/// Thrown when the dialog service is not a MaterialDialogService
public static void ShowDialogHost(this IDialogService dialogService, string name, IDialogParameters parameters, Action callback)
{
if (!(dialogService is MaterialDialogService materialDialogService))
throw new NullReferenceException("DialogService must be a MaterialDialogService");
materialDialogService.ShowDialogHost(name, parameters, callback);
}
///
/// Shows a modal dialog using a .
///
///
/// The name of the dialog to show.
/// The parameters to pass to the dialog.
/// The action to perform when the dialog is closed.
/// The name of the that will contain the dialog control
/// Thrown when the dialog service is not a MaterialDialogService
public static void ShowDialogHost(this IDialogService dialogService, string name,
IDialogParameters parameters, Action callback, string windowName)
{
if (!(dialogService is MaterialDialogService materialDialogService))
throw new NullReferenceException("DialogService must be a MaterialDialogService");
materialDialogService.ShowDialogHost(name, windowName, parameters, callback);
}
public static void ShowDialogHost(this IDialogService dialogService, string name, IDialogParameters parameters, string windowName)
{
if (!(dialogService is MaterialDialogService materialDialogService))
throw new NullReferenceException("DialogService must be a MaterialDialogService");
materialDialogService.ShowDialogHost(name, parameters, windowName);
}
}
}