mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-13 17:23:19 -05:00
40 lines
1005 B
C#
40 lines
1005 B
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Forms;
|
|
using Hardcodet.Wpf.TaskbarNotification;
|
|
using NotifyIconWpf.Sample.WindowsForms.Properties;
|
|
|
|
namespace NotifyIconWpf.Sample.WindowsForms
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
private TaskbarIcon notifyIcon;
|
|
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
notifyIcon = new TaskbarIcon
|
|
{
|
|
Icon = Resources.Led,
|
|
ToolTipText = "Left-click to open popup",
|
|
Visibility = Visibility.Visible,
|
|
TrayPopup = new FancyPopup()
|
|
};
|
|
|
|
}
|
|
|
|
protected override void OnClosed(EventArgs e)
|
|
{
|
|
base.OnClosed(e);
|
|
|
|
//the notify icon only closes automatically on WPF applications
|
|
//-> dispose the notify icon manually
|
|
notifyIcon.Dispose();
|
|
}
|
|
}
|
|
} |