<Compile Include="SelectiveSynch\SelectiveSynchViewModel.cs" />
<Compile Include="SelectiveSynch\VirtualToggleButton.cs" />
<Compile Include="Services\Events.cs" />
+ <Compile Include="Shell\PithosBalloon.xaml.cs">
+ <DependentUpon>PithosBalloon.xaml</DependentUpon>
+ </Compile>
<Compile Include="Shell\ShellViewModel.cs" />
<Compile Include="Services\StatusService.cs" />
<Compile Include="Wpf32Window.cs" />
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Shell\PithosBalloon.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Shell\ShellView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Resource Include="Images\About.ico" />
<Resource Include="Images\Feedback.ico" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\Close.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\info.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.
--- /dev/null
+<UserControl x:Class="Pithos.Client.WPF.Shell.PithosBalloon"\r
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" \r
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" \r
+ 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
+ <UserControl.Resources>\r
+ <Storyboard x:Key="FadeIn">\r
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>\r
+ <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.95"/>\r
+ <SplineDoubleKeyFrame KeyTime="00:00:03" Value="0.95"/>\r
+ <!-- <SplineDoubleKeyFrame KeyTime="00:00:05" Value="0"/>-->\r
+ </DoubleAnimationUsingKeyFrames>\r
+ </Storyboard>\r
+ <Storyboard x:Key="HighlightCloseButton">\r
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)">\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.4"/>\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>\r
+ </DoubleAnimationUsingKeyFrames>\r
+ </Storyboard>\r
+ <Storyboard x:Key="FadeCloseButton">\r
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)">\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.4"/>\r
+ </DoubleAnimationUsingKeyFrames>\r
+ </Storyboard>\r
+ <Storyboard x:Key="FadeBack">\r
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>\r
+ </DoubleAnimationUsingKeyFrames>\r
+ </Storyboard>\r
+ <Storyboard x:Key="FadeOut" Completed="OnFadeOutCompleted" >\r
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>\r
+ <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.2"/>\r
+ </DoubleAnimationUsingKeyFrames>\r
+ </Storyboard>\r
+ </UserControl.Resources>\r
+ <UserControl.Triggers>\r
+ <EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonShowing">\r
+ <BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>\r
+ </EventTrigger>\r
+ <EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="imgClose">\r
+ <BeginStoryboard Storyboard="{StaticResource HighlightCloseButton}" x:Name="HighlightCloseButton_BeginStoryboard"/>\r
+ </EventTrigger>\r
+ <EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="imgClose">\r
+ <BeginStoryboard Storyboard="{StaticResource FadeCloseButton}" x:Name="FadeCloseButton_BeginStoryboard"/>\r
+ </EventTrigger>\r
+ <EventTrigger RoutedEvent="Mouse.MouseEnter">\r
+ <StopStoryboard BeginStoryboardName="FadeIn_BeginStoryboard"/>\r
+ <BeginStoryboard x:Name="FadeBack_BeginStoryboard1" Storyboard="{StaticResource FadeBack}"/>\r
+ </EventTrigger>\r
+ <EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonClosing">\r
+ <BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>\r
+ </EventTrigger>\r
+ </UserControl.Triggers>\r
+ <Grid>\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
+ EndPoint="0.5,1"\r
+ StartPoint="0.5,0">\r
+ <GradientStop\r
+ Color="#4085A5"\r
+ Offset="0" />\r
+ <GradientStop\r
+ Color="#D7E8F0"\r
+ Offset="1" />\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
+ 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
+ Fill="#FFFFFFFF"\r
+ Stretch="Fill"\r
+ Margin="72,38.2,34,0"\r
+ VerticalAlignment="Top"\r
+ Height="1"\r
+ Data="M26,107 L220.04123,107" SnapsToDevicePixels="True">\r
+ <Path.Stroke>\r
+ <LinearGradientBrush\r
+ EndPoint="0.973,0.5"\r
+ StartPoint="0.005,0.5">\r
+ <GradientStop\r
+ Color="#00ECAD25"\r
+ Offset="1" />\r
+ <GradientStop\r
+ Color="#87ECAD25"\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
+ </Grid>\r
+</UserControl>\r
--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+using System.Windows;\r
+using System.Windows.Controls;\r
+using System.Windows.Controls.Primitives;\r
+using System.Windows.Data;\r
+using System.Windows.Documents;\r
+using System.Windows.Input;\r
+using System.Windows.Media;\r
+using System.Windows.Media.Imaging;\r
+using System.Windows.Navigation;\r
+using System.Windows.Shapes;\r
+using Hardcodet.Wpf.TaskbarNotification;\r
+\r
+namespace Pithos.Client.WPF.Shell\r
+{\r
+ /// <summary>\r
+ /// Interaction logic for PithosBalloon.xaml\r
+ /// </summary>\r
+ public partial class PithosBalloon : UserControl\r
+ {\r
+ private bool isClosing = false;\r
+ \r
+ #region BalloonText dependency property\r
+ \r
+ /// <summary>\r
+ /// Description\r
+ /// </summary>\r
+ public static readonly DependencyProperty BalloonTextProperty =\r
+ DependencyProperty.Register("BalloonText",\r
+ typeof (string),\r
+ typeof (PithosBalloon),\r
+ new FrameworkPropertyMetadata(""));\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
+ {\r
+ get { return (string) GetValue(BalloonTextProperty); }\r
+ set { SetValue(BalloonTextProperty, value); }\r
+ }\r
+ \r
+ #endregion\r
+\r
+\r
+ public PithosBalloon()\r
+ {\r
+ InitializeComponent();\r
+ TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing);\r
+ }\r
+ \r
+ \r
+ /// <summary>\r
+ /// By subscribing to the <see cref="TaskbarIcon.BalloonClosingEvent"/>\r
+ /// and setting the "Handled" property to true, we suppress the popup\r
+ /// from being closed in order to display the fade-out animation.\r
+ /// </summary>\r
+ private void OnBalloonClosing(object sender, RoutedEventArgs e)\r
+ {\r
+ e.Handled = true;\r
+ isClosing = true;\r
+ }\r
+ \r
+ \r
+ /// <summary>\r
+ /// Resolves the <see cref="TaskbarIcon"/> that displayed\r
+ /// the balloon and requests a close action.\r
+ /// </summary>\r
+ private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)\r
+ {\r
+ //the tray icon assigned this attached property to simplify access\r
+ TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);\r
+ taskbarIcon.CloseBalloon();\r
+ }\r
+ \r
+ /// <summary>\r
+ /// If the users hovers over the balloon, we don't close it.\r
+ /// </summary>\r
+ private void grid_MouseEnter(object sender, MouseEventArgs e)\r
+ {\r
+ //if we're already running the fade-out animation, do not interrupt anymore\r
+ //(makes things too complicated for the sample)\r
+ if (isClosing) return;\r
+ \r
+ //the tray icon assigned this attached property to simplify access\r
+ TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);\r
+ taskbarIcon.ResetBalloonCloseTimer();\r
+ }\r
+ \r
+ \r
+ /// <summary>\r
+ /// Closes the popup once the fade-out animation completed.\r
+ /// The animation was triggered in XAML through the attached\r
+ /// BalloonClosing event.\r
+ /// </summary>\r
+ private void OnFadeOutCompleted(object sender, EventArgs e)\r
+ {\r
+ Popup pp = (Popup)Parent;\r
+ pp.IsOpen = false;\r
+ }\r
+ }\r
+}\r
using System.ServiceModel;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Controls.Primitives;
using Caliburn.Micro;
using Hardcodet.Wpf.TaskbarNotification;
using Pithos.Client.WPF.Configuration;
if (Settings.ShowDesktopNotifications)
{
var tv = (ShellView) GetView();
- tv.TaskbarView.ShowBalloonTip(notification.Title, notification.Message, icon);
+ var balloon=new PithosBalloon{BalloonText=notification.Message};
+ tv.TaskbarView.ShowCustomBalloon(balloon,PopupAnimation.Fade,4000);
+// tv.TaskbarView.ShowBalloonTip(notification.Title, notification.Message, icon);
}
}
#endregion