C# Class RevitLookup.Snoop.Utils

Utility functions to use in the Snoop dialog mechanism.
显示文件 Open project: jeremytammik/RevitLookup

Public Methods

Method Description
AppendThePropertyObject ( ArrayList data, String propertyName, Object value ) : void
BrowseReflection ( Object obj ) : void

Given an Object, allow the user to browse its properties based on Reflection only.

CopyToClipboard ( ListView lv ) : void

CopyToClipboard ( System.Windows.Forms.ListViewItem lvItem, System.Boolean multipleItems ) : void

DataItemSelected ( ListView lvCur ) : void

A Snoop.Data item was selected in the ListView. Call its DrillDown() function to get more detailed info about it.

Display ( ListView lvCur, Snoop snoopCollector ) : void

Given a ListView to display the data in, clear it out and add all the data that has been collected. For things that have a DrillDown, change the font to Bold so the user knows they can select it. For things that are a Separator, change the background color.

GetMaximumColumnWidths ( ListView lv ) : System.Int32[]

GetPrintDocumentName ( TreeNode node ) : String

GetRootNode ( TreeNode node ) : TreeNode

HorizontalAlignmentToStringAligment ( HorizontalAlignment ha ) : StringAlignment

IsKeyValuePair ( object o ) : bool

Check if the object type is KeyValuePair.

IsSupportedType ( Object value ) : bool

Check if the given instance is the basic types we supported.

ObjToLabelStr ( System obj ) : string

Same as above, but this is used when we are already grouping the objects by Type in a TreeCtrl. Including the Type name would be redundant.

ObjToTypeStr ( System obj ) : string

Format a type string to represent a given object. If it is an Element, we try to get some extra information that may be useful, such as the Name and the ElementId. If it isn't an Element then just print out

Print ( String title, ListView lv, System e, Int32 maxFieldWidth, Int32 maxValueWidth, Int32 currentItem ) : Int32

PrintMenuItemClick ( System.Windows.Forms.PrintDialog dlg ) : void

PrintMenuItemClick ( System.Windows.Forms.PrintDialog dlg, TreeView tv ) : void

PrintPreviewMenuItemClick ( System.Windows.Forms.PrintPreviewDialog dlg, ListView lv ) : void

PrintPreviewMenuItemClick ( System.Windows.Forms.PrintPreviewDialog dlg, TreeView tv ) : void

StreamWithReflection ( ArrayList data, Type type, Object instance ) : void

Stream the property with reflection.

UpdatePrintSettings ( ListView lv, Int32 &widthArray ) : void

UpdatePrintSettings ( System.Drawing.Printing.PrintDocument doc, TreeView tv, ListView lv, Int32 &widthArray ) : void

Utils ( ) : System

Method Details

AppendThePropertyObject() public static method

public static AppendThePropertyObject ( ArrayList data, String propertyName, Object value ) : void
data System.Collections.ArrayList
propertyName String
value Object
return void

BrowseReflection() public static method

Given an Object, allow the user to browse its properties based on Reflection only.
public static BrowseReflection ( Object obj ) : void
obj Object Object to browse
return void

CopyToClipboard() public static method

public static CopyToClipboard ( ListView lv ) : void
lv System.Windows.Forms.ListView
return void

CopyToClipboard() public static method

public static CopyToClipboard ( System.Windows.Forms.ListViewItem lvItem, System.Boolean multipleItems ) : void
lvItem System.Windows.Forms.ListViewItem
multipleItems System.Boolean
return void

DataItemSelected() public static method

A Snoop.Data item was selected in the ListView. Call its DrillDown() function to get more detailed info about it.
public static DataItemSelected ( ListView lvCur ) : void
lvCur System.Windows.Forms.ListView The ListView control in question
return void

Display() public static method

