${res:Templates.Project.SysTrayIcon.Name}
C#
${res:Templates.File.Categories.WindowsApplications}
C#.Project.Form
${res:Templates.Project.SysTrayIcon.Description}
v2.0;v3.5Client
WinExe
Properties
Program entry point.
/// Command Line Arguments
[STAThread]
public static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
bool isFirstInstance;
// Please use a unique name for the mutex to prevent conflicts with other programs
using (Mutex mtx = new Mutex(true, "${StandardNamespace}", out isFirstInstance)) {
if (isFirstInstance) {
NotificationIcon notificationIcon = new NotificationIcon();
notificationIcon.notifyIcon.Visible = true;
Application.Run();
notificationIcon.notifyIcon.Dispose();
} else {
// The application is already running
// TODO: Display message box or change focus to existing application instance
}
} // releases the Mutex
}
#endregion
#region Event Handlers
private void menuAboutClick(object sender, EventArgs e)
{
MessageBox.Show("About This Application");
}
private void menuExitClick(object sender, EventArgs e)
{
Application.Exit();
}
private void IconDoubleClick(object sender, EventArgs e)
{
MessageBox.Show("The icon was double clicked");
}
#endregion
}
}
]]>