Пример #1
0
        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();
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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;
        }
Пример #4
0
        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();
            }
        }