Files
cms_thermo_active/Step.Client/Program.cs
T
CMS3762\carminatini 2a28a201be Added C# CMS Client
2017-12-01 16:51:09 +01:00

57 lines
1.7 KiB
C#

using CefSharp;
using CMS_Client.Config;
using CMS_Client.View;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CMS_Client
{
public static class Program
{
//Set the Mutef of GUID
static Mutex CmsStepMutex = new Mutex(true, "{66fa29db-925a-402b-a4c7-d3d780fb1bc3}");
[STAThread]
static void Main(string[] args)
{
//Check the first argument -> Url
if(args.Count() > 0)
{
Uri UrlResArg;
if(Uri.TryCreate(args[0], UriKind.Absolute, out UrlResArg) && (UrlResArg.Scheme == Uri.UriSchemeHttp || UrlResArg.Scheme == Uri.UriSchemeHttps))
CMSConfiguration.CustomUrl = args[0];
}
//Check if is already running an instance of this application
if (!CmsStepMutex.WaitOne(TimeSpan.Zero, true))
{
MessageBox.Show("Only one istance of " + Application.ProductName + " can be executed!",
Application.ProductName,
MessageBoxButtons.OK,
MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1
);
Environment.Exit(0);
}
//Run the Loading Form
Application.Run(new LoadingForm());
//Run the Main-Browser Form
Application.Run(new MainForm());
NcWindow.ShowTaskBar();
}
}
}