コード例 #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
        /// <summary>
        /// Handle the event that core (non-host and not-test-specific) run config data are modified outside this editor.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="dirtyEventArgs">contains run config object that is changed outside</param>
        void IRunConfigurationEditor.OnCommonDataDirty(object sender, CommonRunConfigurationDirtyEventArgs dirtyEventArgs)
        {
            // Out test config does not depend on other data contained in the run config
            // but for the case when nobody modifies our config we still want to have our default section in RC,
            // that's why when the user switches hosts to VS IDE and we did not exist we say we are dirty, and get data will return our data.
            if (m_data == null)
            {
                SetDirty();

                // Select 1st item
                if (m_hiveCombo.SelectedIndex < 0)
                {
                    m_hiveCombo.SelectedItem = VsRegistry.GetDefaultVersion();
                }
            }
        }
コード例 #3
0
ファイル: VisualStudioIde.cs プロジェクト: rsumner33/PTVS
        /// <summary>
        /// Constructor. Starts new instance of VS IDE.
        /// </summary>
        public VisualStudioIde(VsIdeStartupInfo info)
        {
            Debug.Assert(info != null);

            if (string.IsNullOrEmpty(info.RegistryHive))
            {
                info.RegistryHive = VsRegistry.GetDefaultVersion();
                if (string.IsNullOrEmpty(info.RegistryHive))
                {
                    // Please no Debug.Assert. This is a valid case.
                    throw new VsIdeTestHostException(string.Format(CultureInfo.InvariantCulture, Resources.CannotFindVSInstallation, info.RegistryHive));
                }
            }

            StartNewInstance(info);
        }
コード例 #4
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;
            }
        }