public void Attach(object target) { if (target == null) { return; } Type targetType = target.GetType(); if (targetType.FullName == "Microsoft.VisualStudio.TeamFoundation.WorkItemTracking.ResultView") { workItemResultGrid = target as DataGridView; workItemsListAcc = new FieldAccesor(workItemResultGrid, "m_items"); resetRowsAcc = new MethodAccesor(workItemResultGrid.GetType(), "ResetRows"); triageEditor = workItemResultGrid.Parent.Parent as UserControl; trigeResultInfoBar = FieldAccesor.GetValue(triageEditor, "m_infoBar") as Panel; AttachSearchBox(); } else { return; } }
private void ExpandAll() { if (SelectedObject == null) { return; } Visible = false; try { if (gridViewAccessor == null) { gridViewAccessor = new FieldAccesor(this, "gridView"); peMainAccessor = new FieldAccesor(this, "peMain"); } object gridView = gridViewAccessor.Get(); object peMain = peMainAccessor.Get(); if (recursivelyExpandAccessor == null) { recursivelyExpandAccessor = new MethodAccesor(gridView.GetType(), "RecursivelyExpand"); } recursivelyExpandAccessor.Invoke(gridView, new object[] { peMain, false, true, 2 }); } finally { Visible = true; } }
private void GrabObjects() { if (toolBar != null) { return; } FieldAccesor toolBarAccesor = new FieldAccesor(propertyGrid, "toolBar"); if (toolBarAccesor.IsValid) { toolBarAccesor.Get(); } else { toolBarAccesor = new FieldAccesor(propertyGrid, "toolStrip"); toolBarAccesor.Get(); // for a toolstrip we have to "fix" the readonly stuff on the controls :( Control strip = toolBarAccesor.Value as Control; FieldAccesor readonlyFlag = new FieldAccesor(strip.Controls, "_isReadOnly"); readonlyFlag.Set(false); } toolBar = toolBarAccesor.Value as Control; AttachNewToolButtons(); FieldAccesor gridViewAccesor = new FieldAccesor(propertyGrid, "gridView"); gridViewAccesor.Get(); this.gridView = gridViewAccesor.Value; allGridItemsAC = new FieldAccesor(gridView, "allGridEntries"); topLevelGridItemsAC = new FieldAccesor(gridView, "topLevelGridEntries"); totalProps = new FieldAccesor(gridView, "totalProps"); selectedRow = new FieldAccesor(gridView, "selectedRow"); setScrollOffset = new MethodAccesor(gridView.GetType(), "SetScrollOffset"); selectGridEntry = new PropertyAccesor(gridView, "SelectedGridEntry"); layoutWindow = new MethodAccesor(gridView.GetType(), "Refresh"); propertyGrid.SelectedObjectsChanged += new EventHandler(propertyGrid_SelectedObjectsChanged); propertyGrid.PropertyTabChanged += new PropertyTabChangedEventHandler(propertyGrid_PropertyTabChanged); propertyGrid.PropertySortChanged += new EventHandler(propertyGrid_PropertySortChanged); }
public void DynamicInvoke() { Type target = (component is Type)?(component as Type):component.GetType(); if (target != null) { MethodAccesor methodAcc = new MethodAccesor(target, "On" + eventInfo.Name); if (methodAcc.IsValid) { if (target is Type) { methodAcc.Invoke(null); } else { methodAcc.Invoke(component); } } } }