/// <summary> /// 重新加载提醒。 /// 注:不用管计划任务,它都是实时拉取数据的 /// </summary> public void LoadNotes() { var colorArr = new Color[] { Color.FromArgb(42, 0xa0, 0xe7, 0xae), Color.FromArgb(42, 0xdb, 0xd5, 0xf7), //DBD5F7 }; var colorDisabled = Color.Gray; lvData.Items.Clear(); var idx = 0; notesList = notesService.FindAll().ToDictionary(item => item.Id, item => item); foreach (var note in notesList.Values.OrderByDescending(item => item.Id)) { var dataArr = new string[COL_COUNT]; dataArr[COL_ID] = note.Id.ToString(); dataArr[COL_TITLE] = note.Title; dataArr[COL_NOTE] = note.GetStrDetail(); dataArr[COL_EDIT] = "编辑"; dataArr[COL_DEL] = "删除"; var row = new ListViewItem(dataArr, 0); lvData.Items.Add(row); if (note.Enable) { lvData.Items[idx].BackColor = colorArr[idx % colorArr.Length]; } else { lvData.Items[idx].BackColor = colorDisabled; } idx++; } version = notesService.GetVersion(); if (version.ServerVersion <= 0) { labSyncTitle.Visible = false; labSync.Visible = false; } else { labSyncTitle.Visible = true; labSync.Visible = true; labSync.Text = version.LastSyncTime.ToString("yyyy-MM-dd HH:mm:ss"); } }
public void SaveVersion(Version version) { versionRepository.Save(version); }