Given a ListView to display the data in, clear it out and add all the data that has been collected. For things that have a DrillDown, change the font to Bold so the user knows they can select it. For things that are a Separator, change the background color.
public static Display ( ListView lvCur, Snoop snoopCollector ) : void
lvCur System.Windows.Forms.ListView The ListView UI control to draw into
snoopCollector Snoop The collected data about an object
return void

GetMaximumColumnWidths() public static method

public static GetMaximumColumnWidths ( ListView lv ) : System.Int32[]
lv System.Windows.Forms.ListView
return System.Int32[]

GetPrintDocumentName() public static method

public static GetPrintDocumentName ( TreeNode node ) : String
node System.Windows.Forms.TreeNode
return String

GetRootNode() public static method

public static GetRootNode ( TreeNode node ) : TreeNode
node System.Windows.Forms.TreeNode
return System.Windows.Forms.TreeNode

HorizontalAlignmentToStringAligment() public static method

public static HorizontalAlignmentToStringAligment ( HorizontalAlignment ha ) : StringAlignment
ha HorizontalAlignment
return StringAlignment

IsKeyValuePair() public static method

Check if the object type is KeyValuePair.
public static IsKeyValuePair ( object o ) : bool
o object
return bool

IsSupportedType() public static method

Check if the given instance is the basic types we supported.
public static IsSupportedType ( Object value ) : bool
value Object
return bool

ObjToLabelStr() public static method

Same as above, but this is used when we are already grouping the objects by Type in a TreeCtrl. Including the Type name would be redundant.
public static ObjToLabelStr ( System obj ) : string
obj System Object to label
return string

ObjToTypeStr() public static method

Format a type string to represent a given object. If it is an Element, we try to get some extra information that may be useful, such as the Name and the ElementId. If it isn't an Element then just print out
public static ObjToTypeStr ( System obj ) : string
obj System Object to label
return string

Print() public static method

public static Print ( String title, ListView lv, System e, Int32 maxFieldWidth, Int32 maxValueWidth, Int32 currentItem ) : Int32
title String
lv System.Windows.Forms.ListView
e System
maxFieldWidth System.Int32
maxValueWidth System.Int32
currentItem System.Int32
return System.Int32

PrintMenuItemClick() public static method

public static PrintMenuItemClick ( System.Windows.Forms.PrintDialog dlg ) : void
dlg System.Windows.Forms.PrintDialog
return void

PrintMenuItemClick() public static method

public static PrintMenuItemClick ( System.Windows.Forms.PrintDialog dlg, TreeView tv ) : void
dlg System.Windows.Forms.PrintDialog
tv System.Windows.Forms.TreeView
return void

PrintPreviewMenuItemClick() public static method

public static PrintPreviewMenuItemClick ( System.Windows.Forms.PrintPreviewDialog dlg, ListView lv ) : void
dlg System.Windows.Forms.PrintPreviewDialog
lv System.Windows.Forms.ListView
return void

PrintPreviewMenuItemClick() public static method

public static PrintPreviewMenuItemClick ( System.Windows.Forms.PrintPreviewDialog dlg, TreeView tv ) : void
dlg System.Windows.Forms.PrintPreviewDialog
tv System.Windows.Forms.TreeView
return void

StreamWithReflection() public static method

Stream the property with reflection.
public static StreamWithReflection ( ArrayList data, Type type, Object instance ) : void
data System.Collections.ArrayList
type System.Type
instance Object
return void

UpdatePrintSettings() public static method

public static UpdatePrintSettings ( ListView lv, Int32 &widthArray ) : void
lv System.Windows.Forms.ListView
widthArray System.Int32
return void

UpdatePrintSettings() public static method

public static UpdatePrintSettings ( System.Drawing.Printing.PrintDocument doc, TreeView tv, ListView lv, Int32 &widthArray ) : void
doc System.Drawing.Printing.PrintDocument
tv System.Windows.Forms.TreeView
lv System.Windows.Forms.ListView
widthArray System.Int32
return void

Utils() public method

public Utils ( ) : System
return System