Exemplo n.º 1
0
        static void Main(string[] args)
        {
            int SuperMode = 0;

            if (args.Length > 0)
            {

                string firstArgument = args[0].ToLower().Trim();
                string secondArgument = null;

                if (firstArgument.Length > 2)
                {

                    secondArgument = firstArgument.Substring(3).Trim();
                    firstArgument = firstArgument.Substring(0, 2);

                }

                else if (args.Length > 1)
                    secondArgument = args[1];

                if (firstArgument == "/c")           // Configuration mode
                {

                    SuperMode = 1;

                }

                else if (firstArgument == "/p")      // Preview mode
                {

                    SuperMode = 2;

                }

                else if (firstArgument == "/s")      // Full-screen mode
                {

                    SuperMode = 0;

                }

                else    // Undefined argument
                {

                    MessageBox.Show("Sorry, but the command line argument \"" + firstArgument + "\" is not valid.", "ScreenSaver", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                }

            }
            else    // No arguments - treat like /c
            {

                SuperMode = 0;

            }

            #region Screensaver

            if (SuperMode == 0)
            {

                if (File.Exists("./MultiSaverConfiguration.xml"))
                {

                    ConfigData.Settings ConfigSettings = new ConfigData.Settings();

                    ConfigSettings.Load();

                    foreach (ConfigData.Monitor M in ConfigSettings.Slideshow)
                    {

                        Thread MonitorThread = new Thread(RunAlbum);
                        MonitorThread.Start(M);

                    }

                    bool Primary = true;

                    foreach (ConfigData.Monitor M in ConfigSettings.Maze)
                    {

                        Thread MazeAICenter = new Thread(RunMaze);
                        MazeAICenter.Start(new object[] { new Rectangle(M.Bounds.X, M.Bounds.Y, M.Bounds.Width, M.Bounds.Height), Primary ? 0 : 1, Primary ? 0 : 10 });
                        Primary = false;
                        Thread.Sleep(1000);

                    }

                }

                else
                {

                    foreach (Screen S in System.Windows.Forms.Screen.AllScreens)
                    {

                        Thread MonitorThread = new Thread(RunAlbum);
                        MonitorThread.Start(new ConfigData.Monitor { Bounds = new System.Drawing.Rectangle(S.Bounds.X, S.Bounds.Y, S.Bounds.Width, S.Bounds.Height) });

                    }

                }

            }

            #endregion

            if (SuperMode == 1)
            {

                //WPF_Practice.MainWindow ConfigPanel = new MainWindow();
                //ConfigPanel.ShowDialog();

                ConfigPanel.MainWindow ConfigPanel = new ConfigPanel.MainWindow();
                ConfigPanel.ShowDialog();

            }

            if (SuperMode == 2)
            {

                string firstArgument = args[0].ToLower().Trim();
                string secondArgument = null;

                if (firstArgument.Length > 2)
                {
                    secondArgument = firstArgument.Substring(3).Trim();
                    firstArgument = firstArgument.Substring(0, 2);
                }
                else if (args.Length > 1)
                    secondArgument = args[1];

                IntPtr previewWndHandle = new IntPtr(long.Parse(secondArgument));

                Thread MonitorThread = new Thread(RunDemo);
                MonitorThread.Start(new object[] { new Rectangle(0, 0, 800, 600), previewWndHandle });

            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            int SuperMode = 0;

            if (args.Length > 0)
            {
                string firstArgument  = args[0].ToLower().Trim();
                string secondArgument = null;


                if (firstArgument.Length > 2)
                {
                    secondArgument = firstArgument.Substring(3).Trim();
                    firstArgument  = firstArgument.Substring(0, 2);
                }

                else if (args.Length > 1)
                {
                    secondArgument = args[1];
                }

                if (firstArgument == "/c")           // Configuration mode
                {
                    SuperMode = 1;
                }

                else if (firstArgument == "/p")      // Preview mode
                {
                    SuperMode = 2;
                }

                else if (firstArgument == "/s")      // Full-screen mode
                {
                    SuperMode = 0;
                }

                else    // Undefined argument
                {
                    MessageBox.Show("Sorry, but the command line argument \"" + firstArgument + "\" is not valid.", "ScreenSaver", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else    // No arguments - treat like /c
            {
                SuperMode = 0;
            }

            #region Screensaver

            if (SuperMode == 0)
            {
                if (File.Exists("./MultiSaverConfiguration.xml"))
                {
                    ConfigData.Settings ConfigSettings = new ConfigData.Settings();

                    ConfigSettings.Load();

                    foreach (ConfigData.Monitor M in ConfigSettings.Slideshow)
                    {
                        Thread MonitorThread = new Thread(RunAlbum);
                        MonitorThread.Start(M);
                    }

                    bool Primary = true;

                    foreach (ConfigData.Monitor M in ConfigSettings.Maze)
                    {
                        Thread MazeAICenter = new Thread(RunMaze);
                        MazeAICenter.Start(new object[] { new Rectangle(M.Bounds.X, M.Bounds.Y, M.Bounds.Width, M.Bounds.Height), Primary ? 0 : 1, Primary ? 0 : 10 });
                        Primary = false;
                        Thread.Sleep(1000);
                    }
                }

                else
                {
                    foreach (Screen S in System.Windows.Forms.Screen.AllScreens)
                    {
                        Thread MonitorThread = new Thread(RunAlbum);
                        MonitorThread.Start(new ConfigData.Monitor {
                            Bounds = new System.Drawing.Rectangle(S.Bounds.X, S.Bounds.Y, S.Bounds.Width, S.Bounds.Height)
                        });
                    }
                }
            }

            #endregion

            if (SuperMode == 1)
            {
                //WPF_Practice.MainWindow ConfigPanel = new MainWindow();
                //ConfigPanel.ShowDialog();

                ConfigPanel.MainWindow ConfigPanel = new ConfigPanel.MainWindow();
                ConfigPanel.ShowDialog();
            }

            if (SuperMode == 2)
            {
                string firstArgument  = args[0].ToLower().Trim();
                string secondArgument = null;

                if (firstArgument.Length > 2)
                {
                    secondArgument = firstArgument.Substring(3).Trim();
                    firstArgument  = firstArgument.Substring(0, 2);
                }
                else if (args.Length > 1)
                {
                    secondArgument = args[1];
                }

                IntPtr previewWndHandle = new IntPtr(long.Parse(secondArgument));

                Thread MonitorThread = new Thread(RunDemo);
                MonitorThread.Start(new object[] { new Rectangle(0, 0, 800, 600), previewWndHandle });
            }
        }