Replaced box icons with Pithos icons
authorPanagiotis Kanavos <pkanavos@gmail.com>
Fri, 3 Feb 2012 19:13:39 +0000 (21:13 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Fri, 3 Feb 2012 19:22:30 +0000 (21:22 +0200)
Also replaced standard balloon with custom balloon
Closes #1623

trunk/Pithos.Client.WPF/Images/info.png
trunk/Pithos.Client.WPF/Pithos.Client.WPF.csproj
trunk/Pithos.Client.WPF/Shell/PithosBalloon.xaml
trunk/Pithos.Client.WPF/Shell/PithosBalloon.xaml.cs
trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs

index 993ba1c..1d7535c 100644 (file)
Binary files a/trunk/Pithos.Client.WPF/Images/info.png and b/trunk/Pithos.Client.WPF/Images/info.png differ
index 9ac0084..6a2167c 100644 (file)
     <Compile Include="FileProperties\SizeExtensions.cs" />
     <Compile Include="FileProperties\MetaValue.cs" />
     <Compile Include="Shell\AboutViewModel.cs" />
+    <Compile Include="Shell\BalloonIconConverter.cs" />
     <Compile Include="Shell\FeedbackView.xaml.cs">
       <DependentUpon>FeedbackView.xaml</DependentUpon>
     </Compile>
   <ItemGroup>
     <Resource Include="Images\info.png" />
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Images\Error.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Images\Warning.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.
index 5a54275..50dacf7 100644 (file)
@@ -6,8 +6,8 @@
              mc:Ignorable="d" \r
              xmlns:tb="http://www.hardcodet.net/taskbar"\r
              d:DesignHeight="120" d:DesignWidth="240"\r
-             Height="120"\r
-             Width="240">\r
+             Height="90"\r
+             Width="240" xmlns:my="clr-namespace:Pithos.Client.WPF.Shell">\r
     <UserControl.Resources>\r
         <Storyboard x:Key="FadeIn">\r
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">\r
@@ -41,6 +41,7 @@
                 <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.2"/>\r
             </DoubleAnimationUsingKeyFrames>\r
         </Storyboard>\r
+        <my:BalloonIconConverter x:Key="BalloonConverter" />\r
     </UserControl.Resources>\r
     <UserControl.Triggers>\r
         <EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonShowing">\r
             <BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>\r
         </EventTrigger>\r
     </UserControl.Triggers>\r
-    <Grid>\r
+    <Grid x:Name="grid" MouseEnter="grid_MouseEnter">\r
         <Border\r
         HorizontalAlignment="Stretch"\r
         Margin="5,5,5,5"\r
         BorderThickness="1,1,1,1"\r
-        BorderBrush="#FF997137">\r
-         <Border.Effect>\r
-             <DropShadowEffect Color="#FF747474"/>\r
-         </Border.Effect>\r
-         <Border.Background>\r
-             <LinearGradientBrush\r
+        BorderBrush="#FF379991">\r
+            <Border.Effect>\r
+                <DropShadowEffect Color="#FF747474"/>\r
+            </Border.Effect>\r
+            <Border.Background>\r
+                <LinearGradientBrush\r
             EndPoint="0.5,1"\r
             StartPoint="0.5,0">\r
-                 <GradientStop\r
+                    <GradientStop\r
               Color="#4085A5"\r
               Offset="0" />\r
-                 <GradientStop\r
+                    <GradientStop\r
               Color="#D7E8F0"\r
               Offset="1" />\r
-             </LinearGradientBrush>\r
-         </Border.Background>\r
-     </Border>\r
- <Image\r
+                </LinearGradientBrush>\r
+            </Border.Background>\r
+        </Border>\r
+        <Image\r
     HorizontalAlignment="Left"\r
-    Margin="0,10,0,0"\r
-    Width="48"\r
-    Source="/Images/PithosTaskbar.png"\r
-    Stretch="None" Height="72" VerticalAlignment="Top" />\r
- <TextBlock\r
-    Margin="72,49.2,10,0"\r
+    Margin="10,17,0,0"\r
+    Width="48"    \r
+    Stretch="None" Height="72" VerticalAlignment="Top" \r
+            Source="/Images/Info.png"/>\r
+        \r
+        <TextBlock\r
+    Margin="72,41,10,0"\r
     VerticalAlignment="Top"\r
     Foreground="Black"\r
-    TextWrapping="Wrap"><Run Text="This is a user control. The animation uses the attached " Language="de-ch"/><Run FontStyle="Italic" FontWeight="Bold" Text="BalloonShowing " Language="de-ch"/><Run Text="event." Language="de-ch"/></TextBlock>\r
-    \r
-    <Path\r
+    TextWrapping="Wrap" Text="{Binding Message,FallbackValue='This is the message text'}" Height="36">\r
+        </TextBlock>\r
+\r
+        <Path\r
        Fill="#FFFFFFFF"\r
        Stretch="Fill"\r
-       Margin="72,38.2,34,0"\r
+       Margin="72,34,34,0"\r
        VerticalAlignment="Top"\r
        Height="1"\r
        Data="M26,107 L220.04123,107" SnapsToDevicePixels="True">\r
-        <Path.Stroke>\r
-           <LinearGradientBrush\r
+            <Path.Stroke>\r
+                <LinearGradientBrush\r
           EndPoint="0.973,0.5"\r
           StartPoint="0.005,0.5">\r
-               <GradientStop\r
-            Color="#00ECAD25"\r
+                    <GradientStop\r
+            Color="#0025ECDD"\r
             Offset="1" />\r
-               <GradientStop\r
-            Color="#87ECAD25"\r
+                    <GradientStop\r
+            Color="#8725ECDD"\r
          Offset="0" />\r
                 </LinearGradientBrush>\r
             </Path.Stroke>\r
         </Path>\r
-        <TextBlock Margin="72,10,10,0" VerticalAlignment="Top" Height="23.2" Text="{Binding Path=BalloonText, ElementName=me, Mode=Default}" TextWrapping="Wrap" Foreground="#FFECAD25" FontWeight="Bold"/>\r
-        <Image HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top" Width="16" Height="16" Source="/Images/Close.png" Stretch="Fill" Opacity="0.4" ToolTip="Close Balloon" x:Name="imgClose" MouseDown="imgClose_MouseDown"/>\r
+        <TextBlock Margin="72,10,10,0" VerticalAlignment="Top" Height="23.2" Text="{Binding Path=Title, FallbackValue='Pithos'}" TextWrapping="Wrap" Foreground="White" FontWeight="Bold"/>\r
+        <Image HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top" Width="16" Height="16" Source="/Images/Close.png" Stretch="Fill" Opacity="0.7" ToolTip="Close Balloon" x:Name="imgClose" MouseDown="imgClose_MouseDown"/>\r
     </Grid>\r
 </UserControl>\r
index c54623f..89c08d9 100644 (file)
@@ -23,34 +23,53 @@ namespace Pithos.Client.WPF.Shell
     {\r
         private bool isClosing = false;\r
   \r
-      #region BalloonText dependency property\r
+      #region Message dependency property\r
   \r
-      /// <summary>\r
-      /// Description\r
-      /// </summary>\r
-      public static readonly DependencyProperty BalloonTextProperty =\r
-          DependencyProperty.Register("BalloonText",\r
+      public static readonly DependencyProperty MessageProperty =\r
+          DependencyProperty.Register("Message",\r
+                                      typeof (string),\r
+                                      typeof (PithosBalloon),\r
+                                      new FrameworkPropertyMetadata(""));\r
+      public static readonly DependencyProperty TitleProperty =\r
+          DependencyProperty.Register("Title",\r
                                       typeof (string),\r
                                       typeof (PithosBalloon),\r
                                       new FrameworkPropertyMetadata(""));\r
+      public static readonly DependencyProperty IconProperty =\r
+          DependencyProperty.Register("Icon",\r
+                                      typeof (BalloonIcon),\r
+                                      typeof (PithosBalloon),\r
+                                      new FrameworkPropertyMetadata(BalloonIcon.None));\r
   \r
-      /// <summary>\r
-      /// A property wrapper for the <see cref="BalloonTextProperty"/>\r
-      /// dependency property:<br/>\r
-      /// Description\r
-      /// </summary>\r
-      public string BalloonText\r
+      public string Message\r
       {\r
-        get { return (string) GetValue(BalloonTextProperty); }\r
-        set { SetValue(BalloonTextProperty, value); }\r
+        get { return (string) GetValue(MessageProperty); }\r
+        set { SetValue(MessageProperty, value); }\r
+      }\r
+\r
+      public BalloonIcon Icon\r
+      {\r
+        get { return (BalloonIcon) GetValue(IconProperty); }\r
+        set { \r
+            SetValue(IconProperty, value);            \r
+        }\r
+      }\r
+\r
+        public string Title\r
+      {\r
+        get { return (string) GetValue(TitleProperty); }\r
+        set { SetValue(TitleProperty, value); }\r
       }\r
   \r
+\r
+       \r
       #endregion\r
 \r
 \r
       public PithosBalloon()\r
       {\r
         InitializeComponent();\r
+          this.DataContext = this;\r
         TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing);\r
       }\r
   \r
index 2143dc6..1660224 100644 (file)
@@ -779,6 +779,9 @@ namespace Pithos.Client.WPF {
                 notification.Message = "Start Synchronisation";
             }
 
+            if (String.IsNullOrWhiteSpace(notification.Message) && String.IsNullOrWhiteSpace(notification.Title))
+                return;
+
                        BalloonIcon icon;
                        switch (notification.Level)
                        {
@@ -800,7 +803,7 @@ namespace Pithos.Client.WPF {
                        if (Settings.ShowDesktopNotifications)
                        {
                                var tv = (ShellView) GetView();                
-                var balloon=new PithosBalloon{BalloonText=notification.Message};
+                var balloon=new PithosBalloon{Title=notification.Title,Message=notification.Message,Icon=icon};
                 tv.TaskbarView.ShowCustomBalloon(balloon,PopupAnimation.Fade,4000);
 //                             tv.TaskbarView.ShowBalloonTip(notification.Title, notification.Message, icon);
                        }