protected virtual void OnUninstallerPostprocessingProgressUpdate(CountingUpdateEventArgs y) { lock (_objectsToUpdate) { if (y.Tag != null) { _objectsToUpdate.Add(y.Tag); } if (y.Value == y.Maximum || _objectsToUpdate.Count % 35 == 0) { try { _updateItemsCallback(_objectsToUpdate.ToList()); } catch (SystemException ex) { // The list view got disposed before we could update it. AbortPostprocessingThread(); Debug.Fail(ex.Message, ex.StackTrace); } _objectsToUpdate.Clear(); } } UninstallerPostprocessingProgressUpdate?.Invoke(this, y); }
private void UninstallerPostprocessingThread(object targets) { var items = targets as IEnumerable <ApplicationUninstallerEntry>; if (items == null) { return; } var targetList = items as IList <ApplicationUninstallerEntry> ?? items.ToList(); var currentCount = 1; foreach (var uninstaller in targetList) { if (_abortPostprocessingThread) { UninstallerPostprocessingProgressUpdate?.Invoke(this, new CountingUpdateEventArgs(0, 0, 0)); return; } var sendTag = true; if (_settings.Settings.AdvancedTestCertificates) { lock (UninstallerFileLock) { sendTag = uninstaller.GetCertificate() != null; } } var countingUpdateEventArgs = new CountingUpdateEventArgs(0, targetList.Count, currentCount); if (sendTag) { countingUpdateEventArgs.Tag = uninstaller; } UninstallerPostprocessingProgressUpdate?.Invoke(this, countingUpdateEventArgs); currentCount++; } }