A
download MyTestEditorControl.cs
Language: C#
License: MSVSSDK
LOC: 39
Project Info
C# Example.MyTestTypeSample
Server: Visual Studio SDK
Type: filesystem
...xtensibility\MyTest\MyTest\
   assembly.cs
   MyHostAdapter.cs
   ...pterRunConfigControl.cs
   ...nfigControl.Designer.cs
   ...erRunConfigControl.resx
   MyTest.cs
   MyTest.csproj
   MyTestAdapter.cs
   MyTestAssertHelper.cs
   MyTestEditorControl.cs
   ...itorControl.Designer.cs
   MyTestEditorControl.resx
   MyTestEditorFactory.cs
   MyTestPackage.cs
   MyTestResourceIds.cs
   MyTestResult.cs
   MyTestResultViewControl.cs
   ...ViewControl.designer.cs
   ...tResultViewControl.resx
   MyTestResultViewWindow.cs
   MyTestRunConfigControl.cs
   ...nfigControl.Designer.cs
   ...stRunConfigControl.resx
   MyTestTip.cs
   MyTestTuip.cs
   MyTestWizard.cs

/***************************************************************************
 
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
 
***************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
//using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;


namespace Microsoft.VisualStudio.TestTools.Samples
{
    public partial class MyTestEditorControl : Microsoft.VisualStudio.TestTools.Tips.TuipPackage.TuipEditorControl
    {
        public MyTestEditorControl(IOleServiceProvider serviceProvider) : base(serviceProvider)
        {
            InitializeComponent();
        }
        
        /// <summary>
        /// This is the extention that will be used in the save as dialog
        /// </summary>
        public override string FileExtension
        {
            get { return ".mytest"; }
        }

        /// <summary>
        /// This will be the name of the file filter in the save
        /// as dialog
        /// </summary>
        public override string FilterName
        {
            get { return "My Test Sample"; }
        }

        /// <summary>
        /// This will be called by the test framework when your editor needs
        /// to load a test for editing.
        /// </summary>
        /// <param name="test">The ITestElement that needs to be loaded</param>
        protected override void LoadTest(Microsoft.VisualStudio.TestTools.Common.ITestElement test)
        {
            // Ensure that the base has loaded this test           
            base.LoadTest(test);

            // Set the UI to show the data from the test
            this.textBox1.Text = ((MyTest)(base.TestInEditing)).CommandLine;

            // Make sure that the framework knows we've finished loading
            base.IsLoading = false;
        }

        /// <summary>
        /// When the user enters text, store it back into the test for later
        /// persistence
        /// </summary>
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            // Only handle the changes if we are not loading in progress
            if (!IsLoading)
            {
                ((MyTest)base.TestInEditing).CommandLine = textBox1.Text;
                base.HandleChange(); // Tell the base editor to handle these changes
            }
        }
    }
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us