예제 #1
0
        /// <summary>
        /// Event: Performs important program initialization tasks when the main form is loaded.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">Empty event data.</param>
        private void EventMainFormLoad(object sender, EventArgs e)
        {
            try
            {
                // Initialize the random number generators for generating random areas and random colors
                ColorsCommon.RandomGenerator = new Random();

                // Get the bounds of all monitors
                this.Bounds = SystemInformation.VirtualScreen;

                // Save the current opacity
                this.lastUserOpacity = this.Opacity;

                // Finalize the menus (add the opacity track bar, the multi monitor support items, modernize the menu, etc.)
                this.FinalizeMenus();

                // Create the quick start form
                this.quickStartForm = QuickStartForm.Create(this);

                // Load settings from the default configuration file (and the focus areas if AutoRestoreAreas is true)
                this.LoadLayout(string.Empty, false);
                this.quickStartForm.EnsureOnscreen();

                // Load an optional configuration file if specified on the command line
                string[] args = Environment.GetCommandLineArgs();
                if (args.Length > 1)
                {
                    this.LoadLayout(args[1], true);
                }

                // Register the Pause/Resume hot key read from the configuration file, or the default one
                this.HotKeyString = string.IsNullOrEmpty(this.hotKeyString) ? GlobalHotkey.KeysToString(Keys.Control | Keys.F11) : this.hotKeyString;
            }
            finally
            {
                // Signal that the startup phase has ended
                this.afterStartup = true;
            }
        }