Skip to content

Commit

Permalink
Merge pull request #193 from SergeyNefyodov/dev-objects-methods-support
Browse files Browse the repository at this point in the history
Object members support added
  • Loading branch information
Nice3point authored Nov 28, 2023
2 parents fca1e76 + d621277 commit 07515fe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RevitLookup/Core/Metadata/DescriptorBuilder.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public sealed partial class DescriptorBuilder
private IReadOnlyCollection<Descriptor> BuildInstanceObject(Type type)
{
var types = new List<Type>();
while (type.BaseType is not null)
while (_settings.IsObjectMembersAllowed ? type is not null : type!.BaseType is not null)
{
types.Add(type);
type = type.BaseType;
Expand Down
1 change: 1 addition & 0 deletions RevitLookup/Services/Contracts/ISettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public interface ISettingsService
bool IsEventsAllowed { get; set; }
bool IsExtensionsAllowed { get; set; }
bool IsTimeColumnAllowed { get; set; }
bool IsObjectMembersAllowed { get; set; }
int ApplyTransition(bool value);

void Save();
Expand Down
7 changes: 7 additions & 0 deletions RevitLookup/Services/SettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ internal sealed class Settings
public bool IsFieldsAllowed { get; set; }
public bool IsEventsAllowed { get; set; }
public bool IsExtensionsAllowed { get; set; }
public bool IsObjectMembersAllowed { get; set; }
}

public sealed class SettingsService : ISettingsService
Expand Down Expand Up @@ -131,6 +132,12 @@ public bool IsExtensionsAllowed
get => _settings.IsExtensionsAllowed;
set => _settings.IsExtensionsAllowed = value;
}

public bool IsObjectMembersAllowed
{
get => _settings.IsObjectMembersAllowed;
set => _settings.IsObjectMembersAllowed = value;
}

public int ApplyTransition(bool value)
{
Expand Down
9 changes: 8 additions & 1 deletion RevitLookup/Views/Pages/SnoopViewBase.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,14 @@ private void CreateGridContextMenu(DataGrid dataGrid)

contextMenu.AddSeparator();
contextMenu.AddLabel("Show");


contextMenu.AddMenuItem("CheckableMenuItem")
.SetHeader("Object members")
.SetCommand(_settingsService.IsObjectMembersAllowed, parameter =>
{
_settingsService.IsObjectMembersAllowed = !parameter;
return GetRefreshGridTask();
});
contextMenu.AddMenuItem("CheckableMenuItem")
.SetHeader("Events")
.SetCommand(_settingsService.IsEventsAllowed, parameter =>
Expand Down

0 comments on commit 07515fe

Please sign in to comment.