Visual C ++. NET wizard (end)

xiaoxiao2021-03-06  72

Creating a Wizard for Developing Web Application Using Managed C In this section, we'll look at how to create a custom application wizard that generate a Web application using ASP.NET and managed C . We'll look at the details involved in writing a Web Forms applications using ASP.NET and managed C in the second half of the book. For now, we'll create an application wizard that can generate Web Forms applications. A Web Forms application involves several different kinds of files to be generated. in addition, we can add several options such as tracing / debugging options and include several kinds of controls to see how the application wizard works. The files included in the Web Forms application include source code for a Managed C DLL, an ASP.NET (ASPX ) files, a Web.Config file, and a Visual Studio Solution file. Each of these files will need to contain a couple of different substitutions made by the application wizard. We'll create our wizard using the Custom Wizard. As mentioned, t he Custom Wizard is a canned Visual Studio.NET wizard that creates a custom wizard. The name of the sample wizard for this chapter will be ManagedCWebForm-Wizard. The wizard will have a user interface consisting of one page in this example to make the sample More Digestible. Using the Wizard for Developing a Web Application in Hosting C In this section, we will use ASP.NET and managed C to generate a wizard of a web application. In the second half of this book I will see ASP.NET and hosting C Write a Web Form Application. Now we will generate a wizard of a web form application .Web application includes several special nature files. In addition, I can add individual options such as tracking / debug options, including Individual nature controls to see how the application wizard works. Web Form Application includes hosting C

DLL source code, some ASP.NET (ASPX) files, a web.config file, and a VS solution file. These files will need to replace the connection between the wizard.????

We build your own wizard with a custom wizard. Like mentioned, the Custom Wizard is a custom wizard established by VS.NET wizard. The name of this sample wizard is MANAGEDCWEBFORM-Wizard. This example is very simple. easy to digest, it consisting of one page of the user interface. the user interface itself will include check boxes for adding controls to the page and for turning on debugging and tracing options. Solution Explorer lets you get to the HTML page representing the wizard user interface. Editing this page is much like editing normal dialog boxes. You can select a control from the Toolbox on the left side of the Visual Studio .NET's IDE, place the control on the page, and set its properties using the Properties window. The wizard has six check boxes on the interface page. Three of the check boxes will manage the controls on the Web Form-one each for adding a CheckBox control to the Web Form, for adding a Label control, and for adding a TextBox control. You can use THE TEXTBOX CHECK HAS AN ID of UseTextBox, The Label Check Box Has An ID of UseLabel, And The Checkbox Check Box An id of usecheckbox .hen the wizard generate the code, it looks for these Symbols to add code to the aspx page and the code page you will add a selection box control option that tracking debugging on the page. Solution Let you get The HTML page wizard user interface. Edit this page is like editing a general dialog. You can select a control from the toolbar on the left of the vs.net IDE, place the control on the page or set in the Properties window. Its properties. This wizard has six option box on the user interface. The three options box will manage the control of the web form. Each additional check box control to the web form, add a Label control and text control. You You can provide a id.Textbox check box for each window in the Properties window to use the ID.TextBox, the ID of the Label box is called UseLabel, checkbox is called Useckbox. When the wizard generates code, you can see these symbols in the ASPX Corcup page The occurrence. The Three Other Check Boxes Are for Managing Debug Options:

one for page tracing, one fro request tracing, and one to turn on debugging. The check boxes have Ids of UsePageTracing, UseRequestTracing, and UsePageDebugging. As with the user interface page, the wizard will look for these symbols to add the right code to the generated project. Figure 4-1 shows default.htm, the user interface page, as it will appear in the finished wizard. Once the controls are on the page, they need to be associated with symbols that the wizard can use to make substitutions HAS A BLOCK OF SYMBOL ENTRIES. You THEN MODIFY THE SYMBOLS for the Web Application Wizard, AS Shown Here: This pick box is the management debug option, a page tracking, A request tracking, a startup, and debug. These check boxes are UsepageTracing, UseRequestTracing, and UsePageDeBugging. Similarly to the user interface, the wizard will look for these symbols and add the correct code to the project. Figure 4-1 Show The default.htm. User interface, the same will appear in the finish wizard. Once the control is on the page, they need the wizard to use the replacement symbol to join them. The default user interface (default.htm) of the wizard has a whole symbol. You These symbols can be modified on the Web Application Wizard, as shown below:

Notice that each of these symbols is associated with a check box on the wizard user interface page. The next step is to take the original source code and insert annotations where you want the wizard to add replacement code. Once we have the original boilerplate code, . all the original boilerplate source code for the wizard will live under the Templates directory for that wizard The final ManagedCWeb-Form will need to include three files: the header file containing the C class, the ASPX file containing the Web page layout information, and the Web.Config file containing the configuration settings. The boilerplate code for these files will be included in the Template directory for the wizard. Let's take a look at the boilerplate code the wizard will use to generate the applications. Here's the code for the C Header File: Note that each symbol is associated with Check Box on the wizard user interface. The next step is to organize the source code and insert a comment to replace the code where you want to replace the code in the wizard. Once you are ready for the sample file, all The sample source code will be under the wizard template directory. The completed managedcWeb-Form must contain three files: a header containing the C class, a ASPX file containing the web planning information, a match with configuration information Set file. These files will also include template directories in the wizard. Let me look at the wizard to use this file to generate the application. These code is in the C header file: // managedcwebform.h #pragma ONCE Using Namespace System ; # using # using

using namespace System; using namespace System :: Web; using namespace System :: Web :: UI using namespace System :: Web :: UI :: WebControls; using namespace System :: Collections; using namespace System :: ComponentModel; namespace ProgVSNET_ManagedCWebForm { public __gc class ManagedCWebPage: pulbic Page {public: Button * m_button; Label * m_label; Textbox * m_text; Checkbox * m_check; [[if UseLabel!] [endif!] [if UseTextBox!] [endif!] [if UseChockBox!] ! endif] ManagedCWebPage () {// To do: Construction code here ...} void SubmitEntry (Object * o, EventArgs * e) {// Called when Submit button pressed // To do: insert Page Loading code here ... String * Str ; Str = new sting ("Hello"); str = str-> concat (str, m_text-> get_text ()); str = str-> concat (STR, New String ("You Pushed Submit"); [! IF useElabel] m_label-> set_text (str); [! if useelabel]} void page_load (Object * O, Eventargs * e) {// to do: insert Page Loading code Here ... [! ing users) Trace-> Write "Custom", "Inside Page_Load"); [! Endif] if (! Ispostback) {}}}};

转载请注明原文地址:https://www.9cbs.com/read-88180.html

New Post(0)