本文整理汇总了C#中CustomClass.Find方法的典型用法代码示例。如果您正苦于以下问题:C# CustomClass.Find方法的具体用法?C# CustomClass.Find怎么用?C# CustomClass.Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomClass
的用法示例。
在下文中一共展示了CustomClass.Find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomClass
/// <summary>
/// Called after the dialog has been created.
/// </summary>
/// <param name="DTEObject">The DTE object.</param>
void IDTToolsOptionsPage.OnAfterCreated(DTE DTEObject)
{
// Enumerate plug-ins and create a dynamic properties
// Must also check for unique features
CustomClass featuresHost = new CustomClass();
foreach (BIDSHelperPluginBase plugin in Connect.Plugins.Values)
{
CustomProperty parent = featuresHost.Find(plugin.FeatureName);
if (parent == null)
{
// New feature
featuresHost.Add(new CustomProperty(plugin));
}
else
{
parent.Children.Add(new CustomProperty(plugin));
}
}
// Assign our dynamic properties collection to the property grid
this.propertyGridFeatures.SelectedObject = featuresHost;
// Hide property grid when we have nothing to show, and display
// "add-in is not currently enabled" message instead
propertyGridFeatures.Visible = (featuresHost.Count > 0);
lblCurrentlyDisabled.Visible = !propertyGridFeatures.Visible;
// Skip the rest if the add-in is disabled
if (lblCurrentlyDisabled.Visible)
{
return;
}
// Set width of property grid columns, make the description larger than default 50%
FieldInfo fieldInfo = typeof(PropertyGrid).GetField("gridView", BindingFlags.NonPublic | BindingFlags.Instance);
object gridViewRef = fieldInfo.GetValue(this.propertyGridFeatures);
Type gridViewType = gridViewRef.GetType();
MethodInfo methodInfo = gridViewType.GetMethod("MoveSplitterTo", BindingFlags.NonPublic | BindingFlags.Instance);
int width = (int)(this.propertyGridFeatures.Width * 0.7);
methodInfo.Invoke(gridViewRef, new object[]{width});
// Description area size is tool small for 3 lines of text, but fine for 2.
// The DocComment Lines or Height approach is too unreliable, need to get
// accurate border sizes, DrawString etc. Only a few descriptions that are
// too long. Most are only 1 line, so live with it as is.
// Set default focus to General category, the top of the grid
// Walk up to the top of the grid tree first
GridItem item = this.propertyGridFeatures.SelectedGridItem;
if (item == null)
{
return;
}
while (item.Parent != null)
{
item = item.Parent;
}
foreach (GridItem category in item.GridItems)
{
if (category.Label == CustomProperty.GetFeatureCategoryLabel(BIDSFeatureCategories.General))
{
if (category.GridItems.Count > 0)
{
category.GridItems[0].Select();
}
else
{
category.Select();
}
}
}
}