Esempio n. 1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check for any passed arguments
            if (args.Length > 0)
            {
                switch (args[0].ToLower().Trim().Substring(0, 2))
                {
                    // Preview the screen saver
                    case "/p":
                        // args[1] is the handle to the preview window
                        ScreenSaverForm screenSaverForm = new ScreenSaverForm(new IntPtr(long.Parse(args[1])));
                        screenSaverForm.ShowDialog();
                        Application.Run();
                        break;

                    // Show the screen saver
                    case "/s":
                        RunScreensaver();
                        break;

                    // Configure the screesaver's settings
                    case "/c":
                        // Show the settings form
                        SettingsForm settingsForm = new SettingsForm();
                        settingsForm.ShowDialog();
                        break;

                    // Show the screen saver
                    default:
                        RunScreensaver();
                        break;
                }
            }
            else
            {
                // No arguments were passed so we show the screensaver anyway
                RunScreensaver();
            }
        }