Skip to content

Commit

Permalink
doument model store fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernsteinhagen committed Jan 22, 2025
1 parent 9846817 commit 17008f1
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public sealed class CsiSharedSendBinding : ISendBinding
public IBrowserBridge Parent { get; }

private readonly DocumentModelStore _store;
private readonly IAppIdleManager _idleManager;
private readonly IServiceProvider _serviceProvider;
private readonly List<ISendFilter> _sendFilters;
private readonly CancellationManager _cancellationManager;
Expand All @@ -40,7 +39,6 @@ public sealed class CsiSharedSendBinding : ISendBinding

public CsiSharedSendBinding(
DocumentModelStore store,
IAppIdleManager idleManager,
IBrowserBridge parent,
IEnumerable<ISendFilter> sendFilters,
IServiceProvider serviceProvider,
Expand All @@ -54,7 +52,6 @@ ICsiApplicationService csiApplicationService
)
{
_store = store;
_idleManager = idleManager;
_serviceProvider = serviceProvider;
_sendFilters = sendFilters.ToList();
_cancellationManager = cancellationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Speckle.Sdk.Common;

namespace Speckle.Connectors.CSiShared.HostApp;

/// <summary>
Expand All @@ -18,17 +20,14 @@ public interface ICsiApplicationService

public class CsiApplicationService : ICsiApplicationService
{
public cSapModel SapModel { get; private set; }
private cPluginCallback _pluginCallback;
private cSapModel? _sapModel;
public cSapModel SapModel => _sapModel.NotNull();

public CsiApplicationService()
{
SapModel = null!;
}
private cPluginCallback? _pluginCallback;

public void Initialize(cSapModel sapModel, cPluginCallback pluginCallback)
{
SapModel = sapModel;
_sapModel = sapModel;
_pluginCallback = pluginCallback;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected SpeckleFormBase()
ConfigureServices(services);

Container = services.BuildServiceProvider();
Container.UseDUI();
Container.UseDUI(false);

var webview = Container.GetRequiredService<DUI3ControlWebView>();
Host = new() { Child = webview, Dock = DockStyle.Fill };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public static IServiceCollection AddCsi(this IServiceCollection services)

services.AddSingleton<IBinding>(sp => sp.GetRequiredService<IBasicConnectorBinding>());
services.AddSingleton<IBasicConnectorBinding, CsiSharedBasicConnectorBinding>();
services.AddSingleton<IAppIdleManager, CsiIdleManager>();

services.AddSingleton<IBinding, CsiSharedSelectionBinding>();
services.AddSingleton<IBinding, CsiSharedSendBinding>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<Compile Include="$(MSBuildThisFileDirectory)GlobalUsing.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CsiApplicationService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CsiDocumentModelStore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CsiIdleManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServiceRegistration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\ObjectIdentifiers.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Result OnStartup(UIControlledApplication application)
services.AddRevitConverters();
services.AddSingleton(application);
_container = services.BuildServiceProvider();
_container.UseDUI(true);
_container.UseDUI(false);

// resolve root object
_revitPlugin = _container.GetRequiredService<IRevitPlugin>();
Expand Down
4 changes: 2 additions & 2 deletions DUI3/Speckle.Connectors.DUI/ContainerRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static IServiceCollection AddEventsAsTransient(this IServiceCollection se
return serviceCollection;
}

public static IServiceProvider UseDUI(this IServiceProvider serviceProvider, bool isRevit = false)
public static IServiceProvider UseDUI(this IServiceProvider serviceProvider, bool initializeDocumentStore = true)
{
//observe the unobserved!
TaskScheduler.UnobservedTaskException += async (_, args) =>
Expand All @@ -64,7 +64,7 @@ await serviceProvider
args.SetObserved();
};

if (!isRevit)
if (initializeDocumentStore)
{
serviceProvider.GetRequiredService<DocumentModelStore>().OnDocumentStoreInitialized().Wait();
}
Expand Down

0 comments on commit 17008f1

Please sign in to comment.