Преглед изворни кода

Improve calls to stop Syncthing

Antony Male пре 4 година
родитељ
комит
c5732c2b5f

+ 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;