Example #1
0
        private void Insert(SnapinNode parent, IntPtr nextHScopeItem)
        {
            GetImageIndices();
            Snapin.EnsureImages();

            IConsoleNameSpace2 ns   = Snapin.ConsoleNamespace;
            ScopeDataItem      item = new ScopeDataItem();

            item.Mask = (uint)ScopeDataItemFlags.Str
                        | (uint)ScopeDataItemFlags.Param
                        | (uint)ScopeDataItemFlags.Next
                        | (uint)ScopeDataItemFlags.Image
                        | (uint)ScopeDataItemFlags.OpenImage
                        | (uint)ScopeDataItemFlags.Children;

            item.Image       = m_closedImageIndex;
            item.OpenImage   = m_openImageIndex;
            item.RelativeId  = nextHScopeItem;
            item.DisplayName = (IntPtr)(-1);
            item.Param       = Cookie;
            item.Children    = HasChildren() ? 1 : 0;

            // Expand the parent node before adding the child.

            ns.Expand(parent.HScopeItem);
            ns.InsertItem(ref item);
            HScopeItem         = item.Id;
            m_parentHScopeItem = parent.HScopeItem;
            m_parentNode       = parent;
        }
Example #2
0
        public void ImageChanged()
        {
            // Only try to update if the item has already been inserted and the images have changed.

            if (GetImageIndices() && HScopeItem != IntPtr.Zero)
            {
                ScopeDataItem item = new ScopeDataItem();
                item.Id        = HScopeItem;
                item.Mask      = (uint)ScopeDataItemFlags.Image | (uint)ScopeDataItemFlags.OpenImage;
                item.Image     = m_closedImageIndex;
                item.OpenImage = m_openImageIndex;

                IConsoleNameSpace2 ns = Snapin.ConsoleNamespace;
                ns.SetItem(ref item);

                // If this node is currently shown in the result view also update all the result images.
                // There is no correlation between a scope node and a result node, so all result nodes must
                // be checked.

                if (m_snapin.CurrentScopeNode == m_parentNode)
                {
                    ResultNode parentResult = m_parentNode as ResultNode;
                    if (parentResult != null)
                    {
                        parentResult.UpdateResultImages();
                    }
                }
            }
        }
Example #3
0
        internal void GetDisplayInfo(ref ScopeDataItem item)
        {
            // Display name.

            if ((item.Mask & (uint)ScopeDataItemFlags.Str) > 0)
            {
                item.DisplayName = Marshal.StringToCoTaskMemUni(DisplayName);
            }

            // State.

            if ((item.Mask & (uint)ScopeDataItemFlags.State) > 0)
            {
                item.State = 0;
            }

            // Image.

            if ((item.Mask & (uint)ScopeDataItemFlags.Image) > 0 || (item.Mask & (uint)ScopeDataItemFlags.OpenImage) > 0)
            {
                GetImageIndices();

                if ((item.Mask & (uint)ScopeDataItemFlags.Image) > 0)
                {
                    item.Image = m_closedImageIndex;
                }
                if ((item.Mask & (uint)ScopeDataItemFlags.OpenImage) > 0)
                {
                    item.Image = m_openImageIndex;
                }
            }

            // Children.

            if ((item.Mask & (uint)ScopeDataItemFlags.Children) > 0)
            {
                item.Children = ChildCount;
            }
        }
Example #4
0
 /// <summary>
 /// Provides scope pane info to MMC.
 /// </summary>
 void IComponentData.GetDisplayInfo(ref ScopeDataItem item)
 {
     FindNode(item.Param).GetDisplayInfo(ref item);
 }