Пример #1
0
        private static void SwitchToCurrentInstance()
        {
            IntPtr currentInstanceWindowHandle = SingleApplication.GetCurrentInstanceWindowHandle();

            if (currentInstanceWindowHandle != IntPtr.Zero)
            {
            }
        }
Пример #2
0
 public static bool Run(Form frmMain)
 {
     if (SingleApplication.IsAlreadyRunning())
     {
         SingleApplication.SwitchToCurrentInstance();
         return(false);
     }
     Application.Run(frmMain);
     return(true);
 }
Пример #3
0
        private static void SwitchToCurrentInstance()
        {
            IntPtr currentInstanceWindowHandle = SingleApplication.GetCurrentInstanceWindowHandle();

            if (currentInstanceWindowHandle != IntPtr.Zero)
            {
                if (SingleApplication.IsIconic(currentInstanceWindowHandle) != 0)
                {
                    SingleApplication.ShowWindow(currentInstanceWindowHandle, 9);
                }
                SingleApplication.SetForegroundWindow(currentInstanceWindowHandle);
            }
        }
Пример #4
0
        public static bool Run(Form frmMain)
        {
            bool result;

            if (SingleApplication.IsAlreadyRunning())
            {
                SingleApplication.SwitchToCurrentInstance();
                result = false;
            }
            else
            {
                Application.Run(frmMain);
                result = true;
            }
            return(result);
        }
Пример #5
0
 public static bool Run()
 {
     return(!SingleApplication.IsAlreadyRunning());
 }