Beispiel #1
0
        private void DeleteNode()
        {
            try
            {
                // Prompt.

                if (PromptForDelete())
                {
                    using (new LongRunningMonitor(Snapin))
                    {
                        // Let the derived class respond.

                        Delete();

                        // Remove from parent and remove from the display.

                        m_parentNode.RemoveChild(this);
                        Snapin.Unregister(this);
                        DeleteItem();
                    }
                }
            }
            catch (Exception e)
            {
                new ExceptionDialog(e, "Cannot delete '" + m_displayName + "'.").ShowDialog(Snapin);
            }
        }
Beispiel #2
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;
        }
Beispiel #3
0
        protected void DeleteChildNode(SnapinNode node)
        {
            // Delete the item and unregister the node.

            node.DeleteItem();
            Snapin.Unregister(node);
            RemoveChild(node);
        }
Beispiel #4
0
        private void DeleteChildNodes()
        {
            foreach (SnapinNode node in m_childNodes)
            {
                // Delete the item and unregister the node.

                node.DeleteItem();
                Snapin.Unregister(node);
            }

            m_childNodes.Clear();
        }
Beispiel #5
0
        public LongRunningMonitor(Snapin snapin)
        {
            if (snapin == null)
            {
                throw new ArgumentNullException("snapin");
            }

            m_snapin = snapin;

            // DO NOT call DoEvents() in this method. This causes re-entracy problems in IComponent.Notify()
            // and IComponentData.Notify() in the snap-in.

            m_snapin.Cursor = Cursors.WaitCursor;             // Display an hourglass.
            // Need to set the current cursor as well, otherwise the above has no effect.
            Cursor.Current = Cursors.WaitCursor;
        }
Beispiel #6
0
        protected SnapinNode(Snapin snapin)
        {
            m_snapin           = snapin;
            m_parentNode       = this;
            m_cookie           = snapin.Register(this);
            m_hScopeItem       = IntPtr.Zero;
            m_parentHScopeItem = IntPtr.Zero;
            m_childNodes       = new ArrayList(8);
            m_nodeSelected     = false;
            m_control          = new NodeControl(this);

            // Add images.

            m_closedImageIndex = snapin.AddImage(Constants.Icon.DefaultClosed);
            m_openImageIndex   = snapin.AddImage(Constants.Icon.DefaultOpen);
        }
Beispiel #7
0
        public void Refresh(bool childNodesChanged)
        {
            if (childNodesChanged)
            {
                ResetChildNodes();
            }

            ImageChanged();

            if (m_snapin.CurrentScopeNode == this)
            {
                Snapin.Refresh();
                RefreshChildItems();
                RefreshResults();
            }
            else
            {
                RefreshChildItems();
            }
        }
Beispiel #8
0
 public OcxNode(Snapin snapin, System.Guid ocxGuid, bool createNew)
     :       base(snapin)
 {
     m_ocxGuid   = ocxGuid;
     m_createNew = createNew;
 }
Beispiel #9
0
 public Component(Snapin snapin)
 {
     m_snapin = snapin;
 }
Beispiel #10
0
 private bool PromptForDelete()
 {
     return(Snapin.MessageBox(GetDeletePromptText(), "Confirm deletion", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK);
 }
Beispiel #11
0
 internal virtual void OnAddResultPaneImages(IImageList il)
 {
     Snapin.EnsureImages();
     Snapin.Images.LoadImageList(il, 0);
 }
Beispiel #12
0
 protected int AddResultImage(string image)
 {
     return(Snapin.AddImage(image));
 }
Beispiel #13
0
 protected ResultNode(Snapin snapin)
     :       base(snapin)
 {
     m_resultSelected = false;
 }