Ejemplo n.º 1
0
        //---------------------------------------------------------------------
        private void mpElementTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                DisplayOverridesForMPWorkflow(e.Node);
            }
            catch (Microsoft.EnterpriseManagement.Common.ServerDisconnectedException)
            {
                m_managementGroup.Reconnect();

                DisplayOverridesForMPWorkflow(e.Node);
            }
        }
Ejemplo n.º 2
0
        //---------------------------------------------------------------------
        private void MPBrowserDialog_Load(object sender, EventArgs e)
        {
            ReadOnlyCollection <ManagementPack> managementPacks;
            ManagementPackCriteria criteria = new ManagementPackCriteria("Sealed=0");

            try
            {
                managementPacks = m_managementGroup.GetManagementPacks(criteria);
            }
            catch (Microsoft.EnterpriseManagement.Common.ServerDisconnectedException)
            {
                m_managementGroup.Reconnect();

                managementPacks = m_managementGroup.GetManagementPacks(criteria);
            }

            lstManagementPacks.BeginUpdate();

            foreach (ManagementPack mp in managementPacks)
            {
                ListViewItem listViewItem = new ListViewItem();

                listViewItem.Text = Common.GetBestManagementPackName(mp);
                listViewItem.Tag  = mp;

                listViewItem.SubItems.Add(mp.Version.ToString());

                lstManagementPacks.Items.Add(listViewItem);

                lstManagementPacks.Sort();
            }

            lstManagementPacks.EndUpdate();
        }
Ejemplo n.º 3
0
        //---------------------------------------------------------------------
        internal static string RetrieveContext(
            ManagementPackOverride mpOverrride,
            ManagementGroup managementGroup
            )
        {
            string context = "Unknown";

            if (mpOverrride.ContextInstance == null)
            {
                string className;

                className = GetBestElementName(managementGroup.GetMonitoringClass(mpOverrride.Context.Id));

                context = string.Format("All Instances of type {0}", className);
            }
            else
            {
                PartialMonitoringObject monitoringObject;

                try
                {
                    try
                    {
                        monitoringObject = managementGroup.GetPartialMonitoringObject((Guid)mpOverrride.ContextInstance);
                        context          = monitoringObject.DisplayName;
                    }
                    catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception)
                    {
                        managementGroup.Reconnect();
                        monitoringObject = managementGroup.GetMonitoringObject((Guid)mpOverrride.ContextInstance);
                    }
                }
                catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception)
                {
                    MessageBox.Show(exception.Message);
                }
            }

            return(context);
        }
        //---------------------------------------------------------------------
        protected override void OnBeforeExpand(TreeViewCancelEventArgs e)
        {
            if (e.Node.Nodes[0] is PlaceholderTreeNode)
            {
                e.Node.Nodes.Clear();

                PartialMonitoringObject parentMonitoringObject = (PartialMonitoringObject)e.Node.Tag;

                ReadOnlyCollection <PartialMonitoringObject> monitoringObjects;

                try
                {
                    monitoringObjects = parentMonitoringObject.GetRelatedPartialMonitoringObjects(TraversalDepth.OneLevel);
                }
                catch (Microsoft.EnterpriseManagement.Common.ServerDisconnectedException)
                {
                    m_managementGroup.Reconnect();

                    monitoringObjects = parentMonitoringObject.GetRelatedPartialMonitoringObjects(TraversalDepth.OneLevel);
                }

                List <PartialMonitoringObject> monitoringObjectList = new List <PartialMonitoringObject>(monitoringObjects);

                monitoringObjectList.Sort(new MonitoringObjectComparer());

                BeginUpdate();

                foreach (PartialMonitoringObject monitoringObject in monitoringObjectList)
                {
                    AddMonitoringObjectTreeNode(monitoringObject, e.Node);
                }

                EndUpdate();
            }

            base.OnBeforeExpand(e);
        }
Ejemplo n.º 5
0
        //---------------------------------------------------------------------
        internal static string RetrieveContext(
            ManagementPackOverride mpOverrride,
            ManagementGroup        managementGroup
            )
        {
            string context = "Unknown";

            if (mpOverrride.ContextInstance == null)
            {
                string className;

                className = GetBestElementName(managementGroup.GetMonitoringClass(mpOverrride.Context.Id));

                context = string.Format("All Instances of type {0}", className);
            }
            else
            {
                PartialMonitoringObject monitoringObject;

                try
                {
                    try
                    {
                        monitoringObject = managementGroup.GetPartialMonitoringObject((Guid)mpOverrride.ContextInstance);
                        context = monitoringObject.DisplayName;
                    }
                    catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception)
                    {
                        managementGroup.Reconnect();
                        monitoringObject = managementGroup.GetMonitoringObject((Guid)mpOverrride.ContextInstance);
                    }
                }
                catch (Microsoft.EnterpriseManagement.Common.MonitoringException exception)
                {
                    MessageBox.Show(exception.Message);
                }
            }

            return (context);
        }