Наследование: SharedDataItemBase
 /// <summary>
 /// Extension class to extend the Computer Management snap-in property sheet
 /// </summary>
 public ExtensionToPropertySheet()
 {
     // In order to receive published data from the primary snap-in, MMC needs to know which
     // data items the extension is interested in.
     sharedDataItem = new SharedDataItem(@"MMC_SNAPIN_MACHINE_NAME");
     this.SharedData.Add(sharedDataItem);
 }
            this.Control = machinePropertiesControl;
        }

		/// <summary>
		/// Initialize notification for the page. Default implementation is empty.
		/// </summary>
		protected override void OnInitialize()
		{
            machinePropertiesControl.RefreshData(sharedDataItem);
        }

		/// <summary>
		/// Sent to every page in the property sheet to indicate that the user has clicked 
		/// the Apply button and wants all changes to take effect.
Пример #3
0
 protected virtual void OnSharedDataChanged(SharedDataItem item)
 {
 }
        /// <summary>
        /// The DisplayName of the extension node will be the computer name 
        /// published by the primary.  Note: this defaults to an empty string for localhost.
        /// </summary>
        void SetDisplayName(ScopeNode scopeNode, SharedDataItem sharedDataItem)
        {
            // get buffer containing the machine name
            string machineName = Encoding.Unicode.GetString(sharedDataItem.GetData());

            // find first null terminated string in buffer.
            if (machineName.IndexOf('\0') <= 0)
            {
                // either not found in buffer or first entry in buffer
                machineName = String.Empty;
            }
            else
            {
                machineName = machineName.Substring(0, machineName.IndexOf('\0'));
            }

            // if empty then localhost
            if (machineName == string.Empty)
            {
                scopeNode.DisplayName = "Sample Extension to (localhost)";
            }
            else
            {
                scopeNode.DisplayName = "Sample Extension to (" + machineName + ")";
            }
        }
 /// <summary>
 /// Respond to changes in shared information from the primary
 /// </summary>
 /// <param name="sharedDataItem">shared data</param>
 protected override void OnSharedDataChanged(SharedDataItem sharedDataItem)
 {
     // if the machine name has changed, update the extension node name
     if (sharedDataItem.ClipboardFormatId == machineNameClipboardFormatId)
     {
         SetDisplayName(extensionRootNode, sharedDataItem);
     }
 }
Пример #6
0
 /// <summary>This will get called when the user chooses to monitor a different computer other than
 /// the Local Machine.</summary>
 protected override void OnSharedDataChanged(SharedDataItem sharedDataItem)
 {
     // If the machine name has changed, Update the Local Name. OnInitialize will get called again!
     if (sharedDataItem.ClipboardFormatId == SnapInShared.MachineName)
     {
         MachineName = Encoding.Unicode.GetString(sharedDataItem.GetData());
     }
 }