Поделиться через


User Interface Extension Overview

 

Applies To: System Center 2012 SP1

The Virtual Machine Manager (VMM) console can be extended with view add-ins. They appear as ribbon buttons on the VMM console, but when the button is clicked, it displays a user control in the console. The user control is a Windows Presentation Foundation (WPF) 4.0 control that is provided by a Microsoft .NET 4 assembly that is included in the add-in package.

Manifest file

An entry for a view add-in must be created in the manifest file of the add-in package. This entry references the view add-in that is provided by a Microsoft .NET assembly. For more information, seeManifests. For an example of how to create a manifest entry, see How to Define a View in the Manifest.

Create a view add-in

You can build a view add-in by creating a class that inherits from the ViewAddInBase base class. Your class should then declare the T:System.Addin.AddinAttribute attribute, and it should assign the attribute a unique name between all your other add-ins.

The ribbon button for your add-in is created by the console, and it uses the manifest file to define the caption of the button. However, if you want to change the caption when your add-in is loaded, for example if you wanted to translate the text into another language, you can override the GetButtonLabelString method.

The view base class provides two methods for add-ins. The first method is CreateViewControl. This method is called when the console first displays your view add-in and it will never be called again. This method returns a Windows Presentation Foundation (WPF) FrameworkElement object instance. The object that is returned is the user control that will be displayed in the console. The console caches reference to that user control. Make sure that you cache reference to the user control too.

The second method that is provided by the view base class is SetCurrentScope. This method is called when the console changes the current context type and context object that is targeted by the view. The two objects that are passed to this method, T:Microsoft.SystemCenter.VirtualMachineManager.UIAddIns.ContextTypes.AddInContextType and T:Microsoft.SystemCenter.VirtualMachineManager.UIAddIns.ContextTypes.ContextObject are always available by the CurrentScopeType and CurrentScopeObject properties, respectively, of the add-in base class.

For more information about how to create a view, see How to Design a View.

The add-in will automatically keep reference to the

See Also

ViewAddInBase
T:Microsoft.SystemCenter.VirtualMachineManager.UIAddIns.ContextTypes.AddInContextType
T:Microsoft.SystemCenter.VirtualMachineManager.UIAddIns.ContextTypes.ContextObject
Extending the User Interface
Scenario: Create a View Add-ins
How to Define a View in the Manifest
How to Design a View