private void btnUpdate_Click(object sender, EventArgs e) { if (dgViewFileList.SelectedRows == null || dgViewFileList.SelectedCells.Count == 0) { return; } SyncFile syncFile; var row = dgViewFileList.SelectedCells[0].OwningRow; int id = Convert.ToInt32(row.Cells["colID"].Value); if (SycerSQLiteHelper.GetSyncFile(_conn, id, out syncFile) && syncFile != null) { string latestPath; DateTime updateTime; if (!FileSyncHelper.UpdateFilesToNewest(syncFile.ListFullName, out latestPath, out updateTime) || string.IsNullOrEmpty(latestPath)) { MessageBox.Show(@"同步数据失败!"); } else //更新数据库文件 { FileSyncHelper.FreshSyncFile(ref syncFile, latestPath, updateTime, 1); if (!SycerSQLiteHelper.UpdateSyncFile(_conn, syncFile)) { MessageBox.Show(@"文件已更新,但更新同步信息失败!"); } } } else { MessageBox.Show(@"读取同步文件信息失败!"); } ReadDataBase(); }