Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > How to do simple recipe alteration to solicit additional string for recipe substitution
 

How to do simple recipe alteration to solicit additional string for recipe substitution

I'd like to alter our SCSF guidance to produce customized View/Presenter software. To do this I need to ask the user for one string in addition to the view name asked for in the Add View (with presenter) panel, which will then be used for substitution in a C-sharp template.

Could someone tell me what is the simplest, most straightforward way of altering the existing recipe to solicit the additional name from the user? I think from there I can see how to use this to plug into the template, but any instructions or hints there would be appreciated as well.

Thanks

D. Jones  Thursday, January 22, 2009 9:13 PM
Hi,

I don´t understand completely the question.

Do you not know how you do the modification ? or Do you not know how you must implement it?

If you want to keep the original recipe file, I recommend you to create a new recipe file and new view page, and change the name to the new copied recipe.



But I think that you are asking because you don´t know how to make the modification.



You can create a duplicate of the files (to keep the original functionality):

Recipes -> CS -> CreateSmartClientFactoryView.xml

And all CustomWizardPages -> CreateViewPage -> CreateViewPage folder.

You can make a copy\paste directly from the VS.



I recommend you to change the namespaces to this files, to differentiate this new form with the original.

If you want to have minimal problem, you can only add a additional item to tne namespace, for example:

namespace Microsoft.Practices.SmartClientFactory.CustomWizardPages.<custom name>CreateViewPage

But I recommend you in the future to change the interfaces, class and form name.



Then you must add new register in the SmartClientDevelopment.xml, with the new recipe file (xml file):

<xi:include href="Recipes/CS/<custom name>CreateSmartClientFactoryView.xml"/>



In the <custom name>CreateSmartClientFactoryView.xml file, you remember to modify the recipe name:

<Recipe Name="<cusom name>CreateViewCS" >

Change the caption tag, too:

<Caption> <custom name>- Add View (with presenter)...</Caption>



In this file you need to change the Wizard tag:

<Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0" Help="ms-help://MS.VSCC.v90/MS.VSIPCC.v90/ms.practices.scsf.2008apr/SCSF/html/03-01-040-How_to_Add_a_View_with_a_Presenter.htm">
<Pages>
<Page Type="Microsoft.Practices.SmartClientFactory.CustomWizardPages.<custom name>CreateViewPage.<custom name>CreateViewPage, Microsoft.Practices.SmartClientFactory.GuidancePackage">
<Title>Add View with Presenter</Title>
<LinkTitle>Add View with Presenter properties</LinkTitle>
</Page>
</Pages>
</Wizard>



You need to modify the ICreateViewPage, adding aditional property:

string CustomText { get; }



In the CreateViewPage form, you must add the property defined in the interface:

public string CustomText
{
get { return _customTextBox.Text; }
}

The customTextBox is the name of textbox control added in the form.



In the recipe you must add :

<Argument Name="CustomText" Required="false">
<ValueProvider Type="Evaluator" Expression="" />
</Argument>



In the template code you must add new input, for example, I added the input parameter in the View.cs.t4 :

<Action Name="GenerateView" Type="TextTemplateAction"
Template="Items\View.CS\View.cs.t4">
<Input Name="ClassName" RecipeArgument="ViewName" />
<Input Name="TargetNamespace" RecipeArgument="TargetNamespace" />
<Input Name="RootNamespace" RecipeArgument="RootNamespace"/>
<Input Name="CustomText" RecipeArgument="CustomText"/>
<Output Name="Content" />
</Action>

You can use it in the template: <#= CustomText #>



Note: You can follow the ViewName property of the wizard, because it is related to simple text control.

In the ViewName the code used event to notify changes, but in this step I don´t add these.



I hope I have been helpful.

greetings



Leandro Tuttini
Leandro Tuttini  Friday, January 23, 2009 4:56 PM

You can use google to search for other answers

Custom Search

More Threads

• Custom developed Guidance Automation Package not listed under VisualStudio template
• Guidance Automation Extensions and Toolkit: June 2006 Release
• exception in execution of recipe
• Register Guidance Package Popup was not available on Microsoft Visual Studio 2008 Experimental hive.
• Can't install GAT on VS2008
• Calling a recipe inside another recipe???
• Register Guidance Package fails
• Web Service Software Factory - Data Types from XSD
• MetaGuidancePackage error when creating a new Guidance Package or Solution
• GAT Documentation/Walkthroughs