Revision fb9d6e00
b/trunk/Pithos.Client.WPF/Pithos.Client.WPF.csproj | ||
---|---|---|
300 | 300 |
<Compile Include="SelectiveSynch\SelectiveSynchViewModel.cs" /> |
301 | 301 |
<Compile Include="SelectiveSynch\VirtualToggleButton.cs" /> |
302 | 302 |
<Compile Include="Services\Events.cs" /> |
303 |
<Compile Include="Shell\PithosBalloon.xaml.cs"> |
|
304 |
<DependentUpon>PithosBalloon.xaml</DependentUpon> |
|
305 |
</Compile> |
|
303 | 306 |
<Compile Include="Shell\ShellViewModel.cs" /> |
304 | 307 |
<Compile Include="Services\StatusService.cs" /> |
305 | 308 |
<Compile Include="Wpf32Window.cs" /> |
... | ... | |
365 | 368 |
<SubType>Designer</SubType> |
366 | 369 |
<Generator>MSBuild:Compile</Generator> |
367 | 370 |
</Page> |
371 |
<Page Include="Shell\PithosBalloon.xaml"> |
|
372 |
<SubType>Designer</SubType> |
|
373 |
<Generator>MSBuild:Compile</Generator> |
|
374 |
</Page> |
|
368 | 375 |
<Page Include="Shell\ShellView.xaml"> |
369 | 376 |
<Generator>MSBuild:Compile</Generator> |
370 | 377 |
<SubType>Designer</SubType> |
... | ... | |
464 | 471 |
<Resource Include="Images\About.ico" /> |
465 | 472 |
<Resource Include="Images\Feedback.ico" /> |
466 | 473 |
</ItemGroup> |
474 |
<ItemGroup> |
|
475 |
<Resource Include="Images\Close.png" /> |
|
476 |
</ItemGroup> |
|
477 |
<ItemGroup> |
|
478 |
<Resource Include="Images\info.png" /> |
|
479 |
</ItemGroup> |
|
467 | 480 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
468 | 481 |
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
469 | 482 |
Other similar extension points exist, see Microsoft.Common.targets. |
b/trunk/Pithos.Client.WPF/Shell/PithosBalloon.xaml | ||
---|---|---|
1 |
<UserControl x:Class="Pithos.Client.WPF.Shell.PithosBalloon" |
|
2 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
4 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
5 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
6 |
mc:Ignorable="d" |
|
7 |
xmlns:tb="http://www.hardcodet.net/taskbar" |
|
8 |
d:DesignHeight="120" d:DesignWidth="240" |
|
9 |
Height="120" |
|
10 |
Width="240"> |
|
11 |
<UserControl.Resources> |
|
12 |
<Storyboard x:Key="FadeIn"> |
|
13 |
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)"> |
|
14 |
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> |
|
15 |
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.95"/> |
|
16 |
<SplineDoubleKeyFrame KeyTime="00:00:03" Value="0.95"/> |
|
17 |
<!-- <SplineDoubleKeyFrame KeyTime="00:00:05" Value="0"/>--> |
|
18 |
</DoubleAnimationUsingKeyFrames> |
|
19 |
</Storyboard> |
|
20 |
<Storyboard x:Key="HighlightCloseButton"> |
|
21 |
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)"> |
|
22 |
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.4"/> |
|
23 |
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> |
|
24 |
</DoubleAnimationUsingKeyFrames> |
|
25 |
</Storyboard> |
|
26 |
<Storyboard x:Key="FadeCloseButton"> |
|
27 |
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)"> |
|
28 |
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> |
|
29 |
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.4"/> |
|
30 |
</DoubleAnimationUsingKeyFrames> |
|
31 |
</Storyboard> |
|
32 |
<Storyboard x:Key="FadeBack"> |
|
33 |
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)"> |
|
34 |
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> |
|
35 |
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> |
|
36 |
</DoubleAnimationUsingKeyFrames> |
|
37 |
</Storyboard> |
|
38 |
<Storyboard x:Key="FadeOut" Completed="OnFadeOutCompleted" > |
|
39 |
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)"> |
|
40 |
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> |
|
41 |
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.2"/> |
|
42 |
</DoubleAnimationUsingKeyFrames> |
|
43 |
</Storyboard> |
|
44 |
</UserControl.Resources> |
|
45 |
<UserControl.Triggers> |
|
46 |
<EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonShowing"> |
|
47 |
<BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/> |
|
48 |
</EventTrigger> |
|
49 |
<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="imgClose"> |
|
50 |
<BeginStoryboard Storyboard="{StaticResource HighlightCloseButton}" x:Name="HighlightCloseButton_BeginStoryboard"/> |
|
51 |
</EventTrigger> |
|
52 |
<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="imgClose"> |
|
53 |
<BeginStoryboard Storyboard="{StaticResource FadeCloseButton}" x:Name="FadeCloseButton_BeginStoryboard"/> |
|
54 |
</EventTrigger> |
|
55 |
<EventTrigger RoutedEvent="Mouse.MouseEnter"> |
|
56 |
<StopStoryboard BeginStoryboardName="FadeIn_BeginStoryboard"/> |
|
57 |
<BeginStoryboard x:Name="FadeBack_BeginStoryboard1" Storyboard="{StaticResource FadeBack}"/> |
|
58 |
</EventTrigger> |
|
59 |
<EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonClosing"> |
|
60 |
<BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/> |
|
61 |
</EventTrigger> |
|
62 |
</UserControl.Triggers> |
|
63 |
<Grid> |
|
64 |
<Border |
|
65 |
HorizontalAlignment="Stretch" |
|
66 |
Margin="5,5,5,5" |
|
67 |
BorderThickness="1,1,1,1" |
|
68 |
BorderBrush="#FF997137"> |
|
69 |
<Border.Effect> |
|
70 |
<DropShadowEffect Color="#FF747474"/> |
|
71 |
</Border.Effect> |
|
72 |
<Border.Background> |
|
73 |
<LinearGradientBrush |
|
74 |
EndPoint="0.5,1" |
|
75 |
StartPoint="0.5,0"> |
|
76 |
<GradientStop |
|
77 |
Color="#4085A5" |
|
78 |
Offset="0" /> |
|
79 |
<GradientStop |
|
80 |
Color="#D7E8F0" |
|
81 |
Offset="1" /> |
|
82 |
</LinearGradientBrush> |
|
83 |
</Border.Background> |
|
84 |
</Border> |
|
85 |
<Image |
|
86 |
HorizontalAlignment="Left" |
|
87 |
Margin="0,10,0,0" |
|
88 |
Width="48" |
|
89 |
Source="/Images/PithosTaskbar.png" |
|
90 |
Stretch="None" Height="72" VerticalAlignment="Top" /> |
|
91 |
<TextBlock |
|
92 |
Margin="72,49.2,10,0" |
|
93 |
VerticalAlignment="Top" |
|
94 |
Foreground="Black" |
|
95 |
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> |
|
96 |
|
|
97 |
<Path |
|
98 |
Fill="#FFFFFFFF" |
|
99 |
Stretch="Fill" |
|
100 |
Margin="72,38.2,34,0" |
|
101 |
VerticalAlignment="Top" |
|
102 |
Height="1" |
|
103 |
Data="M26,107 L220.04123,107" SnapsToDevicePixels="True"> |
|
104 |
<Path.Stroke> |
|
105 |
<LinearGradientBrush |
|
106 |
EndPoint="0.973,0.5" |
|
107 |
StartPoint="0.005,0.5"> |
|
108 |
<GradientStop |
|
109 |
Color="#00ECAD25" |
|
110 |
Offset="1" /> |
|
111 |
<GradientStop |
|
112 |
Color="#87ECAD25" |
|
113 |
Offset="0" /> |
|
114 |
</LinearGradientBrush> |
|
115 |
</Path.Stroke> |
|
116 |
</Path> |
|
117 |
<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"/> |
|
118 |
<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"/> |
|
119 |
</Grid> |
|
120 |
</UserControl> |
b/trunk/Pithos.Client.WPF/Shell/PithosBalloon.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Windows; |
|
6 |
using System.Windows.Controls; |
|
7 |
using System.Windows.Controls.Primitives; |
|
8 |
using System.Windows.Data; |
|
9 |
using System.Windows.Documents; |
|
10 |
using System.Windows.Input; |
|
11 |
using System.Windows.Media; |
|
12 |
using System.Windows.Media.Imaging; |
|
13 |
using System.Windows.Navigation; |
|
14 |
using System.Windows.Shapes; |
|
15 |
using Hardcodet.Wpf.TaskbarNotification; |
|
16 |
|
|
17 |
namespace Pithos.Client.WPF.Shell |
|
18 |
{ |
|
19 |
/// <summary> |
|
20 |
/// Interaction logic for PithosBalloon.xaml |
|
21 |
/// </summary> |
|
22 |
public partial class PithosBalloon : UserControl |
|
23 |
{ |
|
24 |
private bool isClosing = false; |
|
25 |
|
|
26 |
#region BalloonText dependency property |
|
27 |
|
|
28 |
/// <summary> |
|
29 |
/// Description |
|
30 |
/// </summary> |
|
31 |
public static readonly DependencyProperty BalloonTextProperty = |
|
32 |
DependencyProperty.Register("BalloonText", |
|
33 |
typeof (string), |
|
34 |
typeof (PithosBalloon), |
|
35 |
new FrameworkPropertyMetadata("")); |
|
36 |
|
|
37 |
/// <summary> |
|
38 |
/// A property wrapper for the <see cref="BalloonTextProperty"/> |
|
39 |
/// dependency property:<br/> |
|
40 |
/// Description |
|
41 |
/// </summary> |
|
42 |
public string BalloonText |
|
43 |
{ |
|
44 |
get { return (string) GetValue(BalloonTextProperty); } |
|
45 |
set { SetValue(BalloonTextProperty, value); } |
|
46 |
} |
|
47 |
|
|
48 |
#endregion |
|
49 |
|
|
50 |
|
|
51 |
public PithosBalloon() |
|
52 |
{ |
|
53 |
InitializeComponent(); |
|
54 |
TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing); |
|
55 |
} |
|
56 |
|
|
57 |
|
|
58 |
/// <summary> |
|
59 |
/// By subscribing to the <see cref="TaskbarIcon.BalloonClosingEvent"/> |
|
60 |
/// and setting the "Handled" property to true, we suppress the popup |
|
61 |
/// from being closed in order to display the fade-out animation. |
|
62 |
/// </summary> |
|
63 |
private void OnBalloonClosing(object sender, RoutedEventArgs e) |
|
64 |
{ |
|
65 |
e.Handled = true; |
|
66 |
isClosing = true; |
|
67 |
} |
|
68 |
|
|
69 |
|
|
70 |
/// <summary> |
|
71 |
/// Resolves the <see cref="TaskbarIcon"/> that displayed |
|
72 |
/// the balloon and requests a close action. |
|
73 |
/// </summary> |
|
74 |
private void imgClose_MouseDown(object sender, MouseButtonEventArgs e) |
|
75 |
{ |
|
76 |
//the tray icon assigned this attached property to simplify access |
|
77 |
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); |
|
78 |
taskbarIcon.CloseBalloon(); |
|
79 |
} |
|
80 |
|
|
81 |
/// <summary> |
|
82 |
/// If the users hovers over the balloon, we don't close it. |
|
83 |
/// </summary> |
|
84 |
private void grid_MouseEnter(object sender, MouseEventArgs e) |
|
85 |
{ |
|
86 |
//if we're already running the fade-out animation, do not interrupt anymore |
|
87 |
//(makes things too complicated for the sample) |
|
88 |
if (isClosing) return; |
|
89 |
|
|
90 |
//the tray icon assigned this attached property to simplify access |
|
91 |
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); |
|
92 |
taskbarIcon.ResetBalloonCloseTimer(); |
|
93 |
} |
|
94 |
|
|
95 |
|
|
96 |
/// <summary> |
|
97 |
/// Closes the popup once the fade-out animation completed. |
|
98 |
/// The animation was triggered in XAML through the attached |
|
99 |
/// BalloonClosing event. |
|
100 |
/// </summary> |
|
101 |
private void OnFadeOutCompleted(object sender, EventArgs e) |
|
102 |
{ |
|
103 |
Popup pp = (Popup)Parent; |
|
104 |
pp.IsOpen = false; |
|
105 |
} |
|
106 |
} |
|
107 |
} |
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
8 | 8 |
using System.ServiceModel; |
9 | 9 |
using System.Threading.Tasks; |
10 | 10 |
using System.Windows; |
11 |
using System.Windows.Controls.Primitives; |
|
11 | 12 |
using Caliburn.Micro; |
12 | 13 |
using Hardcodet.Wpf.TaskbarNotification; |
13 | 14 |
using Pithos.Client.WPF.Configuration; |
... | ... | |
799 | 800 |
if (Settings.ShowDesktopNotifications) |
800 | 801 |
{ |
801 | 802 |
var tv = (ShellView) GetView(); |
802 |
tv.TaskbarView.ShowBalloonTip(notification.Title, notification.Message, icon); |
|
803 |
var balloon=new PithosBalloon{BalloonText=notification.Message}; |
|
804 |
tv.TaskbarView.ShowCustomBalloon(balloon,PopupAnimation.Fade,4000); |
|
805 |
// tv.TaskbarView.ShowBalloonTip(notification.Title, notification.Message, icon); |
|
803 | 806 |
} |
804 | 807 |
} |
805 | 808 |
#endregion |
Also available in: Unified diff