Пример #1
0
        [SuppressMessage("Microsoft.Globalization", "CA1300:SpecifyMessageBoxOptions")] // TODO: should we care about rightAlign? -- no unless we ship this HA.
        void IRunConfigurationCustomHostEditor.SetData(IHostSpecificRunConfigurationData data)
        {
            string currentVersion = VSRegistry.GetDefaultVersion();  // Throws if VS is not installed.

            VsIdeHostRunConfigData vsIdeHostData = data as VsIdeHostRunConfigData;

            if (vsIdeHostData == null)
            {
                vsIdeHostData = new VsIdeHostRunConfigData(currentVersion);

                // TODO: SetDirty() that set run config to dirty is disabled in parent during Initialize/SetData, so this makes no effect.
                SetDirty();
            }
            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,
                    Resources.WrongVSVersionPassedToRunConfigControl(vsIdeHostData.RegistryHive, currentVersion),
                    Resources.MicrosoftVisualStudio);

                vsIdeHostData.RegistryHive = currentVersion;
                // TODO: SetDirty() that set run config to dirty is disabled in parent during Initialize/SetData, so this makes no effect.
                SetDirty();
            }

            // Set the data.
            m_data = vsIdeHostData;

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

            if (selectedIndex < 0)
            {
                selectedIndex = m_hiveCombo.Items.IndexOf(currentVersion);
                Debug.Assert(selectedIndex >= 0);
            }
            if (selectedIndex >= 0)
            {
                m_hiveCombo.SelectedIndex = selectedIndex;
            }

            m_additionalCommandLineArgumentsEdit.Text = vsIdeHostData.AdditionalCommandLineArguments;
            m_additionalTestDataEdit.Text             = vsIdeHostData.AdditionalTestData;
        }
Пример #2
0
        [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;
            }
        }
        [SuppressMessage("Microsoft.Globalization", "CA1300:SpecifyMessageBoxOptions")] // TODO: should we care about rightAlign? -- no unless we ship this HA.
        void IRunConfigurationCustomHostEditor.SetData(IHostSpecificRunConfigurationData data)
        {
            string currentVersion = VSRegistry.GetDefaultVersion();  // Throws if VS is not installed.
            
            VsIdeHostRunConfigData vsIdeHostData = data as VsIdeHostRunConfigData;
            if (vsIdeHostData == null)
            {
                vsIdeHostData = new VsIdeHostRunConfigData(currentVersion);

                // TODO: SetDirty() that set run config to dirty is disabled in parent during Initialize/SetData, so this makes no effect.
                SetDirty();
            }
            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, 
                    Resources.WrongVSVersionPassedToRunConfigControl(vsIdeHostData.RegistryHive, currentVersion),
                    Resources.MicrosoftVisualStudio);

                vsIdeHostData.RegistryHive = currentVersion;
                // TODO: SetDirty() that set run config to dirty is disabled in parent during Initialize/SetData, so this makes no effect.
                SetDirty();
            }

            // Set the data.
            m_data = vsIdeHostData;

            int selectedIndex = m_hiveCombo.Items.IndexOf(vsIdeHostData.RegistryHive);
            if (selectedIndex < 0)
            {
                selectedIndex = m_hiveCombo.Items.IndexOf(currentVersion);
                Debug.Assert(selectedIndex >= 0);
            }
            if (selectedIndex >= 0)
            {
                m_hiveCombo.SelectedIndex = selectedIndex;
            }

            m_additionalCommandLineArgumentsEdit.Text = vsIdeHostData.AdditionalCommandLineArguments;
            m_additionalTestDataEdit.Text = vsIdeHostData.AdditionalTestData;
        }