private void CheckNewDiary() { DateTime recordedOn = new DateTime(_year, _month, _day); Current = Diaries.FirstOrDefault(a => a.RecordDate >= recordedOn.Date && a.RecordDate < recordedOn.Date.AddDays(1)); if (Current == null) { _lvwDiarys.SelectedIndex = -1; Current = new Diary() { ID = -1, Title = "[新日记]", Keywords = string.Empty, Content = string.Empty, IsRemindRequired = false, JobGroup = "TaskGroup", JobName = Guid.NewGuid().ToString(), JobTypeFullName = $"{typeof(RemindJob).FullName},{System.IO.Path.GetFileName(Common.CurrentAssembly.Location)}", CronExpress = string.Empty, RunningStart = null, RunningEnd = null, RecordDate = new DateTime(_year, _month, _day), RowVersion = DateTime.Now }; } for (int i = 0; i < _lvwDiarys.Items.Count; i++) { Diary diary = (Diary)_lvwDiarys.Items[i]; if (diary.Equals(Current)) { _lvwDiarys.SelectedIndex = i; break; } } _txtTitle.SelectAll(); _txtTitle.Focus(); }