Changed the CPU clock calculation. If no invariant TSC is available, then the max CPU clock is estimated at startup under load, otherwise an average over one second is used.
2 using System.Collections.Generic;
3 using System.ComponentModel;
5 using System.Windows.Forms;
6 using OpenHardwareMonitor.Hardware;
7 using OpenHardwareMonitor.Utilities;
9 namespace OpenHardwareMonitor.GUI {
10 public partial class ParameterForm : Form {
12 private IReadOnlyArray<IParameter> parameters;
13 private BindingList<ParameterRow> parameterRows;
15 public ParameterForm() {
16 InitializeComponent();
19 public IReadOnlyArray<IParameter> Parameters {
25 parameterRows = new BindingList<ParameterRow>();
26 foreach (IParameter parameter in parameters)
27 parameterRows.Add(new ParameterRow(parameter));
28 bindingSource.DataSource = parameterRows;
32 private class ParameterRow : INotifyPropertyChanged {
33 public IParameter parameter;
35 public bool isDefault;
37 public event PropertyChangedEventHandler PropertyChanged;
39 private void NotifyPropertyChanged(String propertyName) {
40 if (PropertyChanged != null) {
41 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
45 public ParameterRow(IParameter parameter){
46 this.parameter = parameter;
47 this.value = parameter.Value;
48 this.isDefault = parameter.IsDefault;
52 get { return parameter.Name; }
58 this.isDefault = false;
60 NotifyPropertyChanged("Default");
61 NotifyPropertyChanged("Value");
66 get { return isDefault; }
70 this.value = parameter.DefaultValue;
71 NotifyPropertyChanged("Default");
72 NotifyPropertyChanged("Value");
77 private void dataGridView_RowEnter(object sender,
78 DataGridViewCellEventArgs e)
80 if (e.RowIndex >= 0 && e.RowIndex < parameters.Length)
81 descriptionLabel.Text = parameters[e.RowIndex].Description;
83 descriptionLabel.Text = "";
86 private void dataGridView_CellValidating(object sender,
87 DataGridViewCellValidatingEventArgs e)
90 if (e.ColumnIndex == 2 &&
91 !float.TryParse(e.FormattedValue.ToString(), out value)) {
92 dataGridView.Rows[e.RowIndex].Cells[0].ErrorText =
98 private void dataGridView_CellEndEdit(object sender,
99 DataGridViewCellEventArgs e) {
100 dataGridView.Rows[e.RowIndex].Cells[0].ErrorText = "";
103 private void okButton_Click(object sender, EventArgs e) {
104 foreach (ParameterRow row in parameterRows) {
106 row.parameter.IsDefault = true;
108 row.parameter.Value = row.Value;
113 private void dataGridView_CurrentCellDirtyStateChanged(object sender,
115 if (dataGridView.CurrentCell is DataGridViewCheckBoxCell ||
116 dataGridView.CurrentCell is DataGridViewComboBoxCell)
118 dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);