コード例 #1
0
        public void SearchForAndRemoveProgramFilesJunk(IEnumerable <ApplicationUninstallerEntry> allUninstallers)
        {
            if (!TryGetUninstallLock())
            {
                return;
            }

            try
            {
                _lockApplication(true);

                var junk  = new List <IJunkResult>();
                var error = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleLookingForJunk,
                                                     x => junk.AddRange(JunkManager.FindProgramFilesJunk(allUninstallers.Where(y => y.RegKeyStillExists()).ToList())));

                if (error != null)
                {
                    PremadeDialogs.GenericError(error);
                }
                else
                {
                    ShowJunkWindow(junk);
                }
            }
            finally
            {
                ReleaseUninstallLock();
                _lockApplication(false);
            }
        }
コード例 #2
0
        public void AdvancedUninstall(IEnumerable <ApplicationUninstallerEntry> selectedUninstallers,
                                      IEnumerable <ApplicationUninstallerEntry> allUninstallers)
        {
            if (!TryGetUninstallLock())
            {
                return;
            }
            var listRefreshNeeded = false;

            try
            {
                _lockApplication(true);

                listRefreshNeeded = SearchForAndRemoveJunk(
                    () => JunkManager.FindJunk(selectedUninstallers, allUninstallers.Where(y => y.RegKeyStillExists())));
            }
            finally
            {
                ReleaseUninstallLock();
                _lockApplication(false);
                if (listRefreshNeeded)
                {
                    _initiateListRefresh();
                }
            }
        }
コード例 #3
0
        private void SearchForAndRemoveJunk(IEnumerable <ApplicationUninstallerEntry> selectedUninstallers,
                                            IEnumerable <ApplicationUninstallerEntry> allUninstallers)
        {
            //if (!TryGetUninstallLock()) return;
            //var listRefreshNeeded = false;

            if (MessageBoxes.LookForJunkQuestion())
            {
                SearchForAndRemoveJunk(
                    () => JunkManager.FindJunk(selectedUninstallers, allUninstallers.Where(y => y.RegKeyStillExists())));
            }
        }
コード例 #4
0
        /// <summary>
        ///     Returns true if things were actually removed, false if user cancelled the operation.
        /// </summary>
        private bool SearchForAndRemoveJunk(IEnumerable <ApplicationUninstallerEntry> selectedUninstallers,
                                            IEnumerable <ApplicationUninstallerEntry> allUninstallers)
        {
            var junk  = new List <IJunkResult>();
            var error = LoadingDialog.ShowDialog(MessageBoxes.DefaultOwner, Localisable.LoadingDialogTitleLookingForJunk,
                                                 dialogInterface =>
            {
                var allValidUninstallers = allUninstallers.Where(y => y.RegKeyStillExists());

                dialogInterface.SetSubProgressVisible(true);
                junk.AddRange(JunkManager.FindJunk(selectedUninstallers, allValidUninstallers.ToList(), x =>
                {
                    if (x.TotalCount <= 1)
                    {
                        // Don't update the title label to uninstaller name when there's only one uninstaller
                        dialogInterface.SetMaximum(-1);
                    }
                    else
                    {
                        dialogInterface.SetMaximum(x.TotalCount);
                        dialogInterface.SetProgress(x.CurrentCount, x.Message);
                    }

                    var inner = x.Inner;
                    if (inner != null)
                    {
                        dialogInterface.SetSubMaximum(inner.TotalCount);
                        dialogInterface.SetSubProgress(inner.CurrentCount, inner.Message);
                    }
                    else
                    {
                        dialogInterface.SetSubMaximum(-1);
                        dialogInterface.SetSubProgress(0, string.Empty);
                    }

                    if (dialogInterface.Abort)
                    {
                        throw new OperationCanceledException();
                    }
                }));
            });

            if (error != null)
            {
                PremadeDialogs.GenericError(error);
            }
            else
            {
                return(ShowJunkWindow(junk));
            }
            return(false);
        }
コード例 #5
0
        public void SearchForAndRemoveProgramFilesJunk(IEnumerable <ApplicationUninstallerEntry> allUninstallers)
        {
            if (!TryGetUninstallLock())
            {
                return;
            }

            try
            {
                _lockApplication(true);

                SearchForAndRemoveJunk(() => JunkManager.FindProgramFilesJunk(allUninstallers
                                                                              .Where(y => y.RegKeyStillExists())));
            }
            finally
            {
                ReleaseUninstallLock();
                _lockApplication(false);
            }
        }