Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to View class methods #219

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public ResolveSet Resolve(Document context, string target, ParameterInfo[] param
{
return target switch
{
nameof(View.CanCategoryBeHidden) => ResolveCanCategoryBeHidden(),
nameof(View.CanCategoryBeHiddenTemporary) => ResolveCanCategoryBeHiddenTemporary(),
nameof(View.CanViewBeDuplicated) => ResolveCanViewBeDuplicated(),
nameof(View.GetCategoryHidden) => ResolveCategoryHidden(),
nameof(View.GetCategoryOverrides) => ResolveCategoryOverrides(),
nameof(View.GetIsFilterEnabled) => ResolveFilterEnabled(),
Expand All @@ -41,12 +44,52 @@ public ResolveSet Resolve(Document context, string target, ParameterInfo[] param
nameof(View.IsInTemporaryViewMode) => ResolveIsInTemporaryViewMode(),
nameof(View.IsValidViewTemplate) => ResolveIsValidViewTemplate(),
nameof(View.IsWorksetVisible) => ResolveIsWorksetVisible(),
nameof(View.SupportsWorksharingDisplayMode) => ResolveSupportsWorksharingDisplayMode(),
#if REVIT2022_OR_GREATER
nameof(View.GetColorFillSchemeId) => ResolveColorFillSchemeId(),
#endif
_ => null
};

ResolveSet ResolveCanCategoryBeHidden()
{
var categories = context.Settings.Categories;
var resolveSummary = new ResolveSet(categories.Size);
foreach (Category category in categories)
{
var result = view.CanCategoryBeHidden(category.Id);
resolveSummary.AppendVariant(result, $"{category.Name}: {result}");
}

return resolveSummary;
}

ResolveSet ResolveCanCategoryBeHiddenTemporary()
{
var categories = context.Settings.Categories;
var resolveSummary = new ResolveSet(categories.Size);
foreach (Category category in categories)
{
var result = view.CanCategoryBeHiddenTemporary(category.Id);
resolveSummary.AppendVariant(result, $"{category.Name}: {result}");
}

return resolveSummary;
}

ResolveSet ResolveCanViewBeDuplicated()
{
var values = Enum.GetValues(typeof(ViewDuplicateOption));
var resolveSummary = new ResolveSet(values.Length);

foreach (ViewDuplicateOption option in values)
{
resolveSummary.AppendVariant(view.CanViewBeDuplicated(option), option.ToString());
}

return resolveSummary;
}

ResolveSet ResolveCategoryHidden()
{
var categories = context.Settings.Categories;
Expand Down Expand Up @@ -142,7 +185,6 @@ ResolveSet ResolveIsFilterApplied()
return resolveSummary;
}


ResolveSet ResolveIsInTemporaryViewMode()
{
var values = Enum.GetValues(typeof(TemporaryViewMode));
Expand Down Expand Up @@ -194,6 +236,19 @@ ResolveSet ResolveWorksetVisibility()

return resolveSummary;
}

ResolveSet ResolveSupportsWorksharingDisplayMode()
{
var values = Enum.GetValues(typeof(WorksharingDisplayMode));
var resolveSummary = new ResolveSet(values.Length);

foreach (WorksharingDisplayMode mode in values)
{
resolveSummary.AppendVariant(view.SupportsWorksharingDisplayMode(mode), mode.ToString());
}

return resolveSummary;
}
#if REVIT2022_OR_GREATER

ResolveSet ResolveColorFillSchemeId()
Expand Down
Loading