소스 검색

Improve calls to stop Syncthing

Antony Male 4 년 전
부모
커밋
c5732c2b5f
3개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. 1 1
      src/SyncTrayzor/Bootstrapper.cs
  2. 6 6
      src/SyncTrayzor/NotifyIcon/NotifyIconViewModel.cs
  3. 4 4
      src/SyncTrayzor/Pages/ShellViewModel.cs

+ 1 - 1
src/SyncTrayzor/Bootstrapper.cs

@@ -346,7 +346,7 @@ namespace SyncTrayzor
             this.exiting = true;
 
             // Try and be nice and close SyncTrayzor gracefully, before the Dispose call on SyncthingProcessRunning kills it dead
-            this.Container.Get<ISyncthingManager>().StopAsync().Wait(500);
+            this.Container.Get<ISyncthingManager>().StopAndWaitAsync().Wait(2000);
         }
 
         public override void Dispose()

+ 6 - 6
src/SyncTrayzor/NotifyIcon/NotifyIconViewModel.cs

@@ -153,21 +153,21 @@ namespace SyncTrayzor.NotifyIcon
         }
 
         public bool CanStop => this.SyncthingState == SyncthingState.Running;
-        public void Stop()
+        public async void Stop()
         {
-            this.syncthingManager.StopAsync();
+            await this.syncthingManager.StopAsync();
         }
 
         public bool CanRestart => this.SyncthingState == SyncthingState.Running;
-        public void Restart()
+        public async void Restart()
         {
-            this.syncthingManager.RestartAsync();
+            await this.syncthingManager.RestartAsync();
         }
 
         public bool CanRescanAll => this.SyncthingState == SyncthingState.Running;
-        public void RescanAll()
+        public async void RescanAll()
         {
-            this.syncthingManager.ScanAsync(null, null);
+            await this.syncthingManager.ScanAsync(null, null);
         }
 
         public void Exit()

+ 4 - 4
src/SyncTrayzor/Pages/ShellViewModel.cs

@@ -93,15 +93,15 @@ namespace SyncTrayzor.Pages
         }
 
         public bool CanStop => this.SyncthingState == SyncthingState.Running;
-        public void Stop()
+        public async void Stop()
         {
-            this.syncthingManager.StopAsync();
+            await this .syncthingManager.StopAsync();
         }
 
         public bool CanRestart => this.SyncthingState == SyncthingState.Running;
-        public void Restart()
+        public async void Restart()
         {
-            this.syncthingManager.RestartAsync();
+            await this.syncthingManager.RestartAsync();
         }
 
         public bool CanRefreshBrowser => this.SyncthingState == SyncthingState.Running;