42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using log4net;
|
|
|
|
namespace Results.Forms
|
|
{
|
|
public partial class OneWMResultsCtrl : UserControl
|
|
{
|
|
static readonly ILog log = LogManager.GetLogger(typeof(OneWMResultsCtrl));
|
|
|
|
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
|
|
|
public OneWMResultsCtrl()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public OneWMResultsCtrl(Color backColor, int lvWidth, int lvHeight, Results.Entities.WaterMeter wm)
|
|
: this()
|
|
{
|
|
lView.BackColor = backColor;
|
|
tBox.BackColor = backColor;
|
|
Size = new System.Drawing.Size(lvWidth, lvHeight);
|
|
WM = wm;
|
|
}
|
|
|
|
public Results.Entities.WaterMeter WM;
|
|
public string Caption { get { return tBox.Text; } set { tBox.Text = value; } }
|
|
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } }
|
|
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
|
|
public Color BColor { set { lView.BackColor = value; tBox.BackColor = value; } }
|
|
|
|
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
{
|
|
if (WMResultsClickedHandler == null) return;
|
|
try { WMResultsClickedHandler(sender, new WaterMeterEventArgs(WM)); }
|
|
catch (Exception exc) { log.Error("WMResultsClickedHandler(...) failed", exc); }
|
|
}
|
|
}
|
|
}
|