Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion WPFGrowlNotification/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources\ButtonStyle.xaml"/>
<ResourceDictionary Source="Resources/IconData.xaml"/>
<ResourceDictionary Source="Resources/ButtonStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
8 changes: 4 additions & 4 deletions WPFGrowlNotification/DesignTimeNotificationData.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Notifications xmlns="clr-namespace:WPFGrowlNotification">
<Notification Id="1" Title="Notification #1" ImageUrl="pack://application:,,,/Resources/notification-icon.png" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
<Notification Id="2" Title="Notification #2" ImageUrl="pack://application:,,,/Resources/microsoft-windows-8-logo.png" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
<Notification Id="3" Title="Notification #3" ImageUrl="pack://application:,,,/Resources/facebook-button.png" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
<Notification Id="4" Title="Notification #4" ImageUrl="pack://application:,,,/Resources/Radiation_warning_symbol.png" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
<Notification Id="1" Title="Notification #1" IconData="{StaticResource WarningIconData}" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
<Notification Id="2" Title="Notification #2" IconData="{StaticResource WarningIconData}" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
<Notification Id="3" Title="Notification #3" IconData="{StaticResource WarningIconData}" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
<Notification Id="4" Title="Notification #4" IconData="{StaticResource WarningIconData}" Message="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." />
</Notifications>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window x:Class="WPFGrowlNotification.GrowlNotifiactions"
<Window x:Class="WPFGrowlNotification.GrowlNotifications"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Model="clr-namespace:WPFGrowlNotification"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand All @@ -23,7 +23,9 @@
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Grid.RowSpan="2" Source="{Binding Path=ImageUrl}" Margin="4" Width="80"></Image>
<Canvas Grid.RowSpan="2" Margin="4" Width="80" Height="80">
<Path Width="80" Height="80" Stretch="Fill" Fill="#FFFFFF" Data="{Binding IconData}"/>
</Canvas>
<TextBlock Grid.Column="1" Text="{Binding Path=Title}" TextOptions.TextRenderingMode="ClearType" TextOptions.TextFormattingMode="Display" Foreground="White"
FontFamily="Arial" FontSize="14" FontWeight="Bold" VerticalAlignment="Center" Margin="2,4,4,2" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" />
<Button x:Name="CloseButton" Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,0,12,0" Style="{StaticResource CloseButton}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

namespace WPFGrowlNotification
{
public partial class GrowlNotifiactions
public partial class GrowlNotifications
{
private const byte MAX_NOTIFICATIONS = 4;
private int count;
public Notifications Notifications = new Notifications();
private readonly Notifications buffer = new Notifications();

public GrowlNotifiactions()
public GrowlNotifications()
{
InitializeComponent();
NotificationsControl.DataContext = Notifications;
Expand Down
19 changes: 14 additions & 5 deletions WPFGrowlNotification/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using System.Windows.Media;

namespace WPFGrowlNotification
{
Expand All @@ -9,7 +10,7 @@ public partial class MainWindow
{
private const double topOffset = 20;
private const double leftOffset = 380;
readonly GrowlNotifiactions growlNotifications = new GrowlNotifiactions();
readonly GrowlNotifications growlNotifications = new GrowlNotifications();

public MainWindow()
{
Expand All @@ -20,22 +21,30 @@ public MainWindow()

private void ButtonClick1(object sender, RoutedEventArgs e)
{
growlNotifications.AddNotification(new Notification { Title = "Mesage #1", ImageUrl = "pack://application:,,,/Resources/notification-icon.png", Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
var icon = PathGeometry.Parse("F1 M 31.6667,19L 44.3333,19L 57,31.6667L 57,44.3333L 44.3333,57L 31.6667,57L 19,44.3333L 19,31.6667L 31.6667,19 Z M 26.4762,45.0454L 30.9546,49.5238L 38,42.4783L 45.0454,49.5238L 49.5237,45.0454L 42.4783,38L 49.5238,30.9546L 45.0454,26.4763L 38,33.5217L 30.9546,26.4762L 26.4762,30.9546L 33.5217,38L 26.4762,45.0454 Z");

growlNotifications.AddNotification(new Notification { Title = "Mesage #1", IconData = icon, Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
growlNotifications.AddNotification(new Notification { Title = "Mesage #2", ImageUrl = "pack://application:,,,/Resources/microsoft-windows-8-logo.png", Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
var icon = PathGeometry.Parse("F1 M 31.6667,19L 44.3333,19L 57,31.6667L 57,44.3333L 44.3333,57L 31.6667,57L 19,44.3333L 19,31.6667L 31.6667,19 Z M 26.4762,45.0454L 30.9546,49.5238L 38,42.4783L 45.0454,49.5238L 49.5237,45.0454L 42.4783,38L 49.5238,30.9546L 45.0454,26.4763L 38,33.5217L 30.9546,26.4762L 26.4762,30.9546L 33.5217,38L 26.4762,45.0454 Z");

growlNotifications.AddNotification(new Notification { Title = "Mesage #2", IconData = icon, Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
}

private void ButtonClick2(object sender, RoutedEventArgs e)
{
growlNotifications.AddNotification(new Notification { Title = "Mesage #3", ImageUrl = "pack://application:,,,/Resources/facebook-button.png", Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
var icon = PathGeometry.Parse("F1 M 58.5832,55.4172L 17.4169,55.4171C 15.5619,53.5621 15.5619,50.5546 17.4168,48.6996L 35.201,15.8402C 37.056,13.9852 40.0635,13.9852 41.9185,15.8402L 58.5832,48.6997C 60.4382,50.5546 60.4382,53.5622 58.5832,55.4172 Z M 34.0417,25.7292L 36.0208,41.9584L 39.9791,41.9583L 41.9583,25.7292L 34.0417,25.7292 Z M 38,44.3333C 36.2511,44.3333 34.8333,45.7511 34.8333,47.5C 34.8333,49.2489 36.2511,50.6667 38,50.6667C 39.7489,50.6667 41.1666,49.2489 41.1666,47.5C 41.1666,45.7511 39.7489,44.3333 38,44.3333 Z");

growlNotifications.AddNotification(new Notification { Title = "Mesage #3", IconData = icon, Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
}

private void ButtonClick3(object sender, RoutedEventArgs e)
{
growlNotifications.AddNotification(new Notification { Title = "Mesage #4", ImageUrl = "pack://application:,,,/Resources/Radiation_warning_symbol.png", Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
var icon = PathGeometry.Parse("F1 M 32.6227,68.9728C 33.1208,70.2446 33.7077,71.4719 34.3757,72.6471C 35.567,72.7702 36.7761,72.8333 38,72.8333C 40.6447,72.8333 43.2205,72.5386 45.6965,71.9802C 42.2807,68.5449 40.1698,63.8107 40.1698,58.5835C 40.1698,48.0901 48.6764,39.5835 59.1698,39.5835C 64.2047,39.5835 68.7822,41.5419 72.182,44.7385C 72.6094,42.5584 72.8333,40.3053 72.8333,38C 72.8333,36.442 72.731,34.908 72.5328,33.4041C 70.4772,32.3109 68.2718,31.4621 65.9554,30.8963L 65.6219,22.7367C 63.5664,22.3692 61.4511,22.1741 59.2916,22.1671L 57.491,30.1322C 54.2845,30.3184 51.2204,31.0348 48.3848,32.1949L 43.318,25.7887C 41.3995,26.7177 39.5749,27.8102 37.8622,29.0479L 41.0883,36.5527C 38.6742,38.5364 36.5919,40.9091 34.9373,43.575L 27.0703,41.3697C 26.073,43.2256 25.2319,45.178 24.5646,47.2093L 31.5867,51.385C 30.9883,53.6844 30.6698,56.0968 30.6698,58.5835L 30.746,60.6839L 23.0854,63.5239C 23.3743,65.6539 23.8474,67.7255 24.4881,69.7219L 32.6227,68.9728 Z M 27.0669,37.1755L 34.9338,39.3807C 35.9312,37.5248 36.7723,35.5724 37.4395,33.5412L 30.4175,29.3654C 31.0159,27.066 31.3344,24.6537 31.3344,22.1669L 31.2581,20.0665L 38.9187,17.2265C 38.6299,15.0965 38.1568,13.0249 37.5161,11.0285L 29.3815,11.7776C 28.4787,9.47258 27.2844,7.31377 25.8439,5.34655C 22.7943,6.48232 19.9467,8.03307 17.3698,9.93015C 20.1557,13.2359 21.8344,17.5054 21.8344,22.1669C 21.8344,32.5019 13.5826,40.9096 3.30816,41.1611C 3.60321,44.4411 4.35293,47.59 5.49381,50.5444C 8.34489,50.2806 11.0742,49.5968 13.6194,48.5555L 18.6861,54.9617C 20.6046,54.0327 22.4293,52.9403 24.142,51.7025L 20.9158,44.1977C 23.3299,42.2141 25.4123,39.8414 27.0669,37.1755 Z ");

growlNotifications.AddNotification(new Notification { Title = "Mesage #4", IconData = icon, Message = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." });
}

protected override void OnClosed(System.EventArgs e)
Expand Down
14 changes: 7 additions & 7 deletions WPFGrowlNotification/Notification.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Media;

namespace WPFGrowlNotification
{
Expand Down Expand Up @@ -31,16 +32,15 @@ public int Id
}
}

private string imageUrl;
public string ImageUrl
private Geometry iconData;
public Geometry IconData
{
get { return imageUrl; }

get { return iconData; }
set
{
if (imageUrl == value) return;
imageUrl = value;
OnPropertyChanged("ImageUrl");
if (iconData == value) return;
iconData = value;
OnPropertyChanged("IconData");
}
}

Expand Down
9 changes: 5 additions & 4 deletions WPFGrowlNotification/Resources/ButtonStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@
<DropShadowEffect ShadowDepth="0" Opacity=".4" BlurRadius="5" Color="Black"/>
</Border.Effect>
<Grid>
<Image Source="pack://application:,,,/Resources/close.png" IsHitTestVisible="False" Margin="2">
<Image.Effect>
<Canvas Width="12" Height="12" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Canvas.Effect>
<DropShadowEffect Direction="90" ShadowDepth="1" BlurRadius="1"/>
</Image.Effect>
</Image>
</Canvas.Effect>
<Path Width="12" Height="12" Stretch="Fill" Fill="#FFFFFF" Data="{StaticResource CloseIconData}"/>
</Canvas>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/>
</Grid>
</Border>
Expand Down
8 changes: 8 additions & 0 deletions WPFGrowlNotification/Resources/IconData.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- More Icons Available: http://www.modernuiicons.com -->
<PathGeometry x:Key="CloseIconData">F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z</PathGeometry>
<PathGeometry x:Key="WarningIconData">F1 M 58.5832,55.4172L 17.4169,55.4171C 15.5619,53.5621 15.5619,50.5546 17.4168,48.6996L 35.201,15.8402C 37.056,13.9852 40.0635,13.9852 41.9185,15.8402L 58.5832,48.6997C 60.4382,50.5546 60.4382,53.5622 58.5832,55.4172 Z M 34.0417,25.7292L 36.0208,41.9584L 39.9791,41.9583L 41.9583,25.7292L 34.0417,25.7292 Z M 38,44.3333C 36.2511,44.3333 34.8333,45.7511 34.8333,47.5C 34.8333,49.2489 36.2511,50.6667 38,50.6667C 39.7489,50.6667 41.1666,49.2489 41.1666,47.5C 41.1666,45.7511 39.7489,44.3333 38,44.3333 Z</PathGeometry>
<PathGeometry x:Key="ErrorIconData">F1 M 31.6667,19L 44.3333,19L 57,31.6667L 57,44.3333L 44.3333,57L 31.6667,57L 19,44.3333L 19,31.6667L 31.6667,19 Z M 26.4762,45.0454L 30.9546,49.5238L 38,42.4783L 45.0454,49.5238L 49.5237,45.0454L 42.4783,38L 49.5238,30.9546L 45.0454,26.4763L 38,33.5217L 30.9546,26.4762L 26.4762,30.9546L 33.5217,38L 26.4762,45.0454 Z</PathGeometry>
<PathGeometry x:Key="CogsIconData">F1 M 32.6227,68.9728C 33.1208,70.2446 33.7077,71.4719 34.3757,72.6471C 35.567,72.7702 36.7761,72.8333 38,72.8333C 40.6447,72.8333 43.2205,72.5386 45.6965,71.9802C 42.2807,68.5449 40.1698,63.8107 40.1698,58.5835C 40.1698,48.0901 48.6764,39.5835 59.1698,39.5835C 64.2047,39.5835 68.7822,41.5419 72.182,44.7385C 72.6094,42.5584 72.8333,40.3053 72.8333,38C 72.8333,36.442 72.731,34.908 72.5328,33.4041C 70.4772,32.3109 68.2718,31.4621 65.9554,30.8963L 65.6219,22.7367C 63.5664,22.3692 61.4511,22.1741 59.2916,22.1671L 57.491,30.1322C 54.2845,30.3184 51.2204,31.0348 48.3848,32.1949L 43.318,25.7887C 41.3995,26.7177 39.5749,27.8102 37.8622,29.0479L 41.0883,36.5527C 38.6742,38.5364 36.5919,40.9091 34.9373,43.575L 27.0703,41.3697C 26.073,43.2256 25.2319,45.178 24.5646,47.2093L 31.5867,51.385C 30.9883,53.6844 30.6698,56.0968 30.6698,58.5835L 30.746,60.6839L 23.0854,63.5239C 23.3743,65.6539 23.8474,67.7255 24.4881,69.7219L 32.6227,68.9728 Z M 27.0669,37.1755L 34.9338,39.3807C 35.9312,37.5248 36.7723,35.5724 37.4395,33.5412L 30.4175,29.3654C 31.0159,27.066 31.3344,24.6537 31.3344,22.1669L 31.2581,20.0665L 38.9187,17.2265C 38.6299,15.0965 38.1568,13.0249 37.5161,11.0285L 29.3815,11.7776C 28.4787,9.47258 27.2844,7.31377 25.8439,5.34655C 22.7943,6.48232 19.9467,8.03307 17.3698,9.93015C 20.1557,13.2359 21.8344,17.5054 21.8344,22.1669C 21.8344,32.5019 13.5826,40.9096 3.30816,41.1611C 3.60321,44.4411 4.35293,47.59 5.49381,50.5444C 8.34489,50.2806 11.0742,49.5968 13.6194,48.5555L 18.6861,54.9617C 20.6046,54.0327 22.4293,52.9403 24.142,51.7025L 20.9158,44.1977C 23.3299,42.2141 25.4123,39.8414 27.0669,37.1755 Z</PathGeometry>
</ResourceDictionary>
Binary file not shown.
Binary file removed WPFGrowlNotification/Resources/close.png
Binary file not shown.
Binary file removed WPFGrowlNotification/Resources/facebook-button.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 7 additions & 12 deletions WPFGrowlNotification/WPFGrowlNotification.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</DesignData>
<Page Include="GrowlNotifiactions.xaml">
<Page Include="GrowlNotifications.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand All @@ -65,8 +65,8 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="GrowlNotifiactions.xaml.cs">
<DependentUpon>GrowlNotifiactions.xaml</DependentUpon>
<Compile Include="GrowlNotifications.xaml.cs">
<DependentUpon>GrowlNotifications.xaml</DependentUpon>
</Compile>
<Compile Include="Notification.cs" />
<Compile Include="MainWindow.xaml.cs">
Expand All @@ -77,6 +77,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\IconData.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
Expand All @@ -102,15 +106,6 @@
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\facebook-button.png" />
<Resource Include="Resources\microsoft-windows-8-logo.png" />
<Resource Include="Resources\notification-icon.png" />
<Resource Include="Resources\Radiation_warning_symbol.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\close.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down