mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-14 01:25:45 -05:00
* Applied some code conventions, used more current language features which should improve readability and making it easier to re-factor / modify. Also fixed some typos in documentation. * Changes based on PR conversation for the SystemInfo * Some modifications due to conversations on the PR, especially I removed the FlagsAttribute on the BalloonFlags. * Removed Silverlight targeting in code.
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System.Windows;
|
|
using System.Windows.Controls.Primitives;
|
|
|
|
namespace Samples.Tutorials.Balloons
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for BalloonSampleWindow.xaml
|
|
/// </summary>
|
|
public partial class BalloonSampleWindow : Window
|
|
{
|
|
public BalloonSampleWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
//clean up notifyicon (would otherwise stay open until application finishes)
|
|
MyNotifyIcon.Dispose();
|
|
|
|
base.OnClosing(e);
|
|
}
|
|
|
|
|
|
private void btnShowCustomBalloon_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
FancyBalloon balloon = new FancyBalloon();
|
|
balloon.BalloonText = "Custom Balloon";
|
|
|
|
//show balloon and close it after 4 seconds
|
|
MyNotifyIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 4000);
|
|
}
|
|
|
|
private void btnHideStandardBalloon_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
MyNotifyIcon.HideBalloonTip();
|
|
}
|
|
|
|
|
|
private void btnShowStandardBalloon_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string title = "WPF NotifyIcon";
|
|
string text = "This is a standard balloon";
|
|
|
|
MyNotifyIcon.ShowBalloonTip(title, text, MyNotifyIcon.Icon);
|
|
}
|
|
|
|
private void btnCloseCustomBalloon_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
MyNotifyIcon.CloseBalloon();
|
|
}
|
|
}
|
|
} |