These procedures show you how to create a modeless dialog box assembly, in Microsoft System Center Configuration Manager 2007, by using Visual Studio.
The project has one class, Microsoft.ConfigurationManagement.AdminConsole.SmsCustomDialog. Creating the dialog box is very similar to creating a property sheet, with the exception that you get the property manager from PageData
For more information about the property manager, see How to Use Objects Passed to a Configuration Manager Form.
After you have successfully built the dialog box assembly, you must do the following to integrate it into the Configuration Manager 2007 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 property sheet.
To create the Visual Studio project
-
In Visual Studio 2005, 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 Configuration Manager\AdminUI\bin and then select microsoft.configurationmanagement.dll microsoft.configurationmanagement.managementprovider.dll and Microsoft.ManagementConsole.dll. Click OK to add the assemblies as project references. If you do not find Microsoft.ManagementConsole.dll, add it from %Windir%\System32.
-
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:
Copy Code 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:
Copy Code 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 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 2005\Projects\ConfigMgDialogControl\ConfigMgrDialogControl\bin\Debug\ConfigMgrDialogControl.dll.
-
Copy the assembly to the folder %ProgramFiles%\Microsoft Configuration Manager\AdminUI\bin.
See Also
Send comments about this topic to Microsoft.