示例#1
0
 void onUpdateHandler(ProcessStatsEventArgs procStats)
 {
     //anyone listening?
     if (this.updateEvent == null)
     {
         return;
     }
     this.updateEvent(this, procStats);
 }
示例#2
0
 void addData(ProcessStatsEventArgs procStats)
 {
     if (this.dataGrid1.InvokeRequired)
     {
         addDataCallback d = new addDataCallback(addData);
         this.Invoke(d, new object[] { procStats });
     }
     else
     {
         dataGrid1.SuspendLayout();
         //dtProcesses.Rows.Clear();
         foreach (KeyValuePair <string, ProcessStatistics.process_statistics> ps in procStats.procStatistics)
         {
             object[] o = new object[] {
                 ps.Value.processID,
                 ps.Value.sName,
                 ps.Value.procUsage.user,
                 ps.Value.procUsage.kernel,
                 ps.Value.dateTime,
                 ps.Value.duration
             };
             DataRow dr;
             //check if data already exists
             dr = dsProcesses.Tables[0].Rows.Find(ps.Value.processID.ToString());
             if (dr == null)
             {   //add a new row
                 dr           = dtProcesses.NewRow();
                 dr.ItemArray = o;
                 dtProcesses.Rows.Add(dr);
             }
             else
             {
                 dr.ItemArray = o;
             }
         }
         dataGrid1.Refresh();
         dataGrid1.ResumeLayout();
         //object[] o = new object[7]{ procUsage.procStatistics. .procStatistics. [i].sApp, eventEntries[i].sArg, eventEntries[i].sEvent,
         //        eventEntries[i].sStartTime, eventEntries[i].sEndTime, eventEntries[i].sType, eventEntries[i].sHandle };
     }
 }
示例#3
0
 void pInfo_updateEvent(object sender, ProcessStatsEventArgs eventArgs)
 {
     setText(ProcessStatistics.dumpProcStats(eventArgs));
     addData(eventArgs);
 }