Forum

C#, WPF NotifyIcon,...
 
Notifications
Clear all

C#, WPF NotifyIcon, context menu and application exit

1 Posty
1 Users
0 Reactions
1,156 Widok
0
Topic starter

exmple code

1 Answer
0
Topic starter
var contextmenu = new ContextMenu();

MenuItem mi = new MenuItem();
mi.Header = "Close App";
mi.Click += (sender, args) =>
{
	this.Close();
	Environment.Exit(0);
};

var itm =  contextmenu.Items.Add(mi);

var TaskbarIcon tb = new TaskbarIcon();
tb.ToolTipText = "Test test test";
tb.Icon = (Icon)Properties.Resources.ikonaone;
tb.TrayMouseDoubleClick += NotifyIconInteracted;
tb.ContextMenu = contextmenu;

Odpowiedź

Author Name

Author Email

Your question *

Preview 0 Revisions Saved
Share: