|
@@ -346,18 +346,24 @@ namespace XdCxRhDW.App.UserControl
|
|
|
var btnEdit = (layoutControlGroup1.CustomHeaderButtons[1] as GroupBoxButton);
|
|
|
var btnDel = (layoutControlGroup1.CustomHeaderButtons[2] as GroupBoxButton);
|
|
|
btnDel.Enabled = btnEdit.Enabled = tsk.TaskState != EnumTaskState.Running;
|
|
|
- List<ModelPosRes> listPos = null;
|
|
|
if (txtTimeCho.Text == "自定义" && (txtStartTime.EditValue == null || txtEndTime.EditValue == null || txtStartTime.DateTime > txtEndTime.DateTime))
|
|
|
{
|
|
|
- listPos = new List<ModelPosRes>();
|
|
|
- this.gridHomePosRes.DataSource = listPos;
|
|
|
- mapControl1.SetPosDataSource(listPos);
|
|
|
+ var tmp = new List<ModelPosRes>();
|
|
|
+ lock (this)
|
|
|
+ {
|
|
|
+ this.gridHomePosRes.DataSource = tmp;
|
|
|
+ mapControl1.SetPosDataSource(tmp);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- listPos = await searchPos(cts.Token);
|
|
|
- this.gridHomePosRes.DataSource = listPos;
|
|
|
- mapControl1.SetPosDataSource(listPos);
|
|
|
+
|
|
|
+ var tmp = await searchPos(cts.Token);
|
|
|
+ lock (this)
|
|
|
+ {
|
|
|
+ this.gridHomePosRes.DataSource = tmp;
|
|
|
+ mapControl1.SetPosDataSource(tmp);
|
|
|
+ }
|
|
|
}
|
|
|
SatInfo sat1, sat2, sat3;
|
|
|
using (MySqlContext db = new MySqlContext())
|
|
@@ -827,8 +833,11 @@ namespace XdCxRhDW.App.UserControl
|
|
|
itemEnd.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
|
|
layoutControlItemSearch.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
|
|
var list = await searchPos(cts.Token);
|
|
|
- this.gridHomePosRes.DataSource = list;
|
|
|
- this.mapControl1.SetPosDataSource(list);
|
|
|
+ lock (this)
|
|
|
+ {
|
|
|
+ this.gridHomePosRes.DataSource = list;
|
|
|
+ this.mapControl1.SetPosDataSource(list);
|
|
|
+ }
|
|
|
break;
|
|
|
case "自定义":
|
|
|
itemStart.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
|
|
@@ -851,7 +860,11 @@ namespace XdCxRhDW.App.UserControl
|
|
|
}
|
|
|
var cts = new CancellationTokenSource();
|
|
|
listCts.Add(cts);
|
|
|
- this.gridHomePosRes.DataSource = await searchPos(cts.Token);
|
|
|
+ var list = await searchPos(cts.Token);
|
|
|
+ lock (this)
|
|
|
+ {
|
|
|
+ this.gridHomePosRes.DataSource = list;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
private async void btnSearch_Click(object sender, EventArgs e)
|
|
@@ -876,8 +889,11 @@ namespace XdCxRhDW.App.UserControl
|
|
|
var cts = new CancellationTokenSource();
|
|
|
listCts.Add(cts);
|
|
|
var listPos = await searchPos(cts.Token);
|
|
|
- this.gridHomePosRes.DataSource = listPos;
|
|
|
- this.mapControl1.SetPosDataSource(listPos);
|
|
|
+ lock (this)
|
|
|
+ {
|
|
|
+ this.gridHomePosRes.DataSource = listPos;
|
|
|
+ this.mapControl1.SetPosDataSource(listPos);
|
|
|
+ }
|
|
|
}
|
|
|
private async Task<List<ModelPosRes>> searchPos(CancellationToken ct = default)
|
|
|
{
|