Compartilhar via


How to Create a Configuration Manager Console View

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

In Microsoft System Center Configuration Manager 2007, to create a Configuration Manager console view, you create a .NET Framework assembly that inherits from the following classes:

Class Description

SmsFormViewControlBase

Defines the control that the user sees in the Configuration Manager 2007 console results pane.

SmsFormViewBase

Provides access to the query processor, refresh operations, and action processing.

ViewDescriptionBase

Provides information about the view.

The following procedures create an empty view control. Later you create the node XML that is necessary to integrate the view into the Configuration Manager console, the functionality to display the SMS Provider namespace classes, and the functionality to list the object instances of a selected class.

After you have finished the procedures in this topic, perform the procedure in How to Create Node XML for a Configuration Manager Console View. You can then see the empty control in the Configuration Manager console under the Tools console tree node.

Next, perform the procedures in How to Use Objects Passed to a Configuration Manager Console View. This procedure adds the functionality to display the class instances in a DataGridView control.

Create the Control Class

The following procedure creates the SmsFormViewControlBase derived class that implements the control for the view.

To create the Visual Studio project

  1. In Visual Studio 2005, on the File menu, point to New, and then click Project.

  2. In the New Project dialog box, select the Windows Control Library project template from the list of Visual C#, Windows projects, and type ConfigMgrObjectsControl in the Name box.

  3. Click OK to create the Visual Studio project.

  4. In Solution Explorer, right-click UserControl1.cs, click Rename, and then change the name to ConfigMgrObjectsControl.cs.

  5. In Solution Explorer, right-click References, and then click Add Reference.

  6. In the Add Reference dialog box, click the Browse tab, navigate to %ProgramFiles%\Microsoft Configuration Manager\AdminUI\bin, and add the following references:

    • microsoft.configurationmanagement.dll

    • microsoft.configurationmanagement.managementprovider.dll

    • Microsoft.ManagementConsole.dll.

    • Adminui.common.dll

    Click OK to add the assemblies as project references.

  7. In Solution Explorer, right-click ConfigMgrObjectsControl.cs, and then click View Code.

  8. In the source code, add the following directives:

    using System.Xml;
    using Microsoft.ConfigurationManagement;
    using Microsoft.ConfigurationManagement.AdminConsole;
    using Microsoft.ConfigurationManagement.AdminConsole.Common;
    using Microsoft.ConfigurationManagement.AdminConsole.Schema;
    using Microsoft.ConfigurationManagement.ManagementProvider;
    using Microsoft.ManagementConsole;
    
  9. Change the namespace to Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrObjectsView.

  10. Change the class ConfigMgrObjectsControl so that it derives from the SMSFormViewControlBase class.

  11. In Solution Explorer, right-click ConfigMgrObjectsControl.Designer.cs, and then click View Code.

  12. In the source code, change the namespace to Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrObjectsView.

  13. In ConfigMgrObjectsControl.cs, add the following to the ConfigMgrObjectsControl constructor after the call to InitializeComponent:

        Dock = DockStyle.Fill;
    
  14. Add the following two properties to the ConfigMgrObjectsControl class:

    protected ConsoleParentNode Node
    {
        get
        {
            return FormViewControl.ScopeNode as ConsoleParentNode;
        }
    }
    protected ConfigMgrObjectsFormView FormViewControl
    {
        get
        {
            return NodeFormView as ConfigMgrObjectsFormView;
        }
    } 
    

Create the Form View Class

The following procedure creates the SmsFormViewBase derived class.

To create a form view class

  • In ConfigMgrDialog.cs, add the following new class in the Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrPropertySheet namespace:

    public class ConfigMgrObjectsFormView : SmsFormViewBase
    {
        public ConfigMgrObjectsFormView()
        {
            this.DescriptionBarText = @"";
        }
    }
    

Create the View Description Class

The following procedure creates the ViewDescriptionBase derived class.

To create a view description class

  • In ConfigMgrDialog.cs, add the following new class in the Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrPropertySheet namespace:

    public class ConfigMgrObjectsViewDescription : ViewDescriptionBase
    {
        override protected Type TypeOfControl { get { return typeof(ConfigMgrObjectsControl); } }
        override protected Type TypeOfView { get { return typeof(ConfigMgrObjectsFormView); } }
        protected override string DisplayName
        {
            get
            {
                return "Objects view";
            }
        }
        override protected string LanguageIndependentName { get { return "ConfigMgrObjectsViewControl"; } }
        public override bool TryConfigure(ref XmlElement persistedConfigurationData)
        {
            return false;
        }
        new public bool TryInitialize(ScopeNode scopeNode, AssemblyDescription resourceAssembly, ViewAssemblyDescription viewAssemblyDescription)
        {
            return true;
        }
    }
    

Deploy the Assembly

The following procedure builds the assembly you have created and copies it 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

  1. Build the project, and depending on where you created your project, the assembly should be created as \Visual Studio 2005\Projects\ConfigMgrControl\ConfigMgrObjectsControl\bin\Debug\ConfigMgrObjectsControl.dll.

  2. Copy the assembly to the %ProgramFiles%\Microsoft Configuration Manager\AdminUI\bin folder.

See Also

Concepts

About Configuration Manager Console Views
How to Create Node XML for a Configuration Manager Console View
How to Use Objects Passed to a Configuration Manager Console View