Ejemplo n.º 1
0
        public bool Stop(HostControl hostControl)
        {
            Runners.Cancel();
            Globals.NotificationCenter.InvokeAsync(x => x.OnServiceStopped());

            foreach (var volume in Globals.Database.Table <DiskModel>().ToList())
            {
                try
                {
                    var mountPoint = Globals.Database.GetMountPoint(volume.Id);
                    Dokan.RemoveMountPoint(mountPoint);
                    if (Globals.Volumes.TryRemove(volume.Id, out var thread))
                    {
                        thread.Dispose();
                    }
                }
                catch
                {
                    // Ignored. Terminating.
                }
            }

            Globals.CloudService.Dispose();
            Globals.Database.Dispose();

            Logger.LogInformation("Windows service stopped.");

            return(true);
        }