我正在用 Asp.net 编写仪表板应用程序。当我加载主页时,我会捕获控制设置并动态创建仪表、图表、图像等,并将它们加载到 HTML 表格中的单元格中。将提供给每个控件的数据将每 3 秒更新一次。我目前将仪表存储在一个名为 BoldGauge 的类中。在该类内部有一个 GaugeValue 属性,需要每 3 秒更新一次。如何循环遍历类并在运行时更改创建的每个仪表的值?我的课看起来像这样:
public class BoldGauge
{
private ASPxGaugeControl m_Gauge;
private int m_GaugeTimer;
private string m_GaugeValue;
private string m_GaugeDataType;
private float m_GaugeMinValue;
private float m_GaugeMaxValue;
public BoldGauge(ASPxGaugeControl Gauge, string GaugeValue, string GaugeDataType, float GaugeMinValue, float GaugeMaxValue)
{
m_Gauge = Gauge;
m_GaugeValue = GaugeValue;
m_GaugeDataType = GaugeDataType;
m_GaugeMinValue = GaugeMinValue;
m_GaugeMaxValue = GaugeMaxValue;
}
public string GaugeValue
{
get
{
return m_GaugeValue;
}
set
{
m_GaugeValue = value;
}
}
public int GaugeTimer
{
get
{
return m_GaugeTimer;
}
set
{
m_GaugeTimer = value;
}
}
public string GaugeDataType
{
get
{
return m_GaugeDataType;
}
set
{
m_GaugeDataType = value;
}
}
public ASPxGaugeControl Gauge
{
get
{
return m_Gauge;
}
set
{
m_Gauge = value;
}
}
public float GaugeMinValue
{
get
{
return m_GaugeMinValue;
}
set
{
m_GaugeMinValue = value;
}
}
public float GaugeMaxValue
{
get
{
return m_GaugeMaxValue;
}
set
{
m_GaugeMaxValue = value;
}
}
}
在主页上,我生成新对象,如下所示:
newBoldGauge = new BoldGauge(boldGaugeControl, gaugeValue, controlData, minimumGaugeValue, MaximumGaugeValue);
谢谢。