サンプル
ScopePropertyPage.cs
using System; using System.Collections.Generic; using System.Text; using Microsoft.ManagementConsole; namespace SimpleSampleMmc { /// <summary> /// User property page. /// </summary> public class UserPropertyPage : PropertyPage { private UserPropertiesControl userPropertiesControl = null; /// <summary> /// Constructor. /// </summary> public UserPropertyPage() { // Set up the property page container. this.Title = "User Property Page"; // Set up the contained control. userPropertiesControl = new UserPropertiesControl(this); this.Control = userPropertiesControl; } /// <summary> /// Initialize the notification for the page. /// </summary> protected override void OnInitialize() { base.OnInitialize(); // Populate the contained control. userPropertiesControl.RefreshData((ResultNode)this.ParentSheet.SelectionObject); } /// <summary> /// When the Apply button is clicked, this method makes the changes take effect. /// </summary> /// <returns></returns> protected override bool OnApply() { // If the control have valid values then save changes. if (this.Dirty) { if (userPropertiesControl.CanApplyChanges()) { userPropertiesControl.UpdateData((ResultNode)this.ParentSheet.SelectionObject); } else { return false; } } return true; } /// <summary> /// When the OK or Close button is clicked, this method makes the changes take effect. /// </summary> /// <returns></returns> protected override bool OnOK() { return this.OnApply(); } /// <summary> /// Indicates that the property sheet needs to be canceled. /// </summary> /// <returns></returns> protected override bool QueryCancel() { return true; } /// <summary> /// Action to be taken before the property sheet is destroyed. /// </summary> protected override void OnCancel() { userPropertiesControl.RefreshData((ResultNode)this.ParentSheet.SelectionObject); } /// <summary> /// Opportunity to perform cleanup operations. /// </summary> protected override void OnDestroy() { } } }