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);
            }
        }
Exemple #2
0
        public void Display(bool start_server = false)
        {
            m_osvrIcon.Icon    = Resources.logo;
            m_osvrIcon.Text    = "OSVR Tray App";
            m_osvrIcon.Visible = true;

            // Note: this is a workaround; see OSVI-65 for context.
            PromptSetHDKDisplayOrientation p = new PromptSetHDKDisplayOrientation();

            p.Opacity = 0d;
            p.Show();
            p.Hide();
            p.Opacity = 100d;

            m_contextMenu                = new ContextMenuWYSIWYG(m_osvrIcon, p, start_server);
            p.m_contextMenu              = m_contextMenu;
            m_osvrIcon.ContextMenuStrip  = m_contextMenu.OSVRContextMenuStrip;
            m_osvrIcon.MouseDoubleClick += OSVRIcon_MouseDoubleClick;

            SetupLabels(m_osvrIcon.ContextMenuStrip.Items);

            m_osvrIcon.ContextMenuStrip.BackColor = BG_COLOR;

            foreach (ToolStripItem tsi in m_osvrIcon.ContextMenuStrip.Items)
            {
                SetupTSIColors(tsi);
            }

            m_osvrIcon.ContextMenuStrip.Renderer = new CustomColorRenderer();
        }