private bool disposed = false; // to detect redundant calls protected override void Dispose(bool disposing) { if (!disposed) { if (disposing) { // dispose-only, i.e. non-finalizable logic _dashboardService?.Dispose(); } disposed = true; } base.Dispose(disposing); }
public void Stop() { if (this.Running && this.host != null) { this.Running = false; this.host.Dispose(); DashboardService.Dispose(); Servers.Remove(this); _reloader.StopWatchingFile(FileName); } }
public void Stop() { if (this.Running && this.host != null) { this.Running = false; this.host.StopAsync(TimeSpan.FromSeconds(1)).Wait(); DashboardService.Dispose(); Servers.Remove(this); _reloader.StopWatchingFile(FileName); } }