Skip to content

Commit

Permalink
#51 - Include process names in message before installing package.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Dec 14, 2020
1 parent c5d7ab9 commit beabf5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ internal class ProcessKillContext
public ProcessKillContext(IReadOnlyCollection<string> names)
{
Ensure.NotNull(names, "names");
ProcessNames = names;
targets = names.SelectMany(name => Process.GetProcessesByName(name)).ToList();
}

public IReadOnlyCollection<string> ProcessNames { get; }

public int ProcessCount { get => targets.Count; }

public bool IsExecutable => targets.Count > 0;

public void Execute()
Expand Down
7 changes: 5 additions & 2 deletions src/PackageManager.UI/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ private Task<bool> OnBeforeChange()
var context = processes.PrepareContextForProcessesKillBeforeChange();
if (context.IsExecutable)
{
var processNames = string.Join(" and ", context.ProcessNames);
if (context.ProcessCount > 1 || context.ProcessNames.Count > 1)
processNames = $"all instances of {processNames}";

bool result = navigator.Confirm(
"Plugin Manager",
"Plugin Manager is going to write to files that are holded by other executables. " + Environment.NewLine +
"Do you want to kill all instances of these applications?"
$"Plugin Manager will be writing to files that are currently in use.\r\n\r\nDo you want to stop {processNames}?"
);

if (result)
Expand Down

0 comments on commit beabf5e

Please sign in to comment.