31 lines
604 B
C#
31 lines
604 B
C#
using InkForge.Desktop.Data.Options;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace InkForge.Desktop.Models;
|
|
|
|
public sealed class Workspace(IServiceScope scope) : IDisposable
|
|
{
|
|
private bool _disposedValue;
|
|
private IServiceScope? _scope = scope;
|
|
|
|
public string Name { get; set; } = default!;
|
|
|
|
public LocalWorkspaceOptions Options { get; set; } = default!;
|
|
|
|
public IServiceProvider Services { get; } = scope.ServiceProvider;
|
|
|
|
public void Dispose()
|
|
{
|
|
if (!_disposedValue)
|
|
{
|
|
if (_scope is { })
|
|
{
|
|
_scope.Dispose();
|
|
_scope = null;
|
|
}
|
|
|
|
_disposedValue = true;
|
|
}
|
|
}
|
|
}
|