Trendviewer History Control via Script
Posted: Wed Jul 03, 2013 9:15 am
Hi, wondering if anyone else has encountered issues with this because I can't explain it. For whatever reason, in order to turn on the history for a trendviewer via script I'm having to turn it "Off". Here's the code I've got on a start/stop button:
In my testing to see if there was a difference between my hand coded script and that generated by the tool, this is the autogenerated code that works:
Thanks
Code: Select all
void startButton_Click(System.Object sender, System.EventArgs e)
{
//TrendViewer1.ShowHistory("Toggle"); //this seriously doesn't work here but does on an separate button (other code snippet)
if(start == true){
chart.Start();
Globals.trendLogger.Start();
Globals.trendLogger.Log();
TrendViewer1.ShowHistory("On"); //this is backwards but it works correctly. I can not explain it
start = false;
}else {
TrendViewer1.ShowHistory("Off");
Globals.trendLogger.Stop();
chart.Stop();
start = true;
}
}
Code: Select all
private void m_Button6_Action_Click(object sender, System.EventArgs e) {
Neo.ApplicationFramework.Generated.Globals.AuditTrailService.LogAction("m_Button6", "Click", "Trend Viewer History", "TrendViewer1", "");
TrendViewer1.ShowHistory("Toggle");
}