Esempio n. 1
0
        static void Main()
        {
            var current = Process.GetCurrentProcess();
            var v       = Process.GetProcessesByName(current.ProcessName);

            if (v.Length > 1)
            {
                foreach (Process proc in v)
                {
                    if (proc.Id == current.Id)
                    {
                        continue;
                    }
                    //ShowWindow(proc.MainWindowHandle, 9 /* SW_RESTORE */);
                    SetForegroundWindow(proc.MainWindowHandle);
                    return;
                }
            }

            var setting = new UserSetting();

            setting.Load();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm(setting));
            setting.Save();
        }
Esempio n. 2
0
        static void Main()
        {
            var current = Process.GetCurrentProcess();
            var v = Process.GetProcessesByName(current.ProcessName);
            if (v.Length > 1)
            {
                foreach (Process proc in v)
                {
                    if (proc.Id == current.Id) continue;
                    //ShowWindow(proc.MainWindowHandle, 9 /* SW_RESTORE */);
                    SetForegroundWindow(proc.MainWindowHandle);
                    return;
                }
            }

            var setting = new UserSetting();
            setting.Load();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm(setting));
            setting.Save();
        }