void TopContext_Received(object sender, TopSnapshot top) { this.SafeInvoke(() => { if (this.processesUpdated) { this.processesUpdated = false; this.UpdateProcessList(); this.UpdateThreadList(); this.UpdateControlState(); } this.UpdateCpuUsage(top); }); }
void UpdateCpuUsage(TopSnapshot top) { foreach (var p in this.processList) { p.SetCpuUsage(top.GetProcessCpu(p.Pid)); } this.uxProcessGridPanel.SortColumn(this.uxProcessGridPanel.SortedColumn, this.uxProcessGridPanel.SortOrder == SortOrder.Descending ? ListSortDirection.Descending : ListSortDirection.Ascending); foreach (var t in this.threadList) { t.SetCpuUsage(top.GetThreadCpu(t.Tid)); } this.uxThreadGridPanel.SortColumn(this.uxThreadGridPanel.SortedColumn, this.uxThreadGridPanel.SortOrder == SortOrder.Descending ? ListSortDirection.Descending : ListSortDirection.Ascending); this.lastTop = top; }