Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bjorn/cnx-1087-event-aggregator-w-csi #516

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading