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) { OnUninstallerPostprocessingProgressUpdate(new CountingUpdateEventArgs(0, 0, 0)); return; } var sendTag = true; if (_settings.Settings.AdvancedTestCertificates) { lock (UninstallerFileLock) { var cert = GetCert(uninstaller); sendTag = cert != null; } } var countingUpdateEventArgs = new CountingUpdateEventArgs(0, targetList.Count, currentCount); if (sendTag) { countingUpdateEventArgs.Tag = uninstaller; } OnUninstallerPostprocessingProgressUpdate(countingUpdateEventArgs); currentCount++; } }
private void UninstallerPostprocessingThread() { while (true) { int count; ApplicationUninstallerEntry target = null; lock (_itemsToProcess) { count = _itemsToProcess.Count; if (count > 0) { target = _itemsToProcess.Dequeue(); } } if (count == 0 || _abortPostprocessingThread) { _finalizerThread = null; OnUninstallerPostprocessingProgressUpdate(new CountingUpdateEventArgs(0, 0, 0)); return; } var sendTag = true; if (_settings.Settings.AdvancedTestCertificates) { lock (UninstallerFileLock) { var cert = GetCert(target); sendTag = cert != null; } } var countingUpdateEventArgs = new CountingUpdateEventArgs(0, count, 0); if (sendTag) { countingUpdateEventArgs.Tag = target; } OnUninstallerPostprocessingProgressUpdate(countingUpdateEventArgs); } }