/// <summary> /// Run an Ariadne maze within an arbitrary window. /// Used for simulating the environment given by xscreensaver on Linux. /// </summary> public static void Run() { var form = CreateTargetWindow(); var control = new Control // will provide the drawing area { Size = form.ClientSize, Location = new Point(0, 0), Enabled = false, // so that it doesn't consume keystrokes }; form.Controls.Add(control); form.Show(); var ctrl = new ScreenSaverController(control.Handle.ToString()); // Send the form's events to the controller. form.KeyPress += ctrl.OnKeyPress; form.FormClosing += ctrl.TargetWindowClosing; // The first maze has already been loaded // when the ScreenSaverController was constructed. loadingFirstMaze = false; // Now, the controller runs within the existing main application loop. }
/// <summary> /// Run as a xscreenscerver(1) plugin. /// </summary> /// <param name="windowHandleArg">Provided by xscreensaver..</param> public static void Run(string windowHandleArg) { var ctrl = new ScreenSaverController(windowHandleArg); // Now the first maze has been loaded. loadingFirstMaze = false; // Start a main application loop. Application.Run(); }