private void ClassNameList_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox listBox = (ListBox)sender; ListBoxItem listBoxItem = (ListBoxItem)listBox.SelectedItem; WbemTreeViewItem item = (WbemTreeViewItem)listBoxItem.DataContext; ClassNameSelected(ClassNameList, item); }
/// <summary> /// When double clicking in the list of classnames from the search operation (in the SearchClassResultWindow), /// we retrieve the classname and load the details. The SearchClassResultWindow will also be closed. /// </summary> private void SearchClassResultWindow_ClassNameSelected(object sender, WbemTreeViewItem wbemTreeViewItem) { PopulateClassDetails(wbemTreeViewItem); wbemTreeViewItem.IsSelected = true; ClassNavigator.ExpandTo(wbemTreeViewItem); searchClassResultWindow.Close(); searchClassResultWindow = null; }
/// <summary> /// Populates the properties and methods from a class that is represented by a wbemTreeViewItem. /// </summary> /// <param name="wbemTreeViewItem">The WbemTreeViewItem that represents the class</param> private void PopulateClassDetails(WbemTreeViewItem wbemTreeViewItem) { PropertyList.ItemsSource = null; WbemObject mObject = wbemTreeViewItem.DataContext; TextBlockCurrentClass.Text = mObject.Path.ClassName; TextBlockCurrentClass.DataContext = mObject; IList <DataGridPropertyView> properties = mObject.GetAllProperties().Values.Select(s => new DataGridPropertyView(s)).ToList(); IList <DataGridMethodView> methods = mObject.Methods.Values.Select(s => new DataGridMethodView(s)).ToList(); PropertyList.ItemsSource = properties; MethodList.ItemsSource = methods; }