2 using System.Collections.Generic;
3 using System.ComponentModel;
8 using System.Windows.Forms;
9 using DirectOutput.General;
10 using DirectOutput.General.Statistics;
12 namespace DirectOutput.Frontend
19 this.Pinball = Pinball;
20 InitializeComponent();
26 public void RefreshData()
29 RefreshDurationStatistics();
32 private void RefreshDurationStatistics()
36 DurationStatistics.Rows.Clear();
39 int RowIndex = DurationStatistics.Rows.Add();
40 DurationStatistics.Rows[RowIndex].Tag = Item;
41 DurationStatistics[StatGroup.Name, RowIndex].Value = (Item.
GroupName.IsNullOrWhiteSpace()?
"":Item.
GroupName);
42 DurationStatistics[StatName.Name, RowIndex].Value = Item.
Name;
43 DurationStatistics[StatCallsCount.Name, RowIndex].Value =
"{0} calls".Build(Item.
ValuesCount);
46 DurationStatistics[StatTotalDuration.Name, RowIndex].Value = Item.
TotalDuration.Format();
47 DurationStatistics[StatAvgDuration.Name, RowIndex].Value = Item.
AverageDuration.Format();
48 DurationStatistics[StatMinDuration.Name, RowIndex].Value = Item.
MinDuration.Format();
49 DurationStatistics[StatMaxDuration.Name, RowIndex].Value = Item.
MaxDuration.Format();
55 private void RefreshThreads() {
57 ThreadDisplay.Rows.Clear();
59 foreach (
ThreadInfo TI
in Pinball.ThreadInfoList)
61 int RowIndex = ThreadDisplay.Rows.Add();
62 ThreadDisplay[ThreadName.Name, RowIndex].Value = TI.
ThreadName;
63 ThreadDisplay[ThreadHostObject.Name, RowIndex].Value = (!TI.
HostName.IsNullOrEmpty() ? TI.
HostName :
"");
64 ThreadDisplay[ThreadIsAlive.Name, RowIndex].Value = TI.
IsAlive;
65 ThreadDisplay[ThreadLastHeartBeat.Name, RowIndex].Value = TI.
LastHeartBeat.ToString(
"HH:mm:ss");
66 int Ms=(int)(DateTime.Now-TI.
LastHeartBeat).TotalMilliseconds;
68 ThreadDisplay[ThreadLastHeartBeat.Name, RowIndex].Style.BackColor = System.Drawing.Color.FromArgb(255, 0, 0);
73 int Green = 255 - Red;
74 ThreadDisplay[ThreadLastHeartBeat.Name, RowIndex].Style.BackColor = System.Drawing.Color.FromArgb(Red, Green, 0);
78 ThreadDisplay[ThreadLastHeartBeat.Name, RowIndex].Style.BackColor = System.Drawing.Color.FromArgb(0, 255, 0);
80 ThreadDisplay[ThreadExceptions.Name, RowIndex].Value = TI.
Exceptions.Count;
81 ThreadDisplay[ThreadProcessorNumber.Name, RowIndex].Value = TI.
ProcessorNumber;
85 ThreadDisplay.ClearSelection();
86 ThreadDisplay.Refresh();
90 private void RefreshButton_Click(
object sender, EventArgs e)
95 private void DurationStatistics_CellClick(
object sender, DataGridViewCellEventArgs e)
97 if (e.RowIndex >= 0 && e.RowIndex < DurationStatistics.Rows.Count)
99 new TimeSpanStatisticsDetails((
TimeSpanStatisticsItem)DurationStatistics.Rows[e.RowIndex].Tag).ShowDialog(
this);