随手记录
private void barLargeButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
//重新加载数据
Thread DataThread = new Thread(new ThreadStart(LoadData));
DataThread.IsBackground = true;
DataThread.Start();
}
#region 加载数据
public void LoadData()
{
SetMarqueeProgress(true);
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn() { ColumnName = "编号" });
dt.Columns.Add(new DataColumn() { ColumnName = "城市" });
SetDgvDataSource(dt);
SetMarqueeProgress(false);
}
#endregion
#region 委托操作
/// <summary>
/// 显示隐藏等待条
/// </summary>
/// <param name="Visible"></param>
delegate void mpDelegate(bool Visible);
private void SetMarqueeProgress(bool Visible)
{
if (marqueeProgressBarControl1.InvokeRequired)
{
marqueeProgressBarControl1.Invoke(new mpDelegate(SetMarqueeProgress), Visible);
}
else
{
marqueeProgressBarControl1.Visible = Visible;
}
}
/// <summary>
/// 绑定数据
/// </summary>
/// <param name="table"></param>
delegate void dgvDelegate(DataTable table);
private void SetDgvDataSource(DataTable table)
{
if (PointDataGrid.InvokeRequired)
{
PointDataGrid.Invoke(new dgvDelegate(SetDgvDataSource), table);
}
else
{
PointDataGrid.DataSource = table;
}
}
#endregion