private void toolStripButtonRun_Click(object sender, EventArgs e)
        {
            var targetGroups = SelectedTaskEntries.GroupBy(x => x.IsRunning).ToList();
            var running      = targetGroups.SingleOrDefault(x => x.Key);
            var notRunning   = targetGroups.SingleOrDefault(x => !x.Key);

            if (running != null && running.Any())
            {
                MessageBoxes.ForceRunUninstallFailedError(this,
                                                          running.Select(x => x.UninstallerEntry.DisplayName).OrderBy(x => x));
            }

            if (notRunning == null || !notRunning.Any())
            {
                return;
            }

            foreach (var target in notRunning)
            {
                target.Reset();
            }

            OnTaskUpdated();

            if (_currentTargetStatus.Finished)
            {
                _currentTargetStatus.Start();
            }
        }
        private void objectListView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ste = SelectedTaskEntries.ToList();

            toolStripButtonFolderOpen.Enabled = ste.Any(x => x.UninstallerEntry.InstallLocation.IsNotEmpty());
            toolStripButtonProperties.Enabled = ste.Any();

            toolStripButtonRun.Enabled = ste.Any(x =>
                                                 x.CurrentStatus == UninstallStatus.Waiting || x.CurrentStatus == UninstallStatus.Failed ||
                                                 x.CurrentStatus == UninstallStatus.Skipped);

            toolStripButtonSkip.Enabled = ste.Any(x =>
                                                  x.CurrentStatus != UninstallStatus.Skipped && x.CurrentStatus != UninstallStatus.Completed &&
                                                  x.CurrentStatus != UninstallStatus.Invalid && x.CurrentStatus != UninstallStatus.Protected &&
                                                  !(x.CurrentStatus == UninstallStatus.Uninstalling &&
                                                    x.UninstallerEntry.UninstallerKind == UninstallerType.Msiexec));

            toolStripButtonTerminate.Enabled = ste.Any(x => x.CurrentStatus == UninstallStatus.Uninstalling);
        }
        private void toolStripButtonManualUninstall_Click(object sender, EventArgs e)
        {
            var targetGroups = SelectedTaskEntries.GroupBy(x => x.IsRunning).ToList();
            var running      = targetGroups.SingleOrDefault(x => x.Key);
            var notRunning   = targetGroups.SingleOrDefault(x => !x.Key);

            if (running != null && running.Any())
            {
                MessageBoxes.ForceRunUninstallFailedError(this,
                                                          running.Select(x => x.UninstallerEntry.DisplayName).OrderBy(x => x));
            }

            if (notRunning == null || !notRunning.Any())
            {
                return;
            }

            foreach (var bulkUninstallEntry in notRunning)
            {
                bulkUninstallEntry.Pause();
            }

            var result = _uninstallManuallyAction(notRunning.Select(x => x.UninstallerEntry));

            foreach (var bulkUninstallEntry in notRunning)
            {
                if (result)
                {
                    bulkUninstallEntry.ForceFinished();
                }
                else
                {
                    bulkUninstallEntry.Resume();
                }
            }

            OnTaskUpdated();
        }
 private void toolStripButtonSkip_Click(object sender, EventArgs e)
 {
     SelectedTaskEntries.ForEach(x => x.SkipWaiting(false));
 }