我在輪詢一個網站並更新我的數據源(SQLite表)。在投票結束後,表格會正確更新。刷新網格控件DevExpress
XPCollection與表關聯,並且XPCollection用作網格控件的數據源。
我的問題是:網格的數據沒有更新。我必須打開和關閉應用程序才能看到他在網格中反映的新數據。
我已嘗試刪除數據源,刷新數據源,但似乎沒有任何工作的所有組合。
下面是我對輪詢和刷新網格代碼,
private async void WaitForXSeconds()
{
for (int i = 0; i < 100; i++)
{
await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(60));
// do something after x seconds!
// Updates the DB with new/modified data
LoadDailyButton_Click(null, null);
BestGrid.DataSource = null;
BestGrid.DataSource = BestCollection;
string starttime = System.DateTime.Now.ToString();
CycleResultsListBox.Items.Add("Cycle Started : " + starttime.ToString());
}
}
這裏是什麼我的課看起來像一個部分片段:
public class BestData : XPLiteObject
{
private int id;
[Key(true)]
public int Id
{
get { return id; }
set
{
id = value;
}
}
private DateTime gameDate;
public DateTime GameDate
{
get { return gameDate; }
set
{
gameDate = value;
}
}
private string hometeamName;
public string HomeTeamName
{
get { return hometeamName; }
set
{
hometeamName = value;
}
}
任何幫助,將不勝感激,這個人是引起頭痛。
您是否在官方DevExpress論壇上嘗試過類似問題的答案? https://www.devexpress.com/Support/Center/Question/Details/Q443034 –