mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 15:16:31 +00:00
add db WIP 2, 80%
refactor, renames
This commit is contained in:
@@ -3,10 +3,12 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Azaion.Annotator.Extensions;
|
||||
using Azaion.Common.Database;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.Extensions;
|
||||
using Azaion.Common.Services;
|
||||
using Azaion.Dataset;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SharpVectors.Converters;
|
||||
@@ -19,13 +21,23 @@ public partial class MainSuite
|
||||
private readonly IConfigUpdater _configUpdater;
|
||||
private readonly IEnumerable<IAzaionModule> _modules;
|
||||
private readonly IServiceProvider _sp;
|
||||
private readonly IGalleryService _galleryService;
|
||||
private readonly IDbFactory _dbFactory;
|
||||
private readonly Dictionary<WindowEnum, Window> _openedWindows = new();
|
||||
|
||||
public MainSuite(IOptions<AppConfig> appConfig, IConfigUpdater configUpdater, IEnumerable<IAzaionModule> modules, IServiceProvider sp )
|
||||
public MainSuite(IOptions<AppConfig> appConfig,
|
||||
IConfigUpdater configUpdater,
|
||||
IEnumerable<IAzaionModule> modules,
|
||||
IServiceProvider sp,
|
||||
IGalleryService galleryService,
|
||||
IDbFactory dbFactory
|
||||
)
|
||||
{
|
||||
_configUpdater = configUpdater;
|
||||
_modules = modules;
|
||||
_sp = sp;
|
||||
_galleryService = galleryService;
|
||||
_dbFactory = dbFactory;
|
||||
_appConfig = appConfig.Value;
|
||||
InitializeComponent();
|
||||
Loaded += OnLoaded;
|
||||
@@ -76,7 +88,8 @@ public partial class MainSuite
|
||||
ListView.Items.Add(lvItem);
|
||||
}
|
||||
|
||||
|
||||
_ = Task.Run(async () => await _galleryService.RefreshThumbnails());
|
||||
|
||||
//by default show first
|
||||
ListView.SelectedIndex = 0;
|
||||
OpenWindow((ListView.Items[0] as ListViewItem)!);
|
||||
@@ -115,6 +128,7 @@ public partial class MainSuite
|
||||
private void OnFormClosed(object? sender, EventArgs e)
|
||||
{
|
||||
_configUpdater.Save(_appConfig);
|
||||
_dbFactory.SaveToDisk();
|
||||
foreach (var window in _openedWindows)
|
||||
window.Value.Close();
|
||||
Application.Current.Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user