Files
wpf-notifyicon/Source/WindowsFormsSample/Form1.cs
Philipp Sumi 2a4cf8de7e WPF NotifyIcon
--------------
FIX   Dispose only deregisters OnExit event listenter if there is actually an
      application (not the case in WinForms environments).
CHG   Added dispose to WinForms sample which closes the NotifyIcon.

git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@121 9f600761-6f11-4665-b6dc-0185e9171623
2009-09-22 07:48:22 +00:00

45 lines
984 B
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Forms;
using Hardcodet.Wpf.TaskbarNotification;
using Samples;
using WindowsFormsSample.Properties;
namespace WindowsFormsSample
{
public partial class Form1 : Form
{
private TaskbarIcon notifyIcon;
public Form1()
{
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
notifyIcon = new TaskbarIcon();
notifyIcon.Icon = Resources.Led;
notifyIcon.ToolTipText = "Left-click to open popup";
notifyIcon.Visibility = Visibility.Visible;
notifyIcon.TrayPopup = new FancyPopup();
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
//close the notify icon
notifyIcon.Dispose();
}
}
}