优化窗体socpe使用
This commit is contained in:
parent
90e885ce70
commit
716eeca4bb
@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Falcon.SugarCore.DbContextExtensions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PrivateBox.DataContext;
|
||||
using PrivateBox.Encryption;
|
||||
@ -15,7 +16,6 @@ namespace PrivateBox
|
||||
public AppRunTimeSettings Settings { get; set; }
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认分组名
|
||||
/// </summary>
|
||||
@ -28,8 +28,13 @@ namespace PrivateBox
|
||||
/// </summary>
|
||||
private bool EnableRefreshKeyList = true;
|
||||
|
||||
public MainForm(IServiceProvider provider) {
|
||||
public MainForm(IServiceScopeFactory factory) {
|
||||
InitializeComponent();
|
||||
var serviceScope = factory.CreateScope();
|
||||
this.FormClosing += (s,d) => {
|
||||
serviceScope?.Dispose();
|
||||
};
|
||||
var provider = serviceScope.ServiceProvider;
|
||||
this.Encrytion = provider.GetRequiredService<IEncryptionService>();
|
||||
this.Db = provider.GetRequiredService<DbContext>();
|
||||
this.Settings = provider.GetRequiredService<AppRunTimeSettings>();
|
||||
@ -41,6 +46,7 @@ namespace PrivateBox
|
||||
RefreshKeyList();
|
||||
};
|
||||
|
||||
|
||||
this.lbKeyList.SelectedIndexChanged += LbKeyList_SelectedIndexChanged;
|
||||
this.clb_group.ItemCheck += (s,e) => {
|
||||
this.BeginInvoke(new Action(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user