parent
14372d1e00
commit
36ba0eadd5
40
App.xaml.cs
40
App.xaml.cs
|
|
@ -1,4 +1,6 @@
|
||||||
using System.IO;
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using HeBianGu.Base.WpfBase;
|
using HeBianGu.Base.WpfBase;
|
||||||
|
|
@ -6,14 +8,10 @@ using HeBianGu.Control.Guide;
|
||||||
using HeBianGu.Control.ThemeSet;
|
using HeBianGu.Control.ThemeSet;
|
||||||
using HeBianGu.General.WpfControlLib;
|
using HeBianGu.General.WpfControlLib;
|
||||||
using HeBianGu.Service.Mvp;
|
using HeBianGu.Service.Mvp;
|
||||||
using HeBianGu.Systems.About;
|
|
||||||
using HeBianGu.Systems.Identity;
|
using HeBianGu.Systems.Identity;
|
||||||
using HeBianGu.Systems.Setting;
|
using HeBianGu.Systems.Setting;
|
||||||
using Hopetry.Services;
|
using Hopetry.Services;
|
||||||
using SystemSetting = FileUploader.Models.SystemSetting;
|
using SystemSetting = FileUploader.Models.SystemSetting;
|
||||||
using System.Configuration;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace HeBianGu.App.Disk
|
namespace HeBianGu.App.Disk
|
||||||
{
|
{
|
||||||
|
|
@ -27,6 +25,7 @@ namespace HeBianGu.App.Disk
|
||||||
return new ShellWindow();
|
return new ShellWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void ConfigureServices(IServiceCollection services)
|
protected override void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
base.ConfigureServices(services);
|
base.ConfigureServices(services);
|
||||||
|
|
@ -46,10 +45,14 @@ namespace HeBianGu.App.Disk
|
||||||
{
|
{
|
||||||
setting.TaskCount = 3;
|
setting.TaskCount = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//minioService.MirrorAsync1(bucketName, setting.SyncDir, setting.TaskCount);
|
//minioService.MirrorAsync1(bucketName, setting.SyncDir, setting.TaskCount);
|
||||||
|
if (SyncSetting.Instance.IsOn)
|
||||||
|
{
|
||||||
minioService.RealTimeListen(bucketName, setting.SyncDir);
|
minioService.RealTimeListen(bucketName, setting.SyncDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
services.AddWindowDialog();
|
services.AddWindowDialog();
|
||||||
services.AddObjectWindowDialog();
|
services.AddObjectWindowDialog();
|
||||||
|
|
@ -134,7 +137,11 @@ namespace HeBianGu.App.Disk
|
||||||
protected override void Configure(IApplicationBuilder app)
|
protected override void Configure(IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
base.Configure(app);
|
base.Configure(app);
|
||||||
app.UseSetting(x => { x.Settings.Add(MySetting.Instance); });
|
app.UseSetting(x =>
|
||||||
|
{
|
||||||
|
x.Settings.Add(MySetting.Instance);
|
||||||
|
x.Settings.Add(SyncSetting.Instance);
|
||||||
|
});
|
||||||
app.UseStyle();
|
app.UseStyle();
|
||||||
//app.UseSettingDefault();
|
//app.UseSettingDefault();
|
||||||
// Do:设置默认主题
|
// Do:设置默认主题
|
||||||
|
|
@ -158,7 +165,26 @@ namespace HeBianGu.App.Disk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Displayer(Name = "关机设置", GroupName = "是否关机")]
|
|
||||||
|
[Displayer(Name = "同步设置", GroupName = "通用设置")]
|
||||||
|
public class SyncSetting : LazySettingInstance<SyncSetting>
|
||||||
|
{
|
||||||
|
private bool _ison;
|
||||||
|
|
||||||
|
[DefaultValue(false)]
|
||||||
|
[Display(Name = "自动同步")]
|
||||||
|
public bool IsOn
|
||||||
|
{
|
||||||
|
get { return _ison; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ison = value;
|
||||||
|
RaisePropertyChanged("IsOn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Displayer(Name = "关机设置", GroupName = "通用设置")]
|
||||||
public class MySetting : LazySettingInstance<MySetting>
|
public class MySetting : LazySettingInstance<MySetting>
|
||||||
{
|
{
|
||||||
private bool _ison;
|
private bool _ison;
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ public class SyncViewModel : MvcViewModelBase
|
||||||
_serializerService.Save("./settings.xml", _setting);
|
_serializerService.Save("./settings.xml", _setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<object> SyncDataQuick()
|
private async Task SyncDataQuick()
|
||||||
{
|
{
|
||||||
return _minioService.MirrorAsync1(_minioService._bucketName, SyncDir, _taskCount);
|
await Task.Run(async () => await _minioService.MirrorAsync1(_minioService._bucketName, SyncDir, _taskCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Loaded(string args)
|
protected override void Loaded(string args)
|
||||||
|
|
@ -114,7 +114,6 @@ public class SyncViewModel : MvcViewModelBase
|
||||||
|
|
||||||
private async Task Button_OpenTargetDir()
|
private async Task Button_OpenTargetDir()
|
||||||
{
|
{
|
||||||
|
|
||||||
// 验证目录是否存在
|
// 验证目录是否存在
|
||||||
if (!Directory.Exists(SyncDir))
|
if (!Directory.Exists(SyncDir))
|
||||||
{
|
{
|
||||||
|
|
@ -138,6 +137,7 @@ public class SyncViewModel : MvcViewModelBase
|
||||||
MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ButtonBase_OnClick()
|
private async Task ButtonBase_OnClick()
|
||||||
{
|
{
|
||||||
CommonOpenFileDialog dialog = new CommonOpenFileDialog
|
CommonOpenFileDialog dialog = new CommonOpenFileDialog
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
/*
|
/*{
|
||||||
{
|
|
||||||
"Minio": {
|
"Minio": {
|
||||||
"Endpoint": "123.132.248.154:9107",
|
"Endpoint": "123.132.248.154:9107",
|
||||||
"AccessKey": "oZNgo25pNXnKFV9oKGh4",
|
"AccessKey": "oZNgo25pNXnKFV9oKGh4",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue