How to Create a Configuration Manager Dialog Box
These procedures show you how to create a modeless dialog box assembly, in Configuration Manager, by using Visual Studio.
Creating the dialog box is very similar to creating a property sheet. You create a class derived from SmsPageControl and an XML file to describe the dialog.
For more information about the property manager, see How to Use Objects Passed to a Configuration Manager Forms.
After you have successfully built the dialog box assembly, you must do the following to integrate it into the Configuration Manager console:
Define and deploy the form XML that links the selected action to the assembly you create in this topic. For more information, see How to Create Form XML for a Configuration Manager Dialog Box.
Define and deploy the action XML for displaying the context menu that the user selects. For more information, see How to Create Action XML for a Configuration Manager Dialog Box.
When you have created the dialog assembly and XML, right-click a package in the Configuration Manager console tree Packages node, and then click Show my Dialog Box. A dialog box appears with a button on it. Clicking the button displays a message box containing the name of the package you selected.
Create the Control Class
The following procedure creates the control for the dialog box.
To create the Visual Studio project
In Visual Studio 2010, on the File menu, point to New, and then click Project to open the New Project dialog box.
From the list of Visual C#, Windows projects, select the Windows Control Library project template, and type
ConfigMgrDialogControl
in the Name box.Click OK to create the Visual Studio project.
In Solution Explorer, right-click UserControl1.cs, click Rename, and change the name to ConfigMgrDialogControl.cs.
In Solution Explorer, right-click References, and then click Add Reference.
In the Add Reference dialog box, click the Browse tab, navigate to %ProgramFiles%\Microsoft Endpoint Manager\AdminConsole\bin and then select microsoft.configurationmanagement.exe, microsoft.configurationmanagement.managementprovider.dll, Microsoft.ConfigurationManagement.DialogFoundation.dll and AdminUI.DialogFoundation.dll. Click OK to add the assemblies as project references.
In Solution Explorer, right-click ConfigMgrDialogControl.cs and then click View Code.
In the source code, change the namespace to
Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrDialogBox
Change the class
ConfigMgrDialogControl
so that it derives fromSmsCustomDialog
.In Solution Explorer, right-click ConfigMgrDialogControl.Designer.cs and then click View Code.
In the source code, change the namespace to
Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrDialogBox
Change the class
ConfigMgrDialogControl
so that it derives fromSmsCustomDialog
.In ConfigMgrDialogControl.cs, add the following code to initialize the control:
public override bool Initialize(System.Reflection.Assembly assembly, SmsFormData formData, SmsPageData pageData) { base.Initialize(assembly, formData, pageData); return true; }
In Solution Explorer, right-click ConfigMgrDialogControl.cs and select View Designer.
In the Toolbox, click the Common Controls tab, and then double-click Button. A button named button1 is added to your control on the User Control Designer.
In the User Control Designer, double-click button1 and type the following code in the button1_Click method source code displayed:
MessageBox.Show( PageData.PropertyManager["Name"].StringValue);
Deploy the Assembly
The following procedure builds and copies the assembly that you have created to the Configuration Manager console assemblies
folder. For important information about deploying Configuration Manager console extensions, see About Configuration Manager Console Extension Deployment.
To deploy the dialog box assembly
Build the project, and depending on where you created your project, your Visual Studio installation, the assembly is created as \Visual Studio 2010\Projects\ConfigMgDialogControl\ConfigMgrDialogControl\bin\Debug\ConfigMgrDialogControl.dll.
Copy the assembly to the folder %ProgramFiles%\Microsoft Endpoint Manager\AdminConsole\bin.
See Also
How to Add a Property Page to an Existing Configuration Manager Property Sheet
How to Create Action XML for a Configuration Manager Property Sheet
How to Create Form XML for a Configuration Manager Property Sheet
How to Use Objects Passed to a Configuration Manager Forms