Probe into the "longhorn" application development deployment (1)

zhaozj2021-02-11  167

Author: Dino Esposito translation: winsome zhong

In all respects, Microsoft's next-generation window is a very important milestone in the Windows product. "Longhorn" is the first operating system built with the hosted code, which uses Microsoft's latest storage subsystem "Winfs", supports a more advanced natural search technology (Natural UI) and the latest security architecture "Palladium", "Palladium", Windows history, I remember only two such important milestones, one is the migration of Windows from 16-bit to 32-bit, and the other is the birth of .NET. Of course, "Longhorn" is an exciting new feature that we have also shown that we will have a major change in the development method of driving (Oh, the resentment of the microsoft development technology and development tools is too many, but I complained that I believe that "Longhorn" new development model will definitely make you spiritual). One of these most important changes is "longhorn" to make the application can be encoded once, multiple scenes deploy. To implement this function, "longhorn"-based app is fully object-to-object, and the entire application is derived from a core object Application, which provides all core functions required to run the entire application. This article will lead you to experience the latest Longhorn application model and demonstrate some basic examples, including the classic "Hello World!".

First, the LONGHORN Application Model Application object is the core of the longhorn application model. Through its properties, methods, and events, you can use a enhanced HTML like a web page to write traditional Windows Forms applications. Application is the root object of a longhorn application. It provides the basic feature of the application, which can be used for some low-level, no programs that need to navigate and maintain status between forms, but more complex LONGHORN applications use NavigationApplication objects, which is an Application's subclass, added Support for navigation. A typical longhorn app can be seen as a page with a program script (called Page) and executed by the Application object control program. Page uses a new tag language to write, this tag language code is "Extensible Application Markup Language). Element tab by XAML You can control the layout of Page, including display text and images, insert buttons, text baskets, and other interactive controls. One words, "XAML" is a tag language for writing a Longhorn application UI interface. Of course, in addition to using XAML, you can also use program code to write applications. Generally, the longhorn program will use XAML and managed code at the same time. You can combine them in your own way. Using XAML and C # (or VB.NET), you can build various types of application output files, traditional EXE execution files, DLL libraries, or Console applications. Moreover, if your app is simple enough, you can also use a separate XAML tag to write it so that there is more types of programs in Longhorn. When the stand-alone XAML file does not quote other background classes, it can run directly in the longhorn shell and browsers. In fact, Longhorn's executable can run in Windows, or in the browser, you don't need any modifications to the code code, just set different item properties when compiling. For Longhorn, the executable is the next version of today's Windows Form Program. However, from another aspect, XAML and browser-based applications also represent an application as an innovation for the development model of the web client. Currently, Windows Forms client programs are rarely published on the web, because if you want to embed the Windows Form into your browser page, you will be subject to a lot of restrictions, but also modify the code. In Longhorn, the general application model allows you to write a program and deploy it through the web. However, this is a great difference with our traditional web applications (such as ASP.NET), which is the LONGHORN proprietary application. When you compile an app, the next version of "whidbey" will generate a .exe file, a list of files, a program file list (extension is .manifest and a deployment file list (extension is .deploy). When you click .exe file, the program will run in Windows as you expect. But if the program is set to run in the browser, IE will automatically jump out and run the program in it.

There is also an optional way to deploy the program on the remote server. The steps are as follows, first copy the .deploy file to the server's proper position, can be the relative path of FTP or HTTP. Then copy the compiled program file and .manifest to the server, the program file, the .manifest file is not necessarily to be put together with the.deploy file. If you put it in a different place, you can edit the .deploy file so that it points to the .manifest file. The .manifest file and .deploy file are XML files. When the user accesses the deployment file via the browser, Longhorn automatically downloads the program file and the .manifest file and install it on the user's computer, and create a shortcut to the.dePloy file. The user can execute the program by clicking the .deploy file. All universal structures for all Longhorn applications are: XAML Page couples program code (embedded or using code behind technology), root objects are derived from Application. The Application object is the controller of the program, its lifecycle, and the life cycle of the program. With Application objects, you can handle advanced events, shared code and status between PAGE, and more. It is also responsible for the logic of the procedure to make the user navigate in Page. When the user uses the software to complete the function, it will jump back and forth between Page. Longhorn will usually use the new Page to replace the old, of course, you can also choose A new window is popping up to display the new page. Navigation is not required for each program, simple only one page program is not required. Just mentioned that XAML Page can embed program code as a tag supplement. The program code is required, such as processing an event generated by the XAML element. The program code can be embedded in the XAML file or in the code file. LONGHORN's programming is based on managed code, but there are only several compatible .NET language that can be used to write XAML-based programs, including C #, VB.NET, and JScript.net, when you are published, other compatible .NET language It will also be included in it. It is currently only used in these three languages ​​because the source code of the XAML file needs to be compiled. Therefore, the compiler and related code document object model must be ready before (Note: If you complete the program code To write programs, you can use any .NET language, but XAML-based programs can only use these three more items). If the program code is embedded in XAML Page, you must compile it first to run it. And if there is no program code in XAML Page, you can display it, just like an HTML file. Longhorn does not execute uncharacted program code, nor does it compile it at runtime.

So let's take a look at Longhorn version of "Hello World!", This is the simplest XAML example: Hello, Longhorn! Save this code in a text file and use .xaml as an extension, then double-click, open it with your browser, Figure one is The result you can see. The node defines the user interface area of ​​the program - canvas. The Background property defines the background color of the canvas, Width and Height specify the size of the canvas, the , and elements define the contents of the Page. The LEFTs and TOP properties of these two elements specify their absolute positions relative to the upper left corner of the PAGE. Figure 1. Simple Xaml Page

Second, understanding that longhorn application Longhorn provides a range of frameworks, extended, and enhances the function of .NET Framework1.1, including support, application model, trusted computing and advanced web services for XAML and new storage subsystems. Wait. In Microsoft's plan, Longhorn and Whidbey represent two different milestones, which will release a few months before the Longhorn released, and will also release a WHIDBEY upgrade version to provide Longhorn's core services. Let's take a look at all public base of all longhorn applications - xaml language. XAML language is an XML-based language for describing programs user interfaces. Developers who are familiar with WIND32 or .NET Framework can immediately see the similarities of XAML and traditional Windows controls. However, the XAML tags are more abstract and extensive than the Wind32 control and Windows form controls. Think about the ASP.NET page, or, more specific, you can imagine a service-side control (Runat = "Server") ASP.NET page, which is a bit similar to XAML Page. Each XAML tag corresponds to one .NET framework class, including many methods, properties, events. You can set the properties directly to set the properties, write events, or you can do this in the Code-BEHIND code. In the program running period, the control corresponding to each tag is instantiated and the output is displayed in the canvas. From the highest level abstraction, this model is very like ASP.NET, but this model can work in a wider range of Windows platforms, not like ASP.NET is limited to Web programs. Each XAML tag corresponds to one .NET framework class, but there are many classes without a corresponding XAML tag, which is an abstract class for inheritance. Anything created with XAML can be created with program code, such as creating a button with XAML, you can use the following script:

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

New Post(0)