From 4e7d453c628e427d55e50e8b87df69fd56b5c3c7 Mon Sep 17 00:00:00 2001 From: kike-garbo Date: Thu, 2 May 2024 14:39:17 +0200 Subject: [PATCH] Fix on `AddIn.Loader` it was loading Rhino unnecessarily. --- src/RhinoInside.Revit.AddIn/Loader.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/RhinoInside.Revit.AddIn/Loader.cs b/src/RhinoInside.Revit.AddIn/Loader.cs index 56ec05042..e2f90c451 100644 --- a/src/RhinoInside.Revit.AddIn/Loader.cs +++ b/src/RhinoInside.Revit.AddIn/Loader.cs @@ -121,8 +121,16 @@ static async void CheckForUpdates() #endregion #region IHostedApplication - void ERUI.IHostedApplication.InvokeInHostContext(Action action) => Rhinoceros.InvokeInHostContext(action); - T ERUI.IHostedApplication.InvokeInHostContext(Func func) => Rhinoceros.InvokeInHostContext(func); + void ERUI.IHostedApplication.InvokeInHostContext(Action action) + { + if (Core.CurrentStatus == Core.Status.Ready) Rhinoceros.InvokeInHostContext(action); + else action(); + } + T ERUI.IHostedApplication.InvokeInHostContext(Func func) + { + if (Core.CurrentStatus == Core.Status.Ready) return Rhinoceros.InvokeInHostContext(func); + else return func(); + } bool ERUI.IHostedApplication.DoEvents() => Rhinoceros.Run(); Microsoft.Win32.SafeHandles.WindowHandle ERUI.IHostedApplication.MainWindow => Rhinoceros.MainWindow;