public void AddCountDown(CountDown countDown) { try { if (CountDowns == null) { CountDowns = new List <CountDown>(); } if (countDown.Date.Date < DateTime.Now.Date) { return; } foreach (var down in CountDowns) { if (down.Date.Date == countDown.Date.Date) { down.Remarks = countDown.Remarks; return; } } CountDowns.Add(countDown); CountDowns.Sort(); } finally { CountDownsChanged?.Invoke(); } }
public CountDown[] GetTopCountDowns(int num) { if (CountDowns == null) { return(null); } var r = (from c in CountDowns where c.Date.Date > DateTime.Today orderby c.Date select c).ToList(); num = r.Count() > num ? num : r.Count(); CountDown[] count = new CountDown[num]; if (num > 0) { for (int i = 0; i < num; i++) { count[i] = r[i]; } } return(count); }
public CountDown[] GetTopCountDowns(int num) { if (CountDowns == null) return null; var r = (from c in CountDowns where c.Date.Date > DateTime.Today orderby c.Date select c).ToList(); num = r.Count() > num ? num : r.Count(); CountDown[] count = new CountDown[num]; if (num > 0) { for (int i = 0; i < num; i++) { count[i] = r[i]; } } return count; }
public void AddCountDown(CountDown countDown) { try { if (CountDowns == null) CountDowns = new List<CountDown>(); if (countDown.Date.Date < DateTime.Now.Date) return; foreach (var down in CountDowns) { if (down.Date.Date == countDown.Date.Date) { down.Remarks = countDown.Remarks; return; } } CountDowns.Add(countDown); CountDowns.Sort(); } finally { CountDownsChanged?.Invoke(); } }