Unverified Commit c9de8770 authored by RevitArkitek's avatar RevitArkitek Committed by GitHub
Browse files

ScheduleDefinition.GetField (#71)



#70 - Adds handler for ScheduleDefinition.GetField
Co-authored-by: default avatarmichaelcoffey <michael.coffey@ideateinc.com>
Co-authored-by: Jeremy Tammik's avatarJeremy Tammik <jeremy.tammik@autodesk.com>
parent b793409d
......@@ -139,6 +139,7 @@
<Compile Include="Snoop\Data\ExtensibleStorageSeparator.cs" />
<Compile Include="Snoop\Data\MemberSeparator.cs" />
<Compile Include="Snoop\Data\ElementPhaseStatuses.cs" />
<Compile Include="Snoop\Data\ScheduleDefinitionGetFields.cs" />
<Compile Include="Snoop\Data\SnoopableObjectWrapper.cs" />
<Compile Include="Snoop\Data\ViewCropRegionShapeManagerGetSplitRegionOffsets.cs" />
<Compile Include="Snoop\Data\ViewGetTemplateParameterIds.cs" />
......
......@@ -53,7 +53,14 @@ namespace RevitLookup.Snoop.CollectorExts
if (declaringType == typeof(View) && methodInfo.Name == nameof(View.GetTemplateParameterIds))
return new ViewGetTemplateParameterIds(methodInfo.Name, (View)elem);
if (declaringType == typeof(ViewCropRegionShapeManager) && methodInfo.Name == nameof(ViewCropRegionShapeManager.GetSplitRegionOffset))
if (declaringType == typeof(ScheduleDefinition) && methodInfo.Name == nameof(ScheduleDefinition.GetField))
{
var parameters = methodInfo.GetParameters();
if (parameters[0].ParameterType == typeof(int))
return new ScheduleDefinitionGetFields(methodInfo.Name, (ScheduleDefinition)elem);
}
if (declaringType == typeof(ViewCropRegionShapeManager) && methodInfo.Name == nameof(ViewCropRegionShapeManager.GetSplitRegionOffset))
return new ViewCropRegionShapeManagerGetSplitRegionOffsets(methodInfo.Name, (ViewCropRegionShapeManager)elem);
if (declaringType == typeof (Document) && methodInfo.Name == nameof(Document.Close))
......
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;
namespace RevitLookup.Snoop.Data
{
public class ScheduleDefinitionGetFields : Data
{
private readonly ScheduleDefinition _scheduleDefinition;
public ScheduleDefinitionGetFields(string label, ScheduleDefinition scheduleDefinition) : base(label)
{
_scheduleDefinition = scheduleDefinition;
}
public override string StrValue()
{
return "< Get Fields >";
}
public override bool HasDrillDown => _scheduleDefinition != null && _scheduleDefinition.GetFieldCount() > 0;
public override void DrillDown()
{
if (!HasDrillDown) return;
List<SnoopableObjectWrapper> scheduleFieldObjects = new List<SnoopableObjectWrapper>();
for (int i = 0; i < _scheduleDefinition.GetFieldCount(); i++)
{
ScheduleField field = _scheduleDefinition.GetField(i);
scheduleFieldObjects.Add(new SnoopableObjectWrapper("[" + i + "] " + field.GetName(), field));
}
if (!scheduleFieldObjects.Any()) return;
var form = new Forms.Objects(scheduleFieldObjects);
form.ShowDialog();
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment