-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use a new c# syntax for MemberAccessors
- Loading branch information
Showing
47 changed files
with
434 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 13 additions & 6 deletions
19
sources/RevitDBExplorer/Domain/DataModel/MemberAccessors/Curve/Curve_GetEndPoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using Autodesk.Revit.DB; | ||
using RevitDBExplorer.Domain.DataModel.Accessors; | ||
|
||
// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md | ||
|
||
namespace RevitDBExplorer.Domain.DataModel.MemberAccessors | ||
{ | ||
internal class Curve_GetEndPoint : MemberAccessorByType<Curve>, ICanCreateMemberAccessor | ||
{ | ||
IEnumerable<LambdaExpression> ICanCreateMemberAccessor.GetHandledMembers() { yield return (Curve x) => x.GetEndPoint(0); } | ||
IEnumerable<LambdaExpression> ICanCreateMemberAccessor.GetHandledMembers() => [ (Curve x) => x.GetEndPoint(0) ]; | ||
|
||
|
||
protected override bool CanBeSnoooped(Document document, Curve curve) => curve.IsBound; | ||
protected override string GetLabel(Document document, Curve curve) | ||
public override ReadResult Read(SnoopableContext context, Curve curve) => new() | ||
{ | ||
Label = GetLabel(curve), | ||
CanBeSnooped = curve.IsBound | ||
}; | ||
private string GetLabel(Curve curve) | ||
{ | ||
var p0 = curve.GetEndPoint(0); | ||
var p1 = curve.GetEndPoint(1); | ||
|
||
string value = $"({p0.X:0.##}, {p0.Y:0.##}, {p0.Z:0.##}) - ({p1.X:0.##}, {p1.Y:0.##}, {p1.Z:0.##})"; | ||
return value; | ||
} | ||
protected override IEnumerable<SnoopableObject> Snooop(Document document, Curve curve) | ||
|
||
|
||
protected override IEnumerable<SnoopableObject> Snoop(SnoopableContext context, Curve curve) | ||
{ | ||
var p0 = curve.GetEndPoint(0); | ||
var p1 = curve.GetEndPoint(1); | ||
|
||
yield return new SnoopableObject(document, p0) { Index = 0, Name = "Start"}; | ||
yield return new SnoopableObject(document, p1) { Index = 1, Name = "End" }; | ||
yield return new SnoopableObject(context.Document, p0) { Index = 0, Name = "Start"}; | ||
yield return new SnoopableObject(context.Document, p1) { Index = 1, Name = "End" }; | ||
} | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
...del/MemberAccessors/DialogBoxShowingEventArgs/DialogBoxShowingEventArgs_OverrideResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using Autodesk.Revit.DB; | ||
using Autodesk.Revit.UI.Events; | ||
using RevitDBExplorer.Domain.DataModel.Accessors; | ||
|
||
// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md | ||
|
||
namespace RevitDBExplorer.Domain.DataModel.MemberAccessors | ||
{ | ||
internal class DialogBoxShowingEventArgs_OverrideResult : MemberAccessorByType<DialogBoxShowingEventArgs>, ICanCreateMemberAccessor | ||
{ | ||
IEnumerable<LambdaExpression> ICanCreateMemberAccessor.GetHandledMembers() { yield return (DialogBoxShowingEventArgs x) => x.OverrideResult(0); } | ||
IEnumerable<LambdaExpression> ICanCreateMemberAccessor.GetHandledMembers() => [ (DialogBoxShowingEventArgs x) => x.OverrideResult(0) ]; | ||
|
||
|
||
public override ReadResult Read(SnoopableContext context, DialogBoxShowingEventArgs value) => ReadResult.Forbidden; | ||
|
||
|
||
protected override bool CanBeSnoooped(Document document, DialogBoxShowingEventArgs value) => false; | ||
protected override string GetLabel(Document document, DialogBoxShowingEventArgs value) => QuoteGenerator.Deny(); | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
sources/RevitDBExplorer/Domain/DataModel/MemberAccessors/Document/Document_Close.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using Autodesk.Revit.DB; | ||
using RevitDBExplorer.Domain.DataModel.Accessors; | ||
|
||
// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md | ||
|
||
namespace RevitDBExplorer.Domain.DataModel.MemberAccessors | ||
{ | ||
internal class Document_Close : MemberAccessorByType<Document>, ICanCreateMemberAccessor | ||
{ | ||
IEnumerable<LambdaExpression> ICanCreateMemberAccessor.GetHandledMembers() { yield return (Document x) => x.Close(); yield return (Document x) => x.Close(true); } | ||
IEnumerable<LambdaExpression> ICanCreateMemberAccessor.GetHandledMembers() => [ (Document x) => x.Close(), (Document x) => x.Close(true) ]; | ||
|
||
|
||
protected override bool CanBeSnoooped(Document document, Document value) => false; | ||
protected override string GetLabel(Document document, Document value) => QuoteGenerator.Deny(); | ||
|
||
public override ReadResult Read(SnoopableContext context, Document value) => ReadResult.Forbidden; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.