コード例 #1
0
        private void WorkingThreadProcess()
        {
            while (!_token.IsCancellationRequested)
            {
                Thread.Sleep(5000);
                var processes = new List <SystemProcess>();
                //LoaderManager.Instance.ShowLoader();

                foreach (Process process in Process.GetProcesses())
                {
                    SystemProcess sysProcess = StationManager.DataStorage.GetProcessById(process.Id);
                    if (sysProcess == null)
                    {
                        processes.Add(new SystemProcess(process));
                    }
                    else
                    {
                        sysProcess.Refresh(process);
                        if (sysProcess.IsActive)
                        {
                            processes.Add(sysProcess);
                        }
                    }

                    if (_token.IsCancellationRequested)
                    {
                        break;
                    }
                }

                if (_token.IsCancellationRequested)
                {
                    break;
                }

                StationManager.DataStorage.ProcessList = processes;
                Refresh();

                //LoaderManager.Instance.HideLoader();
            }
        }