51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Forms;
|
|
using JD.LogService;
|
|
|
|
namespace JD.MessageService
|
|
{
|
|
/// <summary>
|
|
/// Message service implmentation for the command line.
|
|
/// </summary>
|
|
internal class CommandlineMessageService : IMessageService
|
|
{
|
|
#region Methods
|
|
|
|
public void Initialize() { }
|
|
|
|
public void Show(LogCategory category, string message, string caption)
|
|
{ }
|
|
|
|
public MessageBoxResult AskQuestion(string question, string caption, MessageBoxImage icon, MessageBoxButton buttons, MessageBoxResult defaultResult)
|
|
{
|
|
if (buttons == MessageBoxButton.YesNo || buttons == MessageBoxButton.YesNoCancel)
|
|
{
|
|
return defaultResult;
|
|
}
|
|
|
|
throw new InvalidOperationException("Cannot use this method in command-line mode.");
|
|
}
|
|
|
|
public MessageDialog.Button ShowMessageDialog(MessageDialog dialog)
|
|
{
|
|
throw new InvalidOperationException("Cannot use this method in command-line mode.");
|
|
}
|
|
|
|
public string ShowInputBox(string question, string caption, string defaultValue, MessageService.ValidationPredicate validationPredicate)
|
|
{
|
|
throw new InvalidOperationException("Cannot use this method in command-line mode.");
|
|
}
|
|
|
|
public IBalloon ShowBalloon(TimeSpan timeout, string title, string text, ToolTipIcon icon, Action clickAction)
|
|
{
|
|
if (icon == ToolTipIcon.Error || icon == ToolTipIcon.Warning)
|
|
{
|
|
LogService.LogService.LogWarning(title + " " + text);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|