diff --git a/.gitignore b/.gitignore index 6712648..8d5dc73 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,5 @@ $RECYCLE.BIN/ Network Trash Folder Temporary Items .apdisk +*.suo +1.0/WPFNotification/.vs/WPFNotification/v14/.suo diff --git a/1.0/WPFNotification/.vs/WPFNotification/v14/.suo b/1.0/WPFNotification/.vs/WPFNotification/v14/.suo index 1e57ec3..8e1c47c 100644 Binary files a/1.0/WPFNotification/.vs/WPFNotification/v14/.suo and b/1.0/WPFNotification/.vs/WPFNotification/v14/.suo differ diff --git a/1.0/WPFNotification/WPFNotification/App.config b/1.0/WPFNotification/WPFNotification/App.config index 1751f05..2eca9e5 100644 --- a/1.0/WPFNotification/WPFNotification/App.config +++ b/1.0/WPFNotification/WPFNotification/App.config @@ -1,7 +1,7 @@ - + diff --git a/1.0/WPFNotification/WPFNotification/Converters/EmptyStringConverter.cs b/1.0/WPFNotification/WPFNotification/Converters/EmptyStringConverter.cs index b733c2d..7072810 100644 --- a/1.0/WPFNotification/WPFNotification/Converters/EmptyStringConverter.cs +++ b/1.0/WPFNotification/WPFNotification/Converters/EmptyStringConverter.cs @@ -6,8 +6,6 @@ namespace WPFNotification.Converters { public class EmptyStringConverter : BaseConverter, IValueConverter { - public EmptyStringConverter() - { } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { @@ -19,6 +17,5 @@ public object ConvertBack(object value, Type targetType, { throw new NotImplementedException(); } - } } diff --git a/1.0/WPFNotification/WPFNotification/Core/Configuration/NotificationFlowDirection.cs b/1.0/WPFNotification/WPFNotification/Core/Configuration/NotificationFlowDirection.cs index 9ab69db..92b42c3 100644 --- a/1.0/WPFNotification/WPFNotification/Core/Configuration/NotificationFlowDirection.cs +++ b/1.0/WPFNotification/WPFNotification/Core/Configuration/NotificationFlowDirection.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WPFNotification.Core.Configuration +namespace WPFNotification.Core.Configuration { /// /// Enum that represent the notification window Directions diff --git a/1.0/WPFNotification/WPFNotification/Core/Interactivity/FadeBehavior.cs b/1.0/WPFNotification/WPFNotification/Core/Interactivity/FadeBehavior.cs index f2b363f..8bc7542 100644 --- a/1.0/WPFNotification/WPFNotification/Core/Interactivity/FadeBehavior.cs +++ b/1.0/WPFNotification/WPFNotification/Core/Interactivity/FadeBehavior.cs @@ -59,8 +59,8 @@ public sealed class FadeBehavior : Behavior /// public TimeSpan BeginTime { - get { return (TimeSpan)this.GetValue(BeginTimeProperty); } - set { this.SetValue(BeginTimeProperty, value); } + get { return (TimeSpan)GetValue(BeginTimeProperty); } + set { SetValue(BeginTimeProperty, value); } } /// @@ -68,8 +68,8 @@ public TimeSpan BeginTime /// public TimeSpan Duration { - get { return (TimeSpan)this.GetValue(DurationProperty); } - set { this.SetValue(DurationProperty, value); } + get { return (TimeSpan)GetValue(DurationProperty); } + set { SetValue(DurationProperty, value); } } /// @@ -77,8 +77,8 @@ public TimeSpan Duration /// public bool IsAnimatingOnIsVisibleChanged { - get { return (bool)this.GetValue(IsAnimatingOnIsVisibleChangedProperty); } - set { this.SetValue(IsAnimatingOnIsVisibleChangedProperty, value); } + get { return (bool)GetValue(IsAnimatingOnIsVisibleChangedProperty); } + set { SetValue(IsAnimatingOnIsVisibleChangedProperty, value); } } /// @@ -86,8 +86,8 @@ public bool IsAnimatingOnIsVisibleChanged /// public bool IsAnimatingOnLoaded { - get { return (bool)this.GetValue(IsAnimatingOnLoadedProperty); } - set { this.SetValue(IsAnimatingOnLoadedProperty, value); } + get { return (bool)GetValue(IsAnimatingOnLoadedProperty); } + set { SetValue(IsAnimatingOnLoadedProperty, value); } } #endregion @@ -99,15 +99,15 @@ public bool IsAnimatingOnLoaded /// public void FadeIn() { - Storyboard storyboard = GetFadeInStoryboard(this.BeginTime, this.Duration); + Storyboard storyboard = GetFadeInStoryboard(BeginTime, Duration); EventHandler eventHandler = null; eventHandler = (sender, e) => { storyboard.Completed -= eventHandler; - this.OnFadeInCompleted(this, EventArgs.Empty); + OnFadeInCompleted(this, EventArgs.Empty); }; storyboard.Completed += eventHandler; - storyboard.Begin(this.AssociatedObject); + storyboard.Begin(AssociatedObject); } /// @@ -115,15 +115,15 @@ public void FadeIn() /// public void FadeOut() { - Storyboard storyboard = GetFadeOutStoryboard(this.BeginTime, this.Duration); + Storyboard storyboard = GetFadeOutStoryboard(BeginTime, Duration); EventHandler eventHandler = null; eventHandler = (sender, e) => { storyboard.Completed -= eventHandler; - this.OnFadeOutCompleted(this, EventArgs.Empty); + OnFadeOutCompleted(this, EventArgs.Empty); }; storyboard.Completed += eventHandler; - storyboard.Begin(this.AssociatedObject); + storyboard.Begin(AssociatedObject); } #endregion @@ -137,8 +137,8 @@ protected override void OnAttached() { base.OnAttached(); - this.AssociatedObject.IsVisibleChanged += this.OnIsVisibleChanged; - this.AssociatedObject.Loaded += this.OnLoaded; + AssociatedObject.IsVisibleChanged += OnIsVisibleChanged; + AssociatedObject.Loaded += OnLoaded; } /// @@ -148,8 +148,8 @@ protected override void OnDetaching() { base.OnDetaching(); - this.AssociatedObject.IsVisibleChanged -= this.OnIsVisibleChanged; - this.AssociatedObject.Loaded -= this.OnLoaded; + AssociatedObject.IsVisibleChanged -= OnIsVisibleChanged; + AssociatedObject.Loaded -= OnLoaded; } #endregion @@ -164,22 +164,24 @@ protected override void OnDetaching() /// The . private static Storyboard GetFadeInStoryboard(TimeSpan beginTime, TimeSpan duration) { - DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(); - animation.FillBehavior = FillBehavior.HoldEnd; + DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames + { + FillBehavior = FillBehavior.HoldEnd + }; animation.KeyFrames.Add( - new SplineDoubleKeyFrame() + new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(new TimeSpan()), Value = 0 }); animation.KeyFrames.Add( - new SplineDoubleKeyFrame() + new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(beginTime), Value = 0 }); animation.KeyFrames.Add( - new SplineDoubleKeyFrame() + new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(beginTime + duration), Value = 1 @@ -200,16 +202,18 @@ private static Storyboard GetFadeInStoryboard(TimeSpan beginTime, TimeSpan durat /// The . private static Storyboard GetFadeOutStoryboard(TimeSpan beginTime, TimeSpan duration) { - DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(); - animation.FillBehavior = FillBehavior.HoldEnd; + DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames + { + FillBehavior = FillBehavior.HoldEnd + }; animation.KeyFrames.Add( - new SplineDoubleKeyFrame() + new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(beginTime), Value = 1 }); animation.KeyFrames.Add( - new SplineDoubleKeyFrame() + new SplineDoubleKeyFrame { KeySpline = new KeySpline(0.5, 0, 1, 0.75), KeyTime = KeyTime.FromTimeSpan(beginTime + duration), @@ -234,12 +238,8 @@ private static Storyboard GetFadeOutStoryboard(TimeSpan beginTime, TimeSpan dura /// The e. private void OnFadeInCompleted(object sender, EventArgs e) { - EventHandler eventHandler = this.FadeInCompleted; - - if (eventHandler != null) - { - eventHandler(sender, e); - } + EventHandler eventHandler = FadeInCompleted; + eventHandler?.Invoke(sender, e); } /// @@ -249,12 +249,8 @@ private void OnFadeInCompleted(object sender, EventArgs e) /// The e. private void OnFadeOutCompleted(object sender, EventArgs e) { - EventHandler eventHandler = this.FadeOutCompleted; - - if (eventHandler != null) - { - eventHandler(sender, e); - } + EventHandler eventHandler = FadeOutCompleted; + eventHandler?.Invoke(sender, e); } /// @@ -264,11 +260,11 @@ private void OnFadeOutCompleted(object sender, EventArgs e) /// The e. private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { - if (this.IsAnimatingOnIsVisibleChanged) + if (IsAnimatingOnIsVisibleChanged) { - if (this.AssociatedObject.Visibility == Visibility.Visible) + if (AssociatedObject.Visibility == Visibility.Visible) { - this.FadeIn(); + FadeIn(); } // this.FadeOut(); @@ -282,9 +278,9 @@ private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArg /// The e. private void OnLoaded(object sender, RoutedEventArgs e) { - if (this.IsAnimatingOnLoaded) + if (IsAnimatingOnLoaded) { - this.FadeIn(); + FadeIn(); } } diff --git a/1.0/WPFNotification/WPFNotification/Core/Interactivity/SlideBehavior.cs b/1.0/WPFNotification/WPFNotification/Core/Interactivity/SlideBehavior.cs index cae4c0f..f572af5 100644 --- a/1.0/WPFNotification/WPFNotification/Core/Interactivity/SlideBehavior.cs +++ b/1.0/WPFNotification/WPFNotification/Core/Interactivity/SlideBehavior.cs @@ -66,8 +66,8 @@ public sealed class SlideBehavior : Behavior /// public TimeSpan BeginTime { - get { return (TimeSpan)this.GetValue(BeginTimeProperty); } - set { this.SetValue(BeginTimeProperty, value); } + get { return (TimeSpan)GetValue(BeginTimeProperty); } + set { SetValue(BeginTimeProperty, value); } } /// @@ -75,8 +75,8 @@ public TimeSpan BeginTime /// public TimeSpan Duration { - get { return (TimeSpan)this.GetValue(DurationProperty); } - set { this.SetValue(DurationProperty, value); } + get { return (TimeSpan)GetValue(DurationProperty); } + set { SetValue(DurationProperty, value); } } /// @@ -84,8 +84,8 @@ public TimeSpan Duration /// public bool IsAnimatingOnIsVisibleChanged { - get { return (bool)this.GetValue(IsAnimatingOnIsVisibleChangedProperty); } - set { this.SetValue(IsAnimatingOnIsVisibleChangedProperty, value); } + get { return (bool)GetValue(IsAnimatingOnIsVisibleChangedProperty); } + set { SetValue(IsAnimatingOnIsVisibleChangedProperty, value); } } /// @@ -93,8 +93,8 @@ public bool IsAnimatingOnIsVisibleChanged /// public bool IsAnimatingOnLoaded { - get { return (bool)this.GetValue(IsAnimatingOnLoadedProperty); } - set { this.SetValue(IsAnimatingOnLoadedProperty, value); } + get { return (bool)GetValue(IsAnimatingOnLoadedProperty); } + set { SetValue(IsAnimatingOnLoadedProperty, value); } } /// @@ -102,8 +102,8 @@ public bool IsAnimatingOnLoaded /// public double Offset { - get { return (double)this.GetValue(OffsetProperty); } - set { this.SetValue(OffsetProperty, value); } + get { return (double)GetValue(OffsetProperty); } + set { SetValue(OffsetProperty, value); } } #endregion @@ -115,19 +115,19 @@ public double Offset /// public void SlideIn() { - this.AssociatedObject.IsHitTestVisible = false; - this.AssociatedObject.RenderTransform = new TranslateTransform(0, 0); + AssociatedObject.IsHitTestVisible = false; + AssociatedObject.RenderTransform = new TranslateTransform(0, 0); - Storyboard storyboard = GetSlideInStoryboard(this.BeginTime, this.Duration, this.Offset); + Storyboard storyboard = GetSlideInStoryboard(BeginTime, Duration, Offset); EventHandler eventHandler = null; eventHandler = (sender, e) => { storyboard.Completed -= eventHandler; - this.AssociatedObject.IsHitTestVisible = true; - this.OnSlideInCompleted(this, EventArgs.Empty); + AssociatedObject.IsHitTestVisible = true; + OnSlideInCompleted(this, EventArgs.Empty); }; storyboard.Completed += eventHandler; - storyboard.Begin(this.AssociatedObject); + storyboard.Begin(AssociatedObject); } /// @@ -135,19 +135,19 @@ public void SlideIn() /// public void SlideOut() { - this.AssociatedObject.IsHitTestVisible = false; - this.AssociatedObject.RenderTransform = new TranslateTransform(0, 0); + AssociatedObject.IsHitTestVisible = false; + AssociatedObject.RenderTransform = new TranslateTransform(0, 0); - Storyboard storyboard = GetSlideOutStoryboard(this.BeginTime, this.Duration, this.Offset); + Storyboard storyboard = GetSlideOutStoryboard(BeginTime, Duration, Offset); EventHandler eventHandler = null; eventHandler = (sender, e) => { storyboard.Completed -= eventHandler; - this.AssociatedObject.IsHitTestVisible = true; - this.OnSlideOutCompleted(this, EventArgs.Empty); + AssociatedObject.IsHitTestVisible = true; + OnSlideOutCompleted(this, EventArgs.Empty); }; storyboard.Completed += eventHandler; - storyboard.Begin(this.AssociatedObject); + storyboard.Begin(AssociatedObject); } #endregion @@ -161,8 +161,8 @@ protected override void OnAttached() { base.OnAttached(); - this.AssociatedObject.IsVisibleChanged += this.OnIsVisibleChanged; - this.AssociatedObject.Loaded += this.OnLoaded; + AssociatedObject.IsVisibleChanged += OnIsVisibleChanged; + AssociatedObject.Loaded += OnLoaded; } /// @@ -172,8 +172,8 @@ protected override void OnDetaching() { base.OnDetaching(); - this.AssociatedObject.IsVisibleChanged -= this.OnIsVisibleChanged; - this.AssociatedObject.Loaded -= this.OnLoaded; + AssociatedObject.IsVisibleChanged -= OnIsVisibleChanged; + AssociatedObject.Loaded -= OnLoaded; } #endregion @@ -192,16 +192,18 @@ private static Storyboard GetSlideInStoryboard( TimeSpan duration, double offset) { - DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(); - animation.FillBehavior = FillBehavior.HoldEnd; + DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames + { + FillBehavior = FillBehavior.HoldEnd + }; animation.KeyFrames.Add( - new SplineDoubleKeyFrame() + new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(beginTime), Value = offset }); animation.KeyFrames.Add( - new SplineDoubleKeyFrame() + new SplineDoubleKeyFrame { KeySpline = new KeySpline(0, 0.5, 0.5, 1), KeyTime = KeyTime.FromTimeSpan(beginTime + duration), @@ -260,12 +262,8 @@ private static Storyboard GetSlideOutStoryboard( /// The e. private void OnSlideInCompleted(object sender, EventArgs e) { - EventHandler eventHandler = this.SlideInCompleted; - - if (eventHandler != null) - { - eventHandler(sender, e); - } + EventHandler eventHandler = SlideInCompleted; + eventHandler?.Invoke(sender, e); } /// @@ -275,12 +273,8 @@ private void OnSlideInCompleted(object sender, EventArgs e) /// The e. private void OnSlideOutCompleted(object sender, EventArgs e) { - EventHandler eventHandler = this.SlideOutCompleted; - - if (eventHandler != null) - { - eventHandler(sender, e); - } + EventHandler eventHandler = SlideOutCompleted; + eventHandler?.Invoke(sender, e); } /// @@ -290,11 +284,11 @@ private void OnSlideOutCompleted(object sender, EventArgs e) /// The e. private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { - if (this.IsAnimatingOnIsVisibleChanged) + if (IsAnimatingOnIsVisibleChanged) { - if (this.AssociatedObject.Visibility == Visibility.Visible) + if (AssociatedObject.Visibility == Visibility.Visible) { - this.SlideIn(); + SlideIn(); } // this.SlideOut(); @@ -308,9 +302,9 @@ private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArg /// The e. private void OnLoaded(object sender, RoutedEventArgs e) { - if (this.IsAnimatingOnLoaded) + if (IsAnimatingOnLoaded) { - this.SlideIn(); + SlideIn(); } } diff --git a/1.0/WPFNotification/WPFNotification/Core/NotifyBox.cs b/1.0/WPFNotification/WPFNotification/Core/NotifyBox.cs index 3b1ad0c..1e17a9d 100644 --- a/1.0/WPFNotification/WPFNotification/Core/NotifyBox.cs +++ b/1.0/WPFNotification/WPFNotification/Core/NotifyBox.cs @@ -21,7 +21,7 @@ public static class NotifyBox /// /// Number of notification windows /// - private static int notificationWindowsCount; + private static int _notificationWindowsCount; /// /// The margin between notification windows. @@ -31,12 +31,12 @@ public static class NotifyBox /// /// list of notifications window. /// - private static List notificationWindows; + private static readonly List NotificationWindows; /// /// buffer list of notifications window. /// - private static List notificationsBuffer; + private static readonly List NotificationsBuffer; #endregion @@ -47,9 +47,9 @@ public static class NotifyBox /// static NotifyBox() { - notificationWindows = new List(); - notificationsBuffer = new List(); - notificationWindowsCount = 0; + NotificationWindows = new List(); + NotificationsBuffer = new List(); + _notificationWindowsCount = 0; } #endregion @@ -63,7 +63,7 @@ static NotifyBox() public static void Show(object content, NotificationConfiguration configuration) { DataTemplate notificationTemplate = (DataTemplate)Application.Current.Resources[configuration.TemplateName]; - Window window = new Window() + Window window = new Window { Title = "", Width = configuration.Width.Value, @@ -95,23 +95,24 @@ public static void Show(object content) /// /// The window. /// The display duration. + /// Flow direction public static void Show(Window window, TimeSpan displayDuration, NotificationFlowDirection notificationFlowDirection) { BehaviorCollection behaviors = Interaction.GetBehaviors(window); behaviors.Add(new FadeBehavior()); behaviors.Add(new SlideBehavior()); SetWindowDirection(window, notificationFlowDirection); - notificationWindowsCount += 1; + _notificationWindowsCount += 1; WindowInfo windowInfo = new WindowInfo() { - ID = notificationWindowsCount, + Id = _notificationWindowsCount, DisplayDuration = displayDuration, Window = window }; windowInfo.Window.Closed += Window_Closed; - if (notificationWindows.Count + 1 > MAX_NOTIFICATIONS) + if (NotificationWindows.Count + 1 > MAX_NOTIFICATIONS) { - notificationsBuffer.Add(windowInfo); + NotificationsBuffer.Add(windowInfo); } else { @@ -119,7 +120,7 @@ public static void Show(Window window, TimeSpan displayDuration, NotificationFlo .Timer(displayDuration) .ObserveOnDispatcher() .Subscribe(x => OnTimerElapsed(windowInfo)); - notificationWindows.Add(windowInfo); + NotificationWindows.Add(windowInfo); window.Show(); } } @@ -129,10 +130,10 @@ public static void Show(Window window, TimeSpan displayDuration, NotificationFlo /// public static void ClearNotifications() { - notificationWindows.Clear(); - notificationsBuffer.Clear(); + NotificationWindows.Clear(); + NotificationsBuffer.Clear(); - notificationWindowsCount = 0; + _notificationWindowsCount = 0; } @@ -143,15 +144,12 @@ public static void ClearNotifications() /// /// Called when the timer has elapsed. Removes any stale notifications. /// - /// The sender. - /// The instance containing the event data. private static void OnTimerElapsed(WindowInfo windowInfo) { - if (notificationWindows.Count > 0 && !notificationWindows.Any(i => i.ID == windowInfo.ID)) + if (NotificationWindows.Count > 0 && NotificationWindows.All(i => i.Id != windowInfo.Id)) { return; } - DateTime now = DateTime.Now; if (windowInfo.Window.IsMouseOver) { @@ -173,19 +171,19 @@ private static void OnTimerElapsed(WindowInfo windowInfo) eventHandler = (sender2, e2) => { fadeBehavior.FadeOutCompleted -= eventHandler; - notificationWindows.Remove(windowInfo); + NotificationWindows.Remove(windowInfo); windowInfo.Window.Close(); - if (notificationsBuffer != null && notificationsBuffer.Count > 0) + if (NotificationsBuffer != null && NotificationsBuffer.Count > 0) { - var BufferWindowInfo = notificationsBuffer.First(); + var bufferWindowInfo = NotificationsBuffer.First(); Observable - .Timer(BufferWindowInfo.DisplayDuration) + .Timer(bufferWindowInfo.DisplayDuration) .ObserveOnDispatcher() - .Subscribe(x => OnTimerElapsed(BufferWindowInfo)); - notificationWindows.Add(BufferWindowInfo); - BufferWindowInfo.Window.Show(); - notificationsBuffer.Remove(BufferWindowInfo); + .Subscribe(x => OnTimerElapsed(bufferWindowInfo)); + NotificationWindows.Add(bufferWindowInfo); + bufferWindowInfo.Window.Show(); + NotificationsBuffer.Remove(bufferWindowInfo); } }; fadeBehavior.FadeOutCompleted += eventHandler; @@ -200,20 +198,20 @@ private static void OnTimerElapsed(WindowInfo windowInfo) static void Window_Closed(object sender, EventArgs e) { var window = (Window)sender; - if (notificationWindows.Count > 0 && notificationWindows.First().Window == window) + if (NotificationWindows.Count > 0 && NotificationWindows.First().Window == window) { - WindowInfo windowInfo = notificationWindows.First(); - notificationWindows.Remove(windowInfo); - if (notificationsBuffer != null && notificationsBuffer.Count > 0) + WindowInfo windowInfo = NotificationWindows.First(); + NotificationWindows.Remove(windowInfo); + if (NotificationsBuffer != null && NotificationsBuffer.Count > 0) { - var BufferWindowInfo = notificationsBuffer.First(); + var bufferWindowInfo = NotificationsBuffer.First(); Observable - .Timer(BufferWindowInfo.DisplayDuration) + .Timer(bufferWindowInfo.DisplayDuration) .ObserveOnDispatcher() - .Subscribe(x => OnTimerElapsed(BufferWindowInfo)); - notificationWindows.Add(BufferWindowInfo); - BufferWindowInfo.Window.Show(); - notificationsBuffer.Remove(BufferWindowInfo); + .Subscribe(x => OnTimerElapsed(bufferWindowInfo)); + NotificationWindows.Add(bufferWindowInfo); + bufferWindowInfo.Window.Show(); + NotificationsBuffer.Remove(bufferWindowInfo); } } } @@ -263,7 +261,7 @@ private static void SetWindowDirection(Window window, NotificationFlowDirection /// private sealed class WindowInfo { - public int ID { get; set; } + public int Id { get; set; } /// /// Gets or sets the display duration. /// diff --git a/1.0/WPFNotification/WPFNotification/Model/Notification.cs b/1.0/WPFNotification/WPFNotification/Model/Notification.cs index 20bbbd5..9188599 100644 --- a/1.0/WPFNotification/WPFNotification/Model/Notification.cs +++ b/1.0/WPFNotification/WPFNotification/Model/Notification.cs @@ -5,6 +5,6 @@ public class Notification { public string Title { get; set; } public string Message { get; set; } - public string ImgURL { get; set; } + public string ImgUrl { get; set; } } } diff --git a/1.0/WPFNotification/WPFNotification/Properties/Settings.Designer.cs b/1.0/WPFNotification/WPFNotification/Properties/Settings.Designer.cs index 729dc09..c73f998 100644 --- a/1.0/WPFNotification/WPFNotification/Properties/Settings.Designer.cs +++ b/1.0/WPFNotification/WPFNotification/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace WPFNotification.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/1.0/WPFNotification/WPFNotification/Services/NotificationDialogService.cs b/1.0/WPFNotification/WPFNotification/Services/NotificationDialogService.cs index d371cd9..d7ec3db 100644 --- a/1.0/WPFNotification/WPFNotification/Services/NotificationDialogService.cs +++ b/1.0/WPFNotification/WPFNotification/Services/NotificationDialogService.cs @@ -1,5 +1,4 @@ -using System; -using WPFNotification.Core; +using WPFNotification.Core; using WPFNotification.Core.Configuration; namespace WPFNotification.Services diff --git a/1.0/WPFNotification/WPFNotification/WPFNotification.csproj b/1.0/WPFNotification/WPFNotification/WPFNotification.csproj index 1031ea2..c22f269 100644 --- a/1.0/WPFNotification/WPFNotification/WPFNotification.csproj +++ b/1.0/WPFNotification/WPFNotification/WPFNotification.csproj @@ -9,7 +9,7 @@ Properties WPFNotification WPFNotification - v4.5 + v4.6 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 diff --git a/1.0/WPFNotification/WPFNotificationDemo/App.xaml b/1.0/WPFNotification/WPFNotificationDemo/App.xaml index 12ecb43..bdf7593 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/App.xaml +++ b/1.0/WPFNotification/WPFNotificationDemo/App.xaml @@ -1,4 +1,11 @@ - + diff --git a/1.0/WPFNotification/WPFNotificationDemo/App.xaml.cs b/1.0/WPFNotification/WPFNotificationDemo/App.xaml.cs index bd21ed5..968048e 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/App.xaml.cs +++ b/1.0/WPFNotification/WPFNotificationDemo/App.xaml.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; +using System.Windows; namespace WPFNotificationDemo { diff --git a/1.0/WPFNotification/WPFNotificationDemo/Assets/MailNotificationUI.xaml b/1.0/WPFNotification/WPFNotificationDemo/Assets/MailNotificationUI.xaml index ea8f4d4..ce484f9 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/Assets/MailNotificationUI.xaml +++ b/1.0/WPFNotification/WPFNotificationDemo/Assets/MailNotificationUI.xaml @@ -1,10 +1,10 @@  + xmlns:model="clr-namespace:WPFNotificationDemo.Model" + xmlns:notificationView="clr-namespace:WPFNotificationDemo.Assets"> - - + + \ No newline at end of file diff --git a/1.0/WPFNotification/WPFNotificationDemo/Core/Constants.cs b/1.0/WPFNotification/WPFNotificationDemo/Core/Constants.cs index ebac636..abe907b 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/Core/Constants.cs +++ b/1.0/WPFNotification/WPFNotificationDemo/Core/Constants.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WPFNotificationDemo.Core +namespace WPFNotificationDemo.Core { public static class Constants { diff --git a/1.0/WPFNotification/WPFNotificationDemo/MainWindow.xaml.cs b/1.0/WPFNotification/WPFNotificationDemo/MainWindow.xaml.cs index f6a5869..21d6068 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/MainWindow.xaml.cs +++ b/1.0/WPFNotification/WPFNotificationDemo/MainWindow.xaml.cs @@ -1,18 +1,4 @@ using FirstFloor.ModernUI.Windows.Controls; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using WPFNotificationDemo.ViewModel; namespace WPFNotificationDemo diff --git a/1.0/WPFNotification/WPFNotificationDemo/Model/MailNotification.cs b/1.0/WPFNotification/WPFNotificationDemo/Model/MailNotification.cs index 8909974..900f049 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/Model/MailNotification.cs +++ b/1.0/WPFNotification/WPFNotificationDemo/Model/MailNotification.cs @@ -1,5 +1,4 @@ - -namespace WPFNotificationDemo.Model +namespace WPFNotificationDemo.Model { public class MailNotification { diff --git a/1.0/WPFNotification/WPFNotificationDemo/ViewModel/MainViewModel.cs b/1.0/WPFNotification/WPFNotificationDemo/ViewModel/MainViewModel.cs index b99d47f..5450a71 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/ViewModel/MainViewModel.cs +++ b/1.0/WPFNotification/WPFNotificationDemo/ViewModel/MainViewModel.cs @@ -22,20 +22,18 @@ namespace WPFNotificationDemo.ViewModel /// public class MainViewModel : ViewModelBase { - private readonly INotificationDialogService _dailogService; + private readonly INotificationDialogService _dialogService; + /// /// Initializes a new instance of the MainViewModel class. /// - /// The NotificationDialogService object - - - public MainViewModel(INotificationDialogService dailogService) + /// The NotificationDialogService object + public MainViewModel(INotificationDialogService dialogService) { - _dailogService = dailogService; + _dialogService = dialogService; } - private RelayCommand _mailNotification; /// @@ -57,7 +55,7 @@ public RelayCommand MailNotification Content = "I would like to request for vacation from 20/12/2015 to 30/12/2015 ............." }; var configuration = new NotificationConfiguration(TimeSpan.Zero, null, null, Constants.MailNotificationTemplateName, null); - _dailogService.ShowNotificationWindow(newNotification, configuration); + _dialogService.ShowNotificationWindow(newNotification, configuration); })); } } @@ -85,7 +83,7 @@ public RelayCommand AddNotification Message = "Test one Fail Please check your Machine Code and Try Again" // ,ImgURL = "pack://application:,,,a/Resources/Images/warning.png" }; - _dailogService.ShowNotificationWindow(newNotification, notificationConfiguration); + _dialogService.ShowNotificationWindow(newNotification, notificationConfiguration); })); } } @@ -104,7 +102,7 @@ public RelayCommand ClearNotifications ?? (_clearNotifications = new RelayCommand( () => { - _dailogService.ClearNotifications(); + _dialogService.ClearNotifications(); })); } } diff --git a/1.0/WPFNotification/WPFNotificationDemo/WPFNotificationDemo.csproj b/1.0/WPFNotification/WPFNotificationDemo/WPFNotificationDemo.csproj index b778488..af42fb0 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/WPFNotificationDemo.csproj +++ b/1.0/WPFNotification/WPFNotificationDemo/WPFNotificationDemo.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties WPFNotificationDemo WPFNotificationDemo - v4.5 + v4.6 512 diff --git a/1.0/WPFNotification/WPFNotificationDemo/app.config b/1.0/WPFNotification/WPFNotificationDemo/app.config index aee928e..917c515 100644 --- a/1.0/WPFNotification/WPFNotificationDemo/app.config +++ b/1.0/WPFNotification/WPFNotificationDemo/app.config @@ -8,4 +8,4 @@ - + diff --git a/README.md b/README.md index 1f3f157..bacba5b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ See some [screenshots](https://github.com/muhammad-magdy/WPFToastNotification/wi * Show one notification per time and if there are other notifications they will be placed in a queue and will be shown when the place is available * Prevent the notification from fading out when hovering on it * Allow to clear all notification from the notification list and the buffer list -* **Support windows 7 or later.** +* **Support Windows 7 or later.** ## Acknowledgements * Adapted the NotifyBox from [Elysium](https://elysiumextra.codeplex.com)