Skip to content

Commit

Permalink
Update summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Nice3point committed Jul 31, 2022
1 parent 95a17c6 commit 4fa12a1
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 18 deletions.
1 change: 0 additions & 1 deletion Build/Build.Compile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ partial class Build
{
Target Compile => _ => _
.TriggeredBy(Cleaning)
.OnlyWhenStatic(() => IsServerBuild)
.Executes(() =>
{
var configurations = GetConfigurations(BuildConfiguration);
Expand Down
2 changes: 1 addition & 1 deletion Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Configurations>Release;Debug</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.0.3" />
<PackageReference Include="Nuke.Common" Version="6.1.2" />
</ItemGroup>

<ItemGroup>
Expand Down
41 changes: 25 additions & 16 deletions Nice3point.Revit.Toolkit/ExternalHandling/ExternalEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,43 @@
namespace Nice3point.Revit.Toolkit.ExternalHandling;

/// <summary>
/// External event used to change the model.
/// External event used to change the document.
/// </summary>
/// <remarks>
/// In derived classes create an overload of the Raise() method to add parameters.
/// <example>
/// <code>
/// Command.EventHandler.Raise(value1, value2);
/// CustomEventHandler.Raise(value1, value2);
/// </code>
/// Or use public properties.
/// <code>
/// Command.EventHandler.Property1 = "value1";
/// Command.EventHandler.Property2 = "value2";
/// Command.EventHandler.Raise();
/// CustomEventHandler.Property1 = "value1";
/// CustomEventHandler.Property2 = "value2";
/// CustomEventHandler.Raise();
/// </code>
/// </remarks>
/// </example>
public abstract class ExternalEventHandler : IExternalEventHandler
{
private readonly ExternalEvent _externalEvent;

/// <summary>
/// Creates an instance of external event
/// </summary>
protected ExternalEventHandler()
{
_externalEvent = ExternalEvent.Create(this);
}

/// <summary>
/// This method is called to handle the external event
/// </summary>
public virtual void Execute(UIApplication uiApplication)
{
throw new NotImplementedException();
}

/// <summary>
/// String identification of the event handler
/// </summary>
/// <returns>Event name</returns>
public string GetName()
{
return GetType().Name;
Expand All @@ -40,16 +49,16 @@ public string GetName()
/// Instructing Revit to raise (signal) the external event
/// </summary>
/// <remarks>
/// Revit will wait until it is ready to process the event and then
/// it will execute its event handler by calling the Execute method.
/// Revit processes external events only when no other commands or
/// edit modes are currently active in Revit, which is the same policy
/// like the one that applies to evoking external commands
/// Revit will wait until it is ready to process the event and then
/// it will execute its event handler by calling the Execute method.
/// Revit processes external events only when no other commands or
/// edit modes are currently active in Revit, which is the same policy
/// like the one that applies to evoking external commands
/// </remarks>
/// <returns>
/// The result of event raising request. If the request is 'Accepted',
/// the event would be added to the event queue and its handler will
/// be executed in the next event-processing cycle
/// The result of event raising request. If the request is 'Accepted',
/// the event would be added to the event queue and its handler will
/// be executed in the next event-processing cycle
/// </returns>
public void Raise()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public class ActionEventHandler : ExternalEventHandler
{
private Action<UIApplication> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
_action?.Invoke(uiApplication);
Expand Down Expand Up @@ -44,6 +47,9 @@ public class ActionEventHandler<T> : ExternalEventHandler
private T _param;
private Action<UIApplication, T> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
_action?.Invoke(uiApplication, _param);
Expand Down Expand Up @@ -81,6 +87,9 @@ public class ActionEventHandler<T0, T1> : ExternalEventHandler
private T1 _param1;
private Action<UIApplication, T0, T1> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
_action?.Invoke(uiApplication, _param0, _param1);
Expand Down Expand Up @@ -120,6 +129,9 @@ public class ActionEventHandler<T0, T1, T2> : ExternalEventHandler
private T2 _param2;
private Action<UIApplication, T0, T1, T2> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
_action?.Invoke(uiApplication, _param0, _param1, _param2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public class IdlingEventHandler : ExternalEventHandler
{
private Action<UIApplication> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
uiApplication.Idling += UiApplicationOnIdling;
Expand Down Expand Up @@ -60,6 +63,9 @@ public class IdlingEventHandler<T> : ExternalEventHandler
private T _param;
private Action<UIApplication, T> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
uiApplication.Idling += UiApplicationOnIdling;
Expand Down Expand Up @@ -108,6 +114,9 @@ public class IdlingEventHandler<T0, T1> : ExternalEventHandler
private T1 _param1;
private Action<UIApplication, T0, T1> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
uiApplication.Idling += UiApplicationOnIdling;
Expand Down Expand Up @@ -158,6 +167,9 @@ public class IdlingEventHandler<T0, T1, T2> : ExternalEventHandler
private T2 _param2;
private Action<UIApplication, T0, T1, T2> _action;

/// <summary>
/// This method is called to handle the external event
/// </summary>
public override void Execute(UIApplication uiApplication)
{
uiApplication.Idling += UiApplicationOnIdling;
Expand Down
22 changes: 22 additions & 0 deletions Nice3point.Revit.Toolkit/Options/FamilyLoadOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ namespace Nice3point.Revit.Toolkit.Options;
/// </example>
public class FamilyLoadOptions : IFamilyLoadOptions
{
/// <summary>A method called when the family was found in the target document</summary>
/// <remarks>Triggered only when the family is both loaded and changed</remarks>
/// <param name="familyInUse">
/// Indicates if one or more instances of the family is placed in the project
/// </param>
/// <param name="overwriteParameterValues">
/// This determines whether or not to overwrite the parameter values of existing types. The default value is false
/// </param>
/// <returns>Return true to continue loading the family, false to cancel</returns>
public bool OnFamilyFound(bool familyInUse, out bool overwriteParameterValues)
{
overwriteParameterValues = false;
Expand Down Expand Up @@ -41,6 +50,19 @@ public bool OnFamilyFound(bool familyInUse, out bool overwriteParameterValues)
return true;
}

/// <summary>A method called when the shared family was found in the target document</summary>
/// <remarks>Triggered only when the family is both loaded and changed</remarks>
/// <param name="sharedFamily">The shared family in the current family document</param>
/// <param name="familyInUse">
/// Indicates if one or more instances of the family is placed in the project
/// </param>
/// <param name="source">
/// This indicates if the family will load from the project or the current family
/// </param>
/// <param name="overwriteParameterValues">
/// This indicates whether or not to overwrite the parameter values of existing types
/// </param>
/// <returns>Return true to continue loading the family, false to cancel</returns>
public bool OnSharedFamilyFound(Family sharedFamily, bool familyInUse, out FamilySource source, out bool overwriteParameterValues)
{
source = FamilySource.Family;
Expand Down

0 comments on commit 4fa12a1

Please sign in to comment.