Cleanup around base collection types. (#59)

* Hardware in IGroup is now IEnumerable. No point to call ToArray each time.

* Use ValueTuple insead of custom pair.

* ListSet -> HashSet

* Ring Collection -> List

* ReadOnlyArray -> ReadOnlyList
This commit is contained in:
Michal
2018-10-30 14:44:41 +01:00
committed by Phyxion
parent 9900f5c0de
commit 5d89cdc43d
32 changed files with 74 additions and 497 deletions
+2 -2
View File
@@ -678,7 +678,7 @@ namespace OpenHardwareMonitor.GUI {
SensorNode node = info.Node.Tag as SensorNode;
if (node != null && node.Sensor != null) {
treeContextMenu.MenuItems.Clear();
if (node.Sensor.Parameters.Length > 0) {
if (node.Sensor.Parameters.Count > 0) {
MenuItem item = new MenuItem("Parameters...");
item.Click += delegate(object obj, EventArgs args) {
ShowParameterForm(node.Sensor);
@@ -854,7 +854,7 @@ namespace OpenHardwareMonitor.GUI {
TreeNodeAdvMouseEventArgs e) {
SensorNode node = e.Node.Tag as SensorNode;
if (node != null && node.Sensor != null &&
node.Sensor.Parameters.Length > 0) {
node.Sensor.Parameters.Count > 0) {
ShowParameterForm(node.Sensor);
}
}
+3 -4
View File
@@ -15,19 +15,18 @@ using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using OpenHardwareMonitor.Hardware;
using OpenHardwareMonitor.Collections;
namespace OpenHardwareMonitor.GUI {
public partial class ParameterForm : Form {
private IReadOnlyArray<IParameter> parameters;
private IReadOnlyList<IParameter> parameters;
private BindingList<ParameterRow> parameterRows;
public ParameterForm() {
InitializeComponent();
}
public IReadOnlyArray<IParameter> Parameters {
public IReadOnlyList<IParameter> Parameters {
get {
return parameters;
}
@@ -88,7 +87,7 @@ namespace OpenHardwareMonitor.GUI {
private void dataGridView_RowEnter(object sender,
DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0 && e.RowIndex < parameters.Length)
if (e.RowIndex >= 0 && e.RowIndex < parameters.Count)
descriptionLabel.Text = parameters[e.RowIndex].Description;
else
descriptionLabel.Text = "";
+1 -2
View File
@@ -18,7 +18,6 @@ using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.WindowsForms;
using OxyPlot.Series;
using OpenHardwareMonitor.Collections;
namespace OpenHardwareMonitor.GUI {
public class PlotPanel : UserControl {
@@ -212,7 +211,7 @@ namespace OpenHardwareMonitor.GUI {
IDictionary<ISensor, Color> colors) {
this.model.Series.Clear();
ListSet<SensorType> types = new ListSet<SensorType>();
var types = new System.Collections.Generic.HashSet<SensorType>();
foreach (ISensor sensor in sensors) {
var series = new LineSeries();