${res:Templates.Project.SysTrayIcon.Name}
C#
${res:Templates.File.Categories.WindowsApplications}
C#.Project.Form
C#
${res:Templates.Project.SysTrayIcon.Description}
${ProjectName}
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) {
SysTrayIcon sysTrayIcon = new SysTrayIcon();
sysTrayIcon.trayIcon.Visible = true;
Application.Run();
sysTrayIcon.trayIcon.Dispose();
} else {
// The application is already running
}
} // 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 TrayIconDoubleClick(object sender, EventArgs e)
{
MessageBox.Show("The icon was double clicked");
}
#endregion
}
}
]]>