You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
311 lines
7.7 KiB
C#
311 lines
7.7 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using Mesnac.Controls.Base;
|
|
using System;
|
|
using Mesnac.Controls.Default;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
using Mesnac.Compressor.Entity;
|
|
|
|
namespace Mesnac.Controls.Compressor
|
|
{
|
|
[ToolboxBitmap(typeof(System.Windows.Forms.ListView))]
|
|
public partial class McListView : System.Windows.Forms.ListView, IPurviewControl
|
|
{
|
|
#region 变量
|
|
private List<DesignAction> _clickActionList = new List<DesignAction>();
|
|
private List<DesignAction> _keyDownActionList = new List<DesignAction>();
|
|
private List<DesignAction> _keyUpActionList = new List<DesignAction>();
|
|
private bool _mcVisible = true; //保存可见性
|
|
private bool _mcEnabled = true; //保存可用性
|
|
private bool _isValid = true; //保存有效性
|
|
private string _nextpage;
|
|
private int _nextpagenum;
|
|
|
|
private string _textName;
|
|
|
|
List<int> addBit = new List<int>();
|
|
List<int> reduceBit = new List<int>();
|
|
|
|
public List<AlarmInfo> AlarmList = AlarmControl.Instance.AlarmLIst;
|
|
|
|
public List<AlarmInfo> InsertAlarm = new List<AlarmInfo>();
|
|
|
|
Dictionary<int, string> AlarmString1 = new Dictionary<int, string>();
|
|
Dictionary<int, string> AlarmString2 = new Dictionary<int, string>();
|
|
Dictionary<int, string> AlarmString3 = new Dictionary<int, string>();
|
|
|
|
private object _mcvalue;
|
|
|
|
public McListView()
|
|
{
|
|
InitializeComponent();
|
|
InitColum();
|
|
}
|
|
|
|
public McListView(IContainer container)
|
|
{
|
|
container.Add(this);
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
|
|
private void InitColum()
|
|
{
|
|
this.Columns.Clear();
|
|
ColumnHeader ch = new ColumnHeader();
|
|
ch.Text = "序号";
|
|
ch.Width = 60;
|
|
ch.TextAlign = HorizontalAlignment.Center;
|
|
this.Columns.Add(ch);
|
|
|
|
ColumnHeader alarm = new ColumnHeader();
|
|
alarm.Text = "报警信息";
|
|
alarm.Width = 500;
|
|
alarm.TextAlign = HorizontalAlignment.Center;
|
|
this.Columns.Add(alarm);
|
|
|
|
ColumnHeader time = new ColumnHeader();
|
|
time.Text = "报警时间";
|
|
time.Width = 220;
|
|
time.TextAlign = HorizontalAlignment.Center;
|
|
this.Columns.Add(time);
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 事件
|
|
public List<DesignAction> ClickActionList
|
|
{
|
|
get
|
|
{
|
|
return this._clickActionList;
|
|
}
|
|
set
|
|
{
|
|
this._clickActionList = value;
|
|
}
|
|
}
|
|
|
|
public List<DesignAction> KeyDownActionList
|
|
{
|
|
get { return _keyDownActionList; }
|
|
set { _keyDownActionList = value; }
|
|
}
|
|
|
|
public List<DesignAction> KeyUpActionList
|
|
{
|
|
get { return _keyUpActionList; }
|
|
set { _keyUpActionList = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region 业务
|
|
//业务
|
|
public string MCKey
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
#region 动画属性定义
|
|
|
|
public string TextName
|
|
{
|
|
get { return this._textName; }
|
|
set { this._textName = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
public object MCValue
|
|
{
|
|
get
|
|
{
|
|
return _mcvalue;
|
|
}
|
|
set
|
|
{
|
|
//if (AlarmControl.Instance.UpdateFinish)
|
|
//{
|
|
// if (AlarmControl.Instance.AlarmChange)
|
|
// {
|
|
// updateListView(AlarmControl.Instance.AlarmLIst);
|
|
// }
|
|
// AlarmControl.Instance.UpdateFinish = false;
|
|
//}
|
|
|
|
}
|
|
}
|
|
|
|
public IBaseControl MCRoot
|
|
{
|
|
get
|
|
{
|
|
return null;
|
|
}
|
|
set
|
|
{
|
|
;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 数据库连接
|
|
[TypeConverter(typeof(DataSourceConverter))]
|
|
|
|
[Description("数据连接"), Category("Data")]
|
|
public string MCDataSourceID
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public MCDataSource MCDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Description("是否为数据库控件"), Category("Data")]
|
|
public bool IsDbControl
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("初始化SQL"), Category("Data")]
|
|
public string InitDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("执行SQL"), Category("Data")]
|
|
public string ActionDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("绑定数据源"), Category("Data")]
|
|
public object BindDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("操作类型"), Category("Data")]
|
|
public DbOptionTypes DbOptionType
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 常规属性
|
|
|
|
[Description("是否可见"), Category("Behavior")]
|
|
public bool MCVisible
|
|
{
|
|
get
|
|
{
|
|
return this._mcVisible;
|
|
}
|
|
set
|
|
{
|
|
this._mcVisible = value == null ? true : value;
|
|
if (this.Site.DesignMode)
|
|
{
|
|
this.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
this.Visible = this._mcVisible;
|
|
}
|
|
}
|
|
}
|
|
[Description("是否可用"), Category("Behavior")]
|
|
public bool MCEnabled
|
|
{
|
|
get
|
|
{
|
|
return this._mcEnabled;
|
|
}
|
|
set
|
|
{
|
|
this._mcEnabled = value == null ? true : value;
|
|
if (this.Site.DesignMode)
|
|
{
|
|
this.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
this.Enabled = this._mcEnabled;
|
|
}
|
|
}
|
|
}
|
|
[Description("是否控制权限"), Category("Behavior")]
|
|
public bool MCPurview
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 跳转页面
|
|
/// </summary>
|
|
public string NextPage
|
|
{
|
|
get { return _nextpage; }
|
|
set { _nextpage = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 跳转页面
|
|
/// </summary>
|
|
public int NextPageNum
|
|
{
|
|
get { return _nextpagenum; }
|
|
set { _nextpagenum = value; }
|
|
}
|
|
|
|
public bool IsValid
|
|
{
|
|
get { return _isValid; }
|
|
set { _isValid = value; }
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
public void UpdateListView()
|
|
{
|
|
//if (AlarmControl.Instance.UpdateFinish)
|
|
//{
|
|
if (AlarmControl.Instance.AlarmChange)
|
|
{
|
|
updateListView(AlarmControl.Instance.AlarmLIst);
|
|
}
|
|
AlarmControl.Instance.UpdateFinish = false;
|
|
//}
|
|
}
|
|
private void updateListView(List<AlarmInfo> AlarmList)
|
|
{
|
|
this.Items.Clear();
|
|
int index=1;
|
|
foreach(AlarmInfo ai in AlarmList)
|
|
{
|
|
ListViewItem lvi=new ListViewItem();
|
|
lvi.Text=index.ToString();
|
|
lvi.SubItems.Add(ai.AlarmString);
|
|
lvi.SubItems.Add(ai.AlarmTime.ToString("HH:mm:ss"));
|
|
this.Items.Add(lvi);
|
|
index++;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |