Inheritance: ViewDescription
        /// <summary>
        /// Constructor
        /// </summary>
        public HtmlViewSnapIn()
        {
            // update scope pane with a node in the tree
            this.RootNode = new ScopeNode();
            this.RootNode.DisplayName = "HtmlView Sample";

            // set up the update result pane when scope node selected
            HtmlViewDescription hvd = new HtmlViewDescription();
            hvd.DisplayName = "HtmlView (http://www.microsoft.com)";
            hvd.Url = new Uri("http://www.microsoft.com");

            // attach the view and set it as the default to show
            this.RootNode.ViewDescriptions.Add(hvd);
            this.RootNode.ViewDescriptions.DefaultIndex = 0;
        }
示例#2
0
        /// <summary>Initializes the nodes and the views attached to each node in the SnapIn tree.</summary>
        private void InitializeNodes()
        {
            // Primary Node for the SnapIn. Create it, and then add it to the Parent Node which belongs
            // to Computer Management
            _snapInNode = new ScopeNode {
                DisplayName = "WMI Demo Snap-In",
                ImageIndex = SnapInShared.WmiDemoImage,
                SelectedImageIndex = SnapInShared.WmiDemoImage };

            PrimaryNode.Children.Add(_snapInNode);

            // Node which contains a report view of all the tasks that are in the system
            ScopeNode taskListNode = new ScopeNode {
                DisplayName = "Tasks",
                ImageIndex = SnapInShared.TaskImage,
                SelectedImageIndex = SnapInShared.TaskImage };
            _snapInNode.Children.Add(taskListNode);

            // View Description for the Task List
            MmcListViewDescription scheduledLvd = new MmcListViewDescription {
                DisplayName = "Scheduled Task List",
                ViewType = typeof(Views.TaskListView),
                Options = MmcListViewOptions.ExcludeScopeNodes };

            taskListNode.ViewDescriptions.Add(scheduledLvd);
            taskListNode.ViewDescriptions.DefaultIndex = 0;

            // Node for the Web site Link
            ScopeNode htmlNode = new ScopeNode {
                DisplayName = "Web Site",
                ImageIndex = SnapInShared.WebsiteImage,
                SelectedImageIndex = SnapInShared.WebsiteImage };
            _snapInNode.Children.Add(htmlNode);

            HtmlViewDescription htmlDesc = new HtmlViewDescription { DisplayName = "The Coding Monkey", Url = new Uri("http://www.thecodingmonkey.net") };

            // attach the view and set it as the default to show
            htmlNode.ViewDescriptions.Add(htmlDesc);
            htmlNode.ViewDescriptions.DefaultIndex = 0;

            // Node for the "Performance" Pane
            ScopeNode perfNode = new ScopeNode {
                DisplayName = "Performance",
                ImageIndex = SnapInShared.Performance,
                SelectedImageIndex = SnapInShared.Performance };
            _snapInNode.Children.Add(perfNode);

            FormViewDescription perfFvd = new FormViewDescription {
                DisplayName = "Performance",
                ViewType = typeof(Views.PerformanceCounterFormView),
                ControlType = typeof(Views.PerformanceCounterViewControl) };

            perfNode.ViewDescriptions.Add(perfFvd);
            perfNode.ViewDescriptions.DefaultIndex = 0;
        }