Ejemplo n.º 1
0
        public int InitDays(DateTime date)
        {
            int curDayIndex = 0;
            int daysInWeek  = 7;

            DateTime start = StartOfWeek(date, DayOfWeek.Monday);

            days = Enumerable.Range(0, daysInWeek)
                   .Select(_ => {
                DateTime d = start.AddDays(_);
                if (d.Date == date.Date)
                {
                    curDayIndex = _;
                }
                CircleButton b = new CircleButton(d, false);

                b.Click += CircleButtonClick;
                return(b);
            })
                   .ToArray();

            Array.ForEach(days, day => root.Children.Add(day));

            return(curDayIndex);
        }
Ejemplo n.º 2
0
        private void CircleButtonClick(object sender, RoutedEventArgs e)
        {
            CircleButton    b      = (CircleButton)sender;
            DateChangeEvent change = new DateChangeEvent();

            change.date  = b.dateTime;
            change.index = Array.IndexOf(days, b);

            this.DateChanged?.Invoke(change, e);
        }