public async Task UnmountAsync() { if (MountLetter == null) { return; } if (App == null) { throw new NullReferenceException(); } unmounting = true; NotifyMount(); try { await Task.Factory.StartNew(() => { using (unmountingEvent = new ManualResetEventSlim(false)) { VirtualDriveWrapper.Unmount((char)MountLetter); unmountingEvent.Wait(); } }); MountLetter = null; Provider.Stop(); model.NotifyUnmount(cloudInfo.Id); } finally { unmounting = false; NotifyMount(); } }
internal async Task Unmount() { if (mounted == 0) { return; } VirtualDriveWrapper.Unmount((char)mountedLetter); await mountTask; }
private void Application_Exit(object sender, ExitEventArgs e) { if (notifyIcon != null) { notifyIcon.Dispose(); } if (mounted == 0) { return; } VirtualDriveWrapper.Unmount((char)mountedLetter); mountTask.Wait(); }