mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Notifier extension methods moved to the INotifier interface.
--HG-- branch : dev
This commit is contained in:
@@ -267,6 +267,7 @@
|
||||
<Compile Include="UI\FlatPositionComparer.cs" />
|
||||
<Compile Include="UI\Navigation\Pager.cs" />
|
||||
<Compile Include="UI\Navigation\PagerParameters.cs" />
|
||||
<Compile Include="UI\Notify\INotifier.cs" />
|
||||
<Compile Include="UI\Resources\IResourceManifestProvider.cs" />
|
||||
<Compile Include="UI\Resources\ResourceManifestBuilder.cs" />
|
||||
<Compile Include="UI\Zones\LayoutWorkContext.cs" />
|
||||
@@ -855,7 +856,6 @@
|
||||
<Compile Include="UI\Navigation\MenuItemComparer.cs" />
|
||||
<Compile Include="UI\Navigation\NavigationManager.cs" />
|
||||
<Compile Include="UI\Notify\Notifier.cs" />
|
||||
<Compile Include="UI\Notify\NotifierExtensions.cs" />
|
||||
<Compile Include="UI\Notify\NotifyEntry.cs" />
|
||||
<Compile Include="UI\Notify\NotifyFilter.cs" />
|
||||
<Compile Include="Security\CreateUserParams.cs" />
|
||||
|
||||
13
src/Orchard/UI/Notify/INotifier.cs
Normal file
13
src/Orchard/UI/Notify/INotifier.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.UI.Notify {
|
||||
public interface INotifier : IDependency {
|
||||
void Information(LocalizedString message);
|
||||
void Warning(LocalizedString message);
|
||||
void Error(LocalizedString message);
|
||||
|
||||
void Add(NotifyType type, LocalizedString message);
|
||||
IEnumerable<NotifyEntry> List();
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,6 @@ using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.UI.Notify {
|
||||
public interface INotifier : IDependency {
|
||||
void Add(NotifyType type, LocalizedString message);
|
||||
IEnumerable<NotifyEntry> List();
|
||||
}
|
||||
|
||||
public class Notifier : INotifier {
|
||||
private readonly IList<NotifyEntry> _entries;
|
||||
|
||||
@@ -18,6 +13,18 @@ namespace Orchard.UI.Notify {
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public void Information(LocalizedString message) {
|
||||
Add(NotifyType.Information, message);
|
||||
}
|
||||
|
||||
public void Warning(LocalizedString message) {
|
||||
Add(NotifyType.Warning, message);
|
||||
}
|
||||
|
||||
public void Error(LocalizedString message) {
|
||||
Add(NotifyType.Error, message);
|
||||
}
|
||||
|
||||
public void Add(NotifyType type, LocalizedString message) {
|
||||
Logger.Information("Notification {0} message: {1}", type, message);
|
||||
_entries.Add(new NotifyEntry { Type = type, Message = message });
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.UI.Notify {
|
||||
public static class NotifierExtensions {
|
||||
public static void Information(this INotifier notifier, LocalizedString message) {
|
||||
notifier.Add(NotifyType.Information, message);
|
||||
}
|
||||
public static void Warning(this INotifier notifier, LocalizedString message) {
|
||||
notifier.Add(NotifyType.Warning, message);
|
||||
}
|
||||
public static void Error(this INotifier notifier, LocalizedString message) {
|
||||
notifier.Add(NotifyType.Error, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user