Added initial support for the ITE IT8772E super I/O chip.
3 Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 The contents of this file are subject to the Mozilla Public License Version
6 1.1 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
9 http://www.mozilla.org/MPL/
11 Software distributed under the License is distributed on an "AS IS" basis,
12 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 for the specific language governing rights and limitations under the License.
15 The Original Code is the Open Hardware Monitor code.
17 The Initial Developer of the Original Code is
18 Michael Möller <m.moeller@gmx.ch>.
19 Portions created by the Initial Developer are Copyright (C) 2009-2010
20 the Initial Developer. All Rights Reserved.
24 Alternatively, the contents of this file may be used under the terms of
25 either the GNU General Public License Version 2 or later (the "GPL"), or
26 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 in which case the provisions of the GPL or the LGPL are applicable instead
28 of those above. If you wish to allow use of your version of this file only
29 under the terms of either the GPL or the LGPL, and not to allow others to
30 use your version of this file under the terms of the MPL, indicate your
31 decision by deleting the provisions above and replace them with the notice
32 and other provisions required by the GPL or the LGPL. If you do not delete
33 the provisions above, a recipient may use your version of this file under
34 the terms of any one of the MPL, the GPL or the LGPL.
39 using System.Collections.Generic;
40 using System.ComponentModel;
42 using System.Windows.Forms;
43 using OpenHardwareMonitor.Hardware;
44 using OpenHardwareMonitor.Collections;
46 namespace OpenHardwareMonitor.GUI {
47 public partial class ParameterForm : Form {
49 private IReadOnlyArray<IParameter> parameters;
50 private BindingList<ParameterRow> parameterRows;
52 public ParameterForm() {
53 InitializeComponent();
56 public IReadOnlyArray<IParameter> Parameters {
62 parameterRows = new BindingList<ParameterRow>();
63 foreach (IParameter parameter in parameters)
64 parameterRows.Add(new ParameterRow(parameter));
65 bindingSource.DataSource = parameterRows;
69 private class ParameterRow : INotifyPropertyChanged {
70 public IParameter parameter;
72 public bool isDefault;
74 public event PropertyChangedEventHandler PropertyChanged;
76 private void NotifyPropertyChanged(String propertyName) {
77 if (PropertyChanged != null) {
78 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
82 public ParameterRow(IParameter parameter){
83 this.parameter = parameter;
84 this.value = parameter.Value;
85 this.isDefault = parameter.IsDefault;
89 get { return parameter.Name; }
95 this.isDefault = false;
97 NotifyPropertyChanged("Default");
98 NotifyPropertyChanged("Value");
102 public bool Default {
103 get { return isDefault; }
107 this.value = parameter.DefaultValue;
108 NotifyPropertyChanged("Default");
109 NotifyPropertyChanged("Value");
114 private void dataGridView_RowEnter(object sender,
115 DataGridViewCellEventArgs e)
117 if (e.RowIndex >= 0 && e.RowIndex < parameters.Length)
118 descriptionLabel.Text = parameters[e.RowIndex].Description;
120 descriptionLabel.Text = "";
123 private void dataGridView_CellValidating(object sender,
124 DataGridViewCellValidatingEventArgs e)
127 if (e.ColumnIndex == 2 &&
128 !float.TryParse(e.FormattedValue.ToString(), out value)) {
129 dataGridView.Rows[e.RowIndex].Cells[0].ErrorText =
135 private void dataGridView_CellEndEdit(object sender,
136 DataGridViewCellEventArgs e) {
137 dataGridView.Rows[e.RowIndex].Cells[0].ErrorText = "";
140 private void okButton_Click(object sender, EventArgs e) {
141 foreach (ParameterRow row in parameterRows) {
143 row.parameter.IsDefault = true;
145 row.parameter.Value = row.Value;
150 private void dataGridView_CurrentCellDirtyStateChanged(object sender,
152 if (dataGridView.CurrentCell is DataGridViewCheckBoxCell ||
153 dataGridView.CurrentCell is DataGridViewComboBoxCell)
155 dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);