mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-03 03:19:08 +08:00
Restored functionality
This commit is contained in:
parent
828e16e88c
commit
28c6847fb6
@ -7,6 +7,7 @@ namespace PowerToys.FileLocksmithUI.ViewModels
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -68,12 +69,12 @@ namespace PowerToys.FileLocksmithUI.ViewModels
|
||||
IsLoading = true;
|
||||
Processes.Clear();
|
||||
|
||||
// paths = NativeMethods.ReadPathsFromStdin();
|
||||
paths = new string[1] { "C:\\Program Files" };
|
||||
paths = NativeMethods.ReadPathsFromFile();
|
||||
|
||||
foreach (ProcessResult p in await FindProcesses(paths))
|
||||
{
|
||||
Processes.Add(p);
|
||||
WatchProcess(p);
|
||||
}
|
||||
|
||||
IsLoading = false;
|
||||
@ -89,19 +90,21 @@ namespace PowerToys.FileLocksmithUI.ViewModels
|
||||
return results;
|
||||
}
|
||||
|
||||
private async void WatchProcess(ProcessResult process)
|
||||
{
|
||||
if (await Task.Run(() => NativeMethods.WaitForProcess(process.pid)))
|
||||
{
|
||||
Processes.Remove(process);
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void EndTask(ProcessResult selectedProcess)
|
||||
{
|
||||
Processes.Remove(selectedProcess);
|
||||
|
||||
// if (NativeMethods.KillProcess(process.pid))
|
||||
// {
|
||||
// Processes.Remove(selectedProcess);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // TODO show something on failure.
|
||||
// }
|
||||
if (!NativeMethods.KillProcess(selectedProcess.pid))
|
||||
{
|
||||
// TODO show something on failure.
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
Loading…
Reference in New Issue
Block a user