Skip to content

Commit

Permalink
Add UseDesignApplicationLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Jan 20, 2025
1 parent acda5cf commit 786ea25
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.0.0-beta</Version>
<Version>1.0.0-beta.1</Version>
</PropertyGroup>
</Project>
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ public class App : DesignApplication
}
```

#### UseDesignApplicationLoader

The `UseDesignApplicationLoader` is `true` by default to force the Design Automation to support `PackageContents.xml` with multiple versions.
```C#
public class App : DesignApplication
{
public override bool UseDesignApplicationLoader => false; // true by default
}
```

## License

This project is [licensed](LICENSE) under the [MIT License](https://en.wikipedia.org/wiki/MIT_License).
Expand Down
11 changes: 9 additions & 2 deletions ricaun.Revit.DA/DesignApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ namespace ricaun.Revit.DA
public abstract class DesignApplication : IExternalDBApplication, IDesignAutomation
{
/// <summary>
/// Use ExternalService to execute the IDesignAutomation.Execute, this make the Execute run in the AddIn context.
/// Use ExternalService to execute the IDesignAutomation.Execute, this make the Execute run in the AddIn Context.
/// </summary>
public virtual bool UseExternalService => true;
/// <summary>
/// Use DesignApplicationLoader to load the correct version of the DesignApplication based in the `PackageContents.xml` configuration.
/// </summary>
public virtual bool UseDesignApplicationLoader => true;
public ControlledApplication ControlledApplication { get; private set; }
public abstract void OnStartup();
public abstract void OnShutdown();
Expand All @@ -24,7 +28,10 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application)
{
ControlledApplication = application;

designApplication = DesignApplicationLoader.LoadVersion(this);
designApplication = this;

if (UseDesignApplicationLoader)
designApplication = DesignApplicationLoader.LoadVersion(this);

if (designApplication is IExternalDBApplication)
{
Expand Down

0 comments on commit 786ea25

Please sign in to comment.