public void Dispose(Boolean disposing) { if (disposing) { var frm = new ShutdownProgess(); try { frm.Show(); Logger.Debug("Disposing the Plugin Manager"); List <ControlHostWindow> temp = new List <ControlHostWindow>(_hostWindows); var itemCount = temp.Count + _extensions.Count; frm.progressBar.Maximum = itemCount; frm.progressBar.Value = 0; foreach (ControlHostWindow window in temp) { Logger.Debug("Disposing control host window '{0}'...", window.Title); frm.StatusMessage("Closing window " + window.Title); DoEvents(); try { window.Close(); window.Dispose(); } catch (Exception ex) { Logger.Warn("Exception occured whilst disposing host window '{0}' : {1}", window.Title, ex); } frm.progressBar.Value += 1; DoEvents(); } _extensions.ForEach((ext) => { Logger.Debug("Disposing extension '{0}'", ext); frm.StatusMessage("Unloading extension " + ext.Name); DoEvents(); try { ext.Dispose(); } catch (Exception ex) { Logger.Warn("Exception occured whilst disposing plugin '{0}' : {1}", ext, ex); } frm.progressBar.Value += 1; DoEvents(); }); _extensions.Clear(); frm.StatusMessage("Cleaning up temporary files..."); DoEvents(); Logger.Debug("Cleaning up resource temp files..."); _resourceTempFiles.CleanUp(); // Purge any temporary files that were created during the session Logger.Debug("Cleaning up generic temp files..."); TempFileManager.CleanUp(); TraitCategoryTypeHelper.Reset(); } finally { frm.Close(); } } }