Пример #1
0
        private static void SingleInstanceCallback(object sender, InstanceCallbackEventArgs args)
        {
            if (WaitFormLoad(5000))
            {
                Action d = () =>
                {
                    if (args.CommandLineArgs == null || args.CommandLineArgs.Length <= 1)
                    {
                        if (MainForm.niTray != null && MainForm.niTray.Visible)
                        {
                            // Workaround for Windows startup tray icon bug
                            MainForm.niTray.Visible = false;
                            MainForm.niTray.Visible = true;
                        }

                        MainForm.ShowActivate();
                    }
                    else if (MainForm.Visible)
                    {
                        MainForm.ShowActivate();
                    }

                    MainForm.UseCommandLineArgs(args.CommandLineArgs);
                };

                MainForm.InvokeSafe(d);
            }
        }
Пример #2
0
        private static void DoStartupNextInstance(string[] args)
        {
            if (args == null || args.Length == 0)
            {
                if (MainForm.niTray != null && MainForm.niTray.Visible)
                {
                    // Workaround for Windows startup tray icon bug
                    MainForm.niTray.Visible = false;
                    MainForm.niTray.Visible = true;
                }

                MainForm.ShowActivate();
            }
            else if (MainForm.Visible)
            {
                MainForm.ShowActivate();
            }

            MainForm.UseCommandLineArgs(args);
        }