src/T4Toolbox.VisualStudio/CustomToolTemplateEditor.cs
/// <summary>
/// Uses the Windows Open File dialog to allow user to choose the template file.
/// </summary>
Uses the Windows Open File dialog to allow user to choose the template file.
Uses the Windows Open File dialog to allow user to choose the template file .
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            string templateFullPath = GetFullTemplatePath(context, (string)value);
            var dialog = new OpenFileDialog();
            dialog.Title = "Select Custom Tool Template";
            dialog.FileName = Path.GetFileName(templateFullPath);
            dialog.InitialDirectory = Path.GetDirectoryName(templateFullPath);
            dialog.Filter = "Text Templates (*.tt)|*.tt|All Files (*.*)|*.*";
            if (dialog.ShowDialog() == true)
            {
                return GetRelativeTemplatePath(context, dialog.FileName);
            }
            return value;
        }
public override object EditValue ( ITypeDescriptorContext context , IServiceProvider provider , object value ) { string templateFullPath = GetFullTemplatePath ( context , ( string ) value ) ; var dialog = new OpenFileDialog ( ) ; dialog . Title = " " ; dialog . FileName = Path . GetFileName ( templateFullPath ) ; dialog . InitialDirectory = Path . GetDirectoryName ( templateFullPath ) ; dialog . Filter = " " ; if ( dialog . ShowDialog ( ) == true ) { return GetRelativeTemplatePath ( context , dialog . FileName ) ; } return value ; }
Uses the Windows Open File dialog to allow user to choose the template file.
Uses the Windows Open File dialog to allow user to choose the template file .
context
ITypeDescriptorContext
provider
IServiceProvider
value
object