|
using System;
using System.Threading;
using System.Windows.Forms;
namespace BookStoreGUI
{
static class Program
{
private const string ApplicationName = "BookStore";
/// <summary>
/// Waiting time (in milliseconds) for the mutex, used to determine
/// whether another instance of the application is already running.
/// </summary>
private const int WaitingTimeInMilliseconds = 50;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Mutex applicationMutex = new Mutex(false, ApplicationName);
if (applicationMutex.WaitOne(WaitingTimeInMilliseconds, false) == false)
Application.Run(new MultipleInstancesErrorForm());
else
{
Application.Run(new MainForm());
applicationMutex.ReleaseMutex();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.