29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
using Dashboard.Sensor;
|
|
|
|
namespace Dashboard.Tracings {
|
|
public abstract class ATracings {
|
|
protected ASensor sensor;
|
|
protected Dictionary<String, String> settings;
|
|
|
|
public ATracings(ASensor sensor, Dictionary<String, String> settings) {
|
|
this.sensor = sensor;
|
|
this.sensor.Update += this.SensorUpdate;
|
|
this.settings = settings;
|
|
}
|
|
protected abstract void SensorUpdate(Object sender, EventArgs e);
|
|
public abstract Panel GetPanel();
|
|
internal static ATracings GetInstance(String v, ASensor aSensor, Dictionary<String, String> dictionary) {
|
|
string object_sensor = "Dashboard.Tracings." + char.ToUpper(v[0]) + v.Substring(1);
|
|
Type t = null;
|
|
try {
|
|
t = Type.GetType(object_sensor, true);
|
|
} catch(TypeLoadException) {
|
|
throw new ArgumentException("tracings.ini: " + v + " is not a Tracing");
|
|
}
|
|
return (ATracings)t.GetConstructor(new Type[] { typeof(ASensor), typeof(Dictionary<String, String>) }).Invoke(new object[] { aSensor, dictionary });
|
|
}
|
|
}
|
|
} |