Esempio n. 1
0
        private void m_appTypeCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            //this only happens when we detect admin required and revert the change
            if (m_appTypeCombo.SelectedIndex == m_launcherIndex)
            {
                return;
            }

            //not sure this CAN happen
            if (m_appTypeCombo.SelectedItem == null)
            {
                m_launcher = null;
                m_launchPropGrid.SelectedObject = null;
                return;
            }

            Type      launcherType = (m_appTypeCombo.SelectedItem as TypeEntry).Type;
            ILauncher launcher     = (ILauncher)Activator.CreateInstance(launcherType);

            //Don't allow the user to select a launcher that will just fail due to admin privileges required
            if (launcher.RequiresAdmin && !LauncherCommon.UserIsAdmin())
            {
                MessageBox.Show("You must run SlimTune as an administrator to profile the selected application type.");
                m_appTypeCombo.SelectedIndex = m_launcherIndex;
                return;
            }

            m_launcher = launcher;
            m_launchPropGrid.SelectedObject = m_launcher;
            m_launcherIndex = m_appTypeCombo.SelectedIndex;
        }