internal void loadSyncRecords()
{
try
{
List<SyncRecord> syncRecords = SyncRecord.LoadRecentSyncJobs(this.jobsDbPath);
this.SyncHistoryListBox.Items.Clear();
this.syncRecordDict.Clear();
int index = 0;
foreach (SyncRecord record in syncRecords)
{
ListBoxItem listBoxItem = new ListBoxItem();
Style ctlStyle = Application.Current.TryFindResource("jobListItemResource") as Style;
listBoxItem.DataContext = record;
listBoxItem.Style = ctlStyle;
listBoxItem.MouseDoubleClick += listBoxItem_MouseDoubleClick;
listBoxItem.MouseRightButtonUp += listBoxItem_MouseRightButtonUp;
this.syncRecordDict.Add(listBoxItem, record.SyncJobId);
this.SyncHistoryListBox.Items.Add(listBoxItem);
index += 1;
}
}
catch (Exception ex)
{
Log.Error("load recent sync jobs failed, " + ex.Message);
}
}