Notifier extension methods moved to the INotifier interface.

--HG--
branch : dev
This commit is contained in:
Suha Can
2011-06-20 14:46:02 -07:00
parent 4273f82ac9
commit b11cf31c1f
4 changed files with 26 additions and 21 deletions

View File

@@ -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" />

View 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();
}
}

View File

@@ -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 });

View File

@@ -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);
}
}
}