示例#1
0
        static void Main(string[] args)
        {
            bool second    = false;
            bool createNew = false;

            using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
            {
                if (!createNew)
                {
                    var r = MessageBox.Show("数据上传程序(HTTP)已经在运行中...", "选择是否允许第二个数据上传代理", MessageBoxButtons.YesNo);
                    if (r == DialogResult.Yes)
                    {
                        second = true;
                    }
                    else
                    {
                        return;
                    }
                }

                try
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    MainDataAgentWindow form = new MainDataAgentWindow();
                    form.IsSecond = second;
                    Application.Run(form);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            bool createNew = false;

            using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    try
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        MainDataAgentWindow form = new MainDataAgentWindow();
                        Application.Run(form);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message);
                    }
                }
                else
                {
                    MessageBox.Show("数据上传程序(HTTP)已经在运行中...");
                }
            }
        }
示例#3
0
文件: Program.cs 项目: oisy/scada
 static void Main(string[] args)
 {
     bool createNew = false;
     using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
     {
         if (createNew)
         {
             try
             {
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 MainDataAgentWindow form = new MainDataAgentWindow();
                 Application.Run(form);
             }
             catch (Exception e)
             {
                 MessageBox.Show(e.Message);
             }
         }
         else
         {
             MessageBox.Show("数据上传程序(HTTP)已经在运行中...");
         }
     }
 }