示例#1
0
        private void EnumerateInstances(string className)
        {
            EnumerateInstancesOpSettings ei = new EnumerateInstancesOpSettings(className);

            ei.DeepInheritance = false;
            ei.IncludeClassOrigin = false;
            //ei.
            //ei.IncludeQualifiers = false;
            //ei.LocalOnly = true;

            try
            {
                progress = new ProgressForm();
                progress.Show();
                progress.Refresh();
                CimInstanceList list = mainWbemClient.EnumerateInstances(ei);
                progress.Status = ProgressForm.Updating;
                progress.Refresh();

                DisplayList(list);
                progress.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
示例#2
0
        private void uxLstView_Instances_DoubleClick(object sender, EventArgs e)
        {
            CimInstanceNameList bKCInstances = new CimInstanceNameList();
            // Get the selected Property / Method / Qualifier's name
            string selectedBaseKeyClass = uxLstView_Instances.SelectedItems[0].SubItems[0].Text;
            progress = new ProgressForm();
            progress.Show();
            progress.Refresh();
            CimInstanceNameList list = mainWbemClient.EnumerateInstanceNames(treeView1.SelectedNode.Text);

            foreach (CimInstanceName curCIN in list)
            {
                if (FindBaseKeyClass(curCIN.ClassName) == selectedBaseKeyClass)
                {
                    // it's one of the selected instances
                    bKCInstances.Add(curCIN);
                }
            }
            list.RemoveRange(0, list.Count);
            list = null;
            GC.Collect();

            progress.Status = ProgressForm.Updating;
            progress.Refresh();

            BaseKeyClassForm form = new BaseKeyClassForm(selectedBaseKeyClass, bKCInstances);

            bKCInstances.RemoveRange(0, bKCInstances.Count);
            bKCInstances = null;
            GC.Collect();

            progress.UIupdateComplete(100);
            progress.Close();
            form.ShowDialog();
            uxLstView_Instances.SelectedItems[0].SubItems[1].Text = form.UxLstView_Items.Items.Count.ToString();
            form.UxLstView_Items.Items.Clear();
            form = null;
            GC.Collect();
        }
示例#3
0
        private void EnumerateInstanceNames(string className)
        {
            baseKeyClassMap = new Dictionary<CimName, CimName>();
            EnumerateInstanceNamesOpSettings ei = new EnumerateInstanceNamesOpSettings(className);
            mainKBSet = new KeyBindingSet();

            //try
            //{
                progress = new ProgressForm();
                progress.Show();
                progress.Refresh();

                CimInstanceNameList list = mainWbemClient.EnumerateInstanceNames(ei);

                progress.Status = ProgressForm.Updating;
                progress.Refresh();

                int count = list.Count;
                int curCount = 0;
                foreach (CimInstanceName curCIN in list)
                {
                    if (!mainKBSet.Contains(curCIN.KeyBindings, FindBaseKeyClass(curCIN.ClassName)))
                    {
                        mainKBSet.Add(curCIN.KeyBindings, FindBaseKeyClass(curCIN.ClassName));
                    }
                    else
                    {
                        // inc the number in this set item.
                        mainKBSet.Find(curCIN.KeyBindings, FindBaseKeyClass(curCIN.ClassName)).NumInstances++;
                    }
                    curCount++;
                    float val = ((float)curCount * 100) / count;
                    progress.UIupdateComplete(Convert.ToInt32(val));
                }

                list.RemoveRange(0, list.Count);

                list = null;
                DisplayList(mainKBSet, count);
                progress.Close();
            //}
            //catch (Exception e)
            //{
            //    MessageBox.Show(e.Message);
            //}
        }