Smart Clients: New Guidance And Tools For Bui...

来源:百度文库 编辑:神马文学网 时间:2024/05/01 03:40:11
Before diving deeper into Integrated Desktop technology, you must first understand the basic terminology.
CAB  provides the framework and guidance necessary to help you build complex, loosely coupled, smart clients that provide run-time composability.
Context  refers to shared data that is common to multiple applications. Context information is used to relate information from part to part, even when those parts are contained in hosted sub-applications within the composite UI.
Dependency Injection  is a design pattern implemented by the patterns & practices Object Builder for dynamically injecting object implementation into the composite UI at run time. This is an implementation of a design pattern by Martin Fowler, sometimes referred to as Inversion of Control.
Event Broker  is a component-to-component communication mechanism within the smart client which uses a publisher/subscriber model that allows any CAB part to communicate with other parts within the entire composite UI.
Module  refers to the deployment unit for CAB applications. Modules are contained in assembly files (DLLs) and can include one or more sub-applications that will be hosted by the composite UI. A composite UI may load any number of modules.
Smart Client Software Factory  is an integrated collection of guidance artifacts (reference implementations, patterns, how-to documents, Guidance Automation Toolkit packages, architecture documentation, and code assets) that leverage CAB and the Enterprise Library to develop complex smart clients.
Smart Client Service  is a client-side service that provides the common plumbing for smart client parts, such as security, deployment, themes, and so on.
Smart Part (View)  is a reusable composite interface that provides the view component of the model-view-controller or model-view-presenter pattern used by CAB and the Smart Client Software Factory. (The Smart Part attribute simply enables Visual Studio consumption. User controls can be used in most cases).
Theme  refers to the look of the GUI elements, affecting the layout on the desktop. This is similar to ASP.NET themes, but specifically for smart clients. CAB Workspaces (or layout managers) are used to control Themes in the Smart Client Software Factory.
UI Elements  are general interface controls used for shell navigation elements. Examples include menu items, toolbar items, and custom navigation components. UI elements can be associated with commands and can be dynamically controlled by any sub-application at run time.
Work  Item is the CAB container used for holding references to CAB components, such as Smart Parts, events, services, shared data, workspaces, commands, and other work items. Each defined work item typically drives a specific feature set or "use case" for a sub-application.
Create a new Windows Form application. Add the following assembly references to your project: Microsoft.Practices.CompositeUI Microsoft.Practices.CompositeUI.WinForms Microsoft.Practices.ObjectBuilder Create an application class that specifies the WorkItem (the default is RootWorkItem) to be used and the Windows Form to be displayed. To create a class called MyWorkItem, simply inherit from the CAB class called WorkItem: public class MyFirstCABApplication : FormShellApplication { } Implement your application’s Main method, create the application instance, and call Run: [STAThread] public static void Main() { new MyFirstCABApplication().Run(); } Override AfterShellCreated, call its base implementation, and initialize your interface: protected override void AfterShellCreated() { base.AfterShellCreated(); // register extension site, in this case a File Menu ToolStripMenuItem fileItem = (ToolStripMenuItem) Shell.MainMenuStrip.Items["File"]; MyWorkItem.UIExtensionSites.RegisterSite( "File", fileItem.DropDownItems); // create and add menu items to the File Menu site ToolStripMenuItem item = new ToolStripMenuItem("Show Customer"); MyWorkItem.UIExtensionSites["File"].Add(item); // add a click event handler to the menu item called ShowCustomer MyWorkItem.Commands["ShowCustomer"].AddInvoker(item, "Click"); } Create a Smart Part. To do this, add a user control to your project and add a reference to the Microsoft.Practices.CompositeUI.SmartParts namespace. Then add the SmartPart attribute to your class: [SmartPart] public partial class CustomerSmartPart : UserControl { ... } Add the command handler and display the Smart Part by using a DeckWorkspace: [CommandHandler("ShowCustomer")] public void ShowCustomer(object sender, EventArgs e) { Form1 mainForm = new Form1(); CustomerSmartPart sp = MyWorkItem.Items.AddNew(); mainForm.deckWorkspace1.Show(sp); // deckWorkspace1 is a DeckWorkspace control dragged onto Form1 }
Any of the CAB Workspaces can be added to the toolbox and dragged over to the design surface like any other control.
 
Create a class library or control library. Add references to: Microsoft.Practices.CompositeUI Microsoft.Practices.ObjectBuilder Add a ModuleAttribute to your project to help other modules identify it in code. Add the following to your AssemblyInfo.cs file: [assembly: Microsoft.Practices.CompositeUI.Module("MyFirstModule")] Create a new public class in this project and inherit from Microsoft.Practices.CompositeUI.ModuleInit. Override AddServices to add CAB services at run time and override Load to display any UI. To get your module to load at run time, create an XML file called ProfileCatalog.xml that references your new module DLL file. Add this XML file to the main EXE project (the shell we just created). A typical profile catalog looks like this: If you want, you can plug in your own service to use your preferred profile catalog format. Add a Load method and implement it from within your new ModuleInit class. The code that follows will create an instance of your module’s WorkItem within the context of the RootWorkItem using the AddNew method. It then calls the Run method of the new WorkItem. You retrieve the Workspace using its name and pass this Workspace to the Run method. In this example, the target is the DeckWorkspace named deckWorkspace1: public override void Load() { base.Load(); RootWorkItem RootWorkItem = RootWorkItem.WorkItems.AddNew(); RootWorkItem.Run(parentWorkItem.Workspaces["deckWorkspace1"]); } To get your code to run in response to your WorkItem being run, implement the Run method of your RootWorkItem class, as shown here: public void Run(IWorkspace deckWorkspace) { IMyView view = this.Items.AddNew(); // use any smart part deckWorkspace.Show(view); }
Smart Clients: New Guidance And Tools For Bui... Smart Clients: New Guidance And Tools For Bui... Microsoft releases new tools for academics Third Party documentation Tools for Java and Other Languages Installing and Configuring Windows Server 2003 RADIUS Support for VPN Clients ? Online Tools and Software for Task Lists and To Do Lists - Perfect for Freelancers Listing of Del.icio.us Tools, Plugins and Add-ons for Social Bookmarking ‘Change, Culture, Creativi free online templates, samples, examples, articles, resources and tools for business training and organizational development - free downloads Get smart: Top 10 research tools - Internet Web 2.0: A New Wave of Innovation for Teaching and Learning? Mobile banking a new focus for NCR, Wincor Nixdorf and Diebold 电动版Smart For Two Listing of Del.icio.us Tools, Plugins and Add-ons for Social Bookmarking ‘Change, Culture, Creativity, Communication’ 团队学习中进行深度汇谈的方法与工具(The Methods and Tools of Dialogue for Community Learning ) Project Planning Tools for IT Project Management TOP 100 TOOLS FOR LEARNING 2007 100 Essential Web Tools for Homeschoolers Top Web Tools for College Students (转) A Web Middleware Architecture for Dynamic Customization of Content for Wireless Clients Open Intelligence Data Tools and Software Project Management Tools and Templates Directory Open Intelligence Data Tools and Software Inspirational Tips and Tools from a Designer New strategies for consumer goods