コード例 #1
0
        private async Task RefreshProcessListAsync(bool keepSelectedProcess)
        {
            if (ProcessListViewModel?.Processes == null)
            {
                return;
            }

            ProcessListViewModel.PerformanceCounterViewModel?.Dispose();

            var selectedProcess     = ProcessListViewModel.SelectedProcess;
            var filter              = ProcessListViewModel.CollectionView?.Filter;
            var loadProcessTask     = ProcessListViewModel?.LoadProcessesAsync();
            var refreshInstanceTask = Task.Run(() => PerformanceCounterUtil.RefreshInstances());

            await loadProcessTask;

            if (filter != null)
            {
                ProcessListViewModel.CollectionView.Filter = filter;
            }
            if (keepSelectedProcess)
            {
                ProcessListViewModel.Select(selectedProcess?.ProcessId);
            }
            await refreshInstanceTask;
        }
コード例 #2
0
        private void OnFind(WindowInfo windowInfo)
        {
            if (windowInfo.HWnd != IntPtr.Zero)
            {
                NativeMethods.GetWindowThreadProcessId(windowInfo.HWnd, out int processId);

                ProcessListViewModel.Select(processId);
            }
        }
コード例 #3
0
 public MainWindowViewModel(ProcessListViewModel processListViewModel)
 {
     ProcessListViewModel      = processListViewModel;
     RefreshProcessListCommand = new DelegateCommand(OnRefreshProcessList);
     CompactMemoryCommand      = new DelegateCommand(OnCompactMemory);
     CustomizeCommand          = new DelegateCommand(OnCustomize);
     MouseDownCommand          = new DelegateCommand(OnMouseDown);
     OnFindAction = new Action <WindowInfo>(OnFind);
 }