コード例 #1
0
ファイル: RunConfigControl.cs プロジェクト: rsumner33/PTVS
 /// <summary>
 /// Main editor is asking the control for the current host specific data.
 /// </summary>
 /// <returns></returns>
 IHostSpecificRunConfigurationData IRunConfigurationCustomHostEditor.GetData()
 {
     if (m_data == null)
     {
         m_data = new RunConfigData(VsRegistry.GetDefaultVersion());
     }
     return(m_data);
 }
コード例 #2
0
ファイル: RunConfigControl.cs プロジェクト: rsumner33/PTVS
        [SuppressMessage("Microsoft.Globalization", "CA1300:SpecifyMessageBoxOptions")] // Taking care of rightAlign is not important for this sample.
        void IRunConfigurationCustomHostEditor.SetData(IHostSpecificRunConfigurationData data)
        {
            string latestVersion = VsRegistry.GetDefaultVersion();  // Throws if VS is not installed.

            RunConfigData vsIdeHostData = data as RunConfigData;

            if (vsIdeHostData == null)
            {
                vsIdeHostData = new RunConfigData(VsRegistry.GetDefaultVersion());
            }
            else if (!m_hiveCombo.Items.Contains(vsIdeHostData.RegistryHive))
            {
                // If .testrunconfig file has VS version that we do not have in combobox,
                // show message box and use default version.
                MessageBox.Show(
                    this,
                    string.Format(CultureInfo.InvariantCulture, Resources.WrongVSVersionPassedToRunConfigControl,
                                  vsIdeHostData.RegistryHive, latestVersion),
                    Resources.MicrosoftVisualStudio);

                vsIdeHostData = new RunConfigData(latestVersion);
            }

            if ((object)m_data != (object)vsIdeHostData)
            {
                SetDirty();
            }

            // Set the data.
            m_data = vsIdeHostData;

            int selectedIndex = m_hiveCombo.Items.IndexOf(vsIdeHostData.RegistryHive);

            if (selectedIndex < 0)
            {
                selectedIndex = m_hiveCombo.Items.IndexOf(latestVersion);
                Debug.Assert(selectedIndex >= 0);
            }
            if (selectedIndex >= 0)
            {
                m_hiveCombo.SelectedIndex = selectedIndex;
            }
        }
コード例 #3
0
ファイル: VsIdeHostAdapter.cs プロジェクト: rsumner33/PTVS
        /// <summary>
        /// Determine which registry hive to use for Visual Studio:
        ///     If override value is set, use it, don't use anything else.
        ///     Else If using RunConfig, get it from RunConfig
        ///     Else get it from environment.
        /// </summary>
        /// <returns></returns>
        private string GetRegistryHive()
        {
            // We get registry hive each time we initialize host side, i.e. it can be changed in between tests.
            string overrideHiveValue = RegistrySettings.RegistryHiveOverride;

            if (!string.IsNullOrEmpty(overrideHiveValue))
            {
                return(overrideHiveValue);
            }

            // Note that Run Config Data can be null, e.g. when executing using HostType attribute.
            TestRunConfiguration runConfig         = m_runContext.RunConfig.TestRun.RunConfiguration;
            RunConfigData        runConfigHostData = runConfig.HostData[Constants.VsIdeHostAdapterName] as RunConfigData;

            if (runConfigHostData != null)
            {
                return(runConfigHostData.RegistryHive);
            }

            return(null);    // VsIde will figure out and use default.
        }