Exemplo n.º 1
0
        /// <summary>
        /// Add child nodes during expansion 
        /// </summary>
        private void Expand()
        {
            int foundChildren = 10;

            // report progress
            expandStatus.ReportProgress(0, foundChildren, "Loading Sample children...");

            // find results
            for (int child = 1; child < foundChildren; child++)
            {
                // The Thread.Sleep statement below is for demo purposes only. When doing your 
                // development you should not block your snap-in thread to service an 
                // async request like OnExpand unless you only use the scope tree and 
                // list view and never show any WinForms views or WinForms property pages.  
                // The reason is that your WinForms views and property pages will be blocked, 
                // and in certain cases that can also block MMC.  

                // sleep for a second
                Thread.Sleep(1000);

                // New scope nodes must be created on the snapin's thread
                DelegateWithNode delegateWithNode = new DelegateWithNode(AddChildNode);
                this.SnapIn.BeginInvoke(delegateWithNode, new object[] {this});

                // update the progress
                expandStatus.ReportProgress(child, foundChildren, "Loading Sample children...");
            }

            // update progress
            expandStatus.Complete("Loading Sample complete.", true);
        }
        /// <summary>
        /// Add child nodes during expansion 
        /// </summary>
        private void Expand()
        {
            int foundChildren = 10;

            // report progress
            expandStatus.ReportProgress(0, foundChildren, "Loading Sample children...");

            // find results
            for (int child = 1; child < foundChildren; child++)
            {
                // The Thread.Sleep statement below is for demo purposes only. When doing your
                // development you should not block your snap-in thread to service an
                // async request like OnExpand unless you only use the scope tree and
                // list view and never show any WinForms views or WinForms property pages.
                // The reason is that your WinForms views and property pages will be blocked,
                // and in certain cases that can also block MMC.

                // sleep for a second
                Thread.Sleep(1000);

                // New scope nodes must be created on the snapin's thread
                DelegateWithNode delegateWithNode = new DelegateWithNode(AddChildNode);
                this.SnapIn.BeginInvoke(delegateWithNode, new object[] {this});

                // update the progress
                expandStatus.ReportProgress(child, foundChildren, "Loading Sample children...");
            }

            // update progress
            expandStatus.Complete("Loading Sample complete.", true);
        }