public ContextMenuWYSIWYG(NotifyIcon icon, PromptSetHDKDisplayOrientation prompt, bool start_server)
        {
            InitializeComponent();

            m_icon = icon;
            m_displayOrientationPrompt = prompt;
            m_server = new ServerManager(this);

            // Note: This was needed when Invoke resulted in deadlocks.  See OSVI-65 for context
            // (or https://blogs.msdn.microsoft.com/dsui_team/2012/10/31/debugging-windows-forms-application-hangs-during-systemevents-userpreferencechanged/
            // and http://stackoverflow.com/questions/287142/invoke-is-blocking).
            if (!IsHandleCreated)
            {
                CreateHandle();
            }

            SetGPUType();

            // Set server config GUI to match settings
            defaultServerConfigurationToolStripMenuItem.Checked = Properties.Settings.Default.useDefaultConfig;
            customServerConfigurationToolStripMenuItem.Checked  = Properties.Settings.Default.useCustomConfig;
            useIRCameraToolStripMenuItem.Checked = Properties.Settings.Default.useIRCamera;
            useIRCameraToolStripMenuItem.Enabled = !customServerConfigurationToolStripMenuItem.Checked;

            if (start_server)
            {
                m_server.StartServer();
            }

            if (SteamVRConfig.IsLegacyOSVRDriverInstalled())
            {
                Common.ShowMessageBox(Common.MSG_STEAMVR_OSVR_LEGACY_DRIVER_DETECTED, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        /// <summary>
        /// Update enabled/disabled items based on server state
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OSVRContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (m_server.Running)
            {
                startServerToolStripMenuItem.Enabled   = false;
                restartServerToolStripMenuItem.Enabled = true;
                stopServerToolStripMenuItem.Enabled    = true;

                launchSampleSceneToolStripMenuItem.Enabled = true;
                launchTrackerViewToolStripMenuItem.Enabled = true;
            }
            else
            {
                startServerToolStripMenuItem.Enabled   = true;
                restartServerToolStripMenuItem.Enabled = false;
                stopServerToolStripMenuItem.Enabled    = false;

                launchSampleSceneToolStripMenuItem.Enabled = false;
                launchTrackerViewToolStripMenuItem.Enabled = false;
            }

            showServerConsoleToolStripMenuItem.Enabled  = !m_server.ConsoleVisible;
            enableExtendedModeToolStripMenuItem.Enabled = !NativeHelpers.IsExtendedModeEnabled();

            switch (SteamVRConfig.InversionState())
            {
            case SteamVRConfig.SteamVRInversion.Unknown:
                invertSteamVRToolStripMenuItem.Enabled = false;
                invertSteamVRToolStripMenuItem.Checked = false;
                break;

            case SteamVRConfig.SteamVRInversion.Inverted:
                invertSteamVRToolStripMenuItem.Enabled = true;
                invertSteamVRToolStripMenuItem.Checked = true;
                break;

            case SteamVRConfig.SteamVRInversion.NotSet:
            case SteamVRConfig.SteamVRInversion.Standard:
                invertSteamVRToolStripMenuItem.Enabled = true;
                invertSteamVRToolStripMenuItem.Checked = false;
                break;
            }
        }
 private void invertSteamVRToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SteamVRConfig.UpdateSteamVRConfigFile(SteamVRConfig.ConfigChange.Invert);
 }