/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using System;
using System.Windows;
namespace dnSpy.Contracts.App {
///
/// Shows message boxes
///
public interface IMessageBoxService {
///
/// Shows a message box unless the user has disabled showing this particular message. null
/// is returned if the message was ignored and no message box was shown. Otherwise, the
/// return value is the same as .
///
/// Unique guid for this message
/// Message to show
/// Buttons that should be present
/// Owner window or null to use the main window
///
MsgBoxButton? ShowIgnorableMessage(Guid guid, string message, MsgBoxButton buttons = MsgBoxButton.OK, Window? ownerWindow = null);
///
/// Shows a message box
///
/// Message to show
/// Buttons that should be present
/// Owner window or null to use the main window
///
MsgBoxButton Show(string message, MsgBoxButton buttons = MsgBoxButton.OK, Window? ownerWindow = null);
///
/// Asks the user for a value and returns it or the default value (eg. null or 0) if the
/// user canceled the dialog box.
///
/// Type
/// Label
/// Default text to write to the textbox or null
/// Title or null
/// Converts a string to the type, or null to use the default
/// converter.
/// Verifies the typed message. Returns null or an empty string if
/// it's a valid value, else an error message to show to the user.
/// Owner window or null to use the main window
///
T Ask(string labelMessage, string? defaultText = null, string? title = null, Func? converter = null, Func? verifier = null, Window? ownerWindow = null);
///
/// Shows an exception message
///
/// Exception
/// Message to show or null
/// Owner window or null to use the main window
void Show(Exception exception, string? msg = null, Window? ownerWindow = null);
}
}