56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TBF.Rig.Modbus.WaterAnalyzerUni
|
|
{
|
|
public partial class AnalyzerDiagnosticsForm : Form
|
|
{
|
|
readonly Analyzer analyzer;
|
|
|
|
public AnalyzerDiagnosticsForm(Analyzer analyzer)
|
|
{
|
|
if (analyzer == null) throw new ArgumentNullException("analyzer");
|
|
|
|
this.analyzer = analyzer;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void AnalyzerDiagnosticsForm_Load(object sender, EventArgs e)
|
|
{
|
|
refreshTimer.Start();
|
|
RefreshDiagnostics();
|
|
}
|
|
|
|
private void refreshTimer_Tick(object sender, EventArgs e)
|
|
{
|
|
RefreshDiagnostics();
|
|
}
|
|
|
|
private void RefreshDiagnostics()
|
|
{
|
|
diagnosticsTextBox.Text =
|
|
analyzer.Diagnostics != null
|
|
? analyzer.Diagnostics.GetText()
|
|
: "Diagnostics are not available.";
|
|
}
|
|
|
|
private void clearButton_Click(object sender, EventArgs e)
|
|
{
|
|
if (analyzer.Diagnostics != null)
|
|
analyzer.Diagnostics.Clear();
|
|
|
|
RefreshDiagnostics();
|
|
}
|
|
|
|
private void closeButton_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
protected override void OnFormClosing(FormClosingEventArgs e)
|
|
{
|
|
refreshTimer.Stop();
|
|
base.OnFormClosing(e);
|
|
}
|
|
}
|
|
} |