public void PrepateToQuit() { lock (_downloadslock) { foreach (DownloadItem d in _downloads) { Cancel(d.Id); } } Save(); }