From 9a762844636d4e89e3d516a62aa9af1506dfb496 Mon Sep 17 00:00:00 2001 From: Jeirc-X Date: Fri, 9 Aug 2024 22:59:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E7=B2=92=E5=BA=A6=E5=BC=80?= =?UTF-8?q?=E5=85=B3=EF=BC=8CUI=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Clipboard/ClipboardFactoryBase.cs | 4 +-- .../SyncService/DownloadService.cs | 1 + .../ViewModels/SyncSettingViewModel.cs | 5 ++++ .../Views/SyncSettingPage.axaml | 25 +++++++++++++++++++ .../Views/SyncSettingPage.xaml | 22 ++++++++++++++-- 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/SyncClipboard.Core/Clipboard/ClipboardFactoryBase.cs b/src/SyncClipboard.Core/Clipboard/ClipboardFactoryBase.cs index 8e035485..b6fc6b6c 100644 --- a/src/SyncClipboard.Core/Clipboard/ClipboardFactoryBase.cs +++ b/src/SyncClipboard.Core/Clipboard/ClipboardFactoryBase.cs @@ -80,9 +80,9 @@ ex is JsonException || { return await UploadAndReturnBlankProfile(cancelToken); } - catch + catch (Exception ex) { - Logger.Write("CreateFromRemote failed"); + Logger.Write($"CreateFromRemote failed {ex}"); throw; } } diff --git a/src/SyncClipboard.Core/UserServices/SyncService/DownloadService.cs b/src/SyncClipboard.Core/UserServices/SyncService/DownloadService.cs index d6384462..c166cb87 100644 --- a/src/SyncClipboard.Core/UserServices/SyncService/DownloadService.cs +++ b/src/SyncClipboard.Core/UserServices/SyncService/DownloadService.cs @@ -288,6 +288,7 @@ private void SetStatusOnError(ref int errorTimes, Exception ex) private async Task PullLoop(CancellationToken cancelToken) { int errorTimes = 0; + await Task.Delay(TimeSpan.FromSeconds(0.5), cancelToken); while (!cancelToken.IsCancellationRequested && (_isQuickDownload || SwitchOn)) { await SyncService.remoteProfilemutex.WaitAsync(cancelToken); diff --git a/src/SyncClipboard.Core/ViewModels/SyncSettingViewModel.cs b/src/SyncClipboard.Core/ViewModels/SyncSettingViewModel.cs index ce65183b..9dff3d61 100644 --- a/src/SyncClipboard.Core/ViewModels/SyncSettingViewModel.cs +++ b/src/SyncClipboard.Core/ViewModels/SyncSettingViewModel.cs @@ -207,6 +207,11 @@ public SyncSettingViewModel(ConfigManager configManager, MainViewModel mainViewM notifyOnManualUpload = clientConfig.NotifyOnManualUpload; doNotUploadWhenCut = clientConfig.DoNotUploadWhenCut; trustInsecureCertificate = clientConfig.TrustInsecureCertificate; + uploadEnable = clientConfig.PushSwitchOn; + downloadEnable = clientConfig.PullSwitchOn; + textEnable = clientConfig.EnableUploadText; + singleFileEnable = clientConfig.EnableUploadSingleFile; + multiFileEnable = clientConfig.EnableUploadMultiFile; } public string? SetServerConfig(string portString, string username, string password) diff --git a/src/SyncClipboard.Desktop/Views/SyncSettingPage.axaml b/src/SyncClipboard.Desktop/Views/SyncSettingPage.axaml index 9adc56ac..35572dbf 100644 --- a/src/SyncClipboard.Desktop/Views/SyncSettingPage.axaml +++ b/src/SyncClipboard.Desktop/Views/SyncSettingPage.axaml @@ -147,6 +147,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/SyncClipboard.WinUI3/Views/SyncSettingPage.xaml b/src/SyncClipboard.WinUI3/Views/SyncSettingPage.xaml index 07a7f057..1a8828aa 100644 --- a/src/SyncClipboard.WinUI3/Views/SyncSettingPage.xaml +++ b/src/SyncClipboard.WinUI3/Views/SyncSettingPage.xaml @@ -75,12 +75,15 @@ - + - + @@ -126,6 +129,21 @@ + + + + + + + + + + + + + + +