InkForge/app/InkForge.Desktop/Models/Workspace.cs

32 lines
604 B
C#
Raw Normal View History

using InkForge.Desktop.Data.Options;
2024-02-16 02:23:58 +01:00
using Microsoft.Extensions.DependencyInjection;
namespace InkForge.Desktop.Models;
2024-05-02 21:44:13 +02:00
public sealed class Workspace(IServiceScope scope) : IDisposable
2024-02-16 02:23:58 +01:00
{
private bool _disposedValue;
2024-05-02 21:44:13 +02:00
private IServiceScope? _scope = scope;
public string Name { get; set; } = default!;
public LocalWorkspaceOptions Options { get; set; } = default!;
2024-05-02 21:44:13 +02:00
public IServiceProvider Services { get; } = scope.ServiceProvider;
public void Dispose()
{
if (!_disposedValue)
{
2024-03-17 22:27:01 +01:00
if (_scope is { })
{
_scope.Dispose();
_scope = null;
}
_disposedValue = true;
}
}
2024-02-16 02:23:58 +01:00
}