Esempio n. 1
0
        private void radScheduler1_CellFormatting(object sender, SchedulerCellEventArgs e)
        {
            RefreshTimmingHoliday(false);

            UserSettings settings = Session.CurrentUser.UserSetting;

            Color? workHour = GetColor(settings.WorkHourColor);
            Color? holidayHour = GetColor(settings.HolidayColor);
            Color? normalHour = GetColor(settings.DayColor);

            if (e.CellElement is SchedulerHeaderCellElement)
            {
                if (radScheduler1.ActiveViewType == SchedulerViewType.Month)
                    return;

                DateTime date = e.CellElement.Date;
                e.CellElement.Font = _schedulerHeaderFont;
                e.CellElement.Text = GetHeaderText(date);
                return;
            }

            if (e.CellElement is MonthCellElement)
            {

                MonthCellElement monthCell=e.CellElement as MonthCellElement;
                DateTime date = e.CellElement.Date;
                monthCell.Header.Font = _schedulerHeaderFont;

                monthCell.Header.Text = GetHeaderText(date, false);
            }

            if (!(e.CellElement is MonthCellElement) && _timmings.Any
                (
                t =>
                {
                    if (t.DayOfWeek == (int)e.CellElement.Date.DayOfWeek)
                    {

                        TimeSpan tsTo = new TimeSpan(t.To.Hour, t.To.Minute, t.To.Second);
                        TimeSpan tsFrom = new TimeSpan(t.From.Hour, t.From.Minute, t.From.Second);
                        TimeSpan ts = new TimeSpan(e.CellElement.Date.Hour, e.CellElement.Date.Minute, e.CellElement.Date.Second);

                        if (ts >= tsFrom && ts < tsTo)
                            return true;
                    }
                    return false;
                }
                )
                )
            {
                if(workHour.HasValue)
                    e.CellElement.BackColor = workHour.Value;
                else
                    e.CellElement.ResetValue(VisualElement.BackColorProperty, ValueResetFlags.Local);
            }
            else if (_holidays.Any(h => h.Date.Date == e.CellElement.Date.Date))
            {
                if (holidayHour.HasValue)
                    e.CellElement.BackColor = holidayHour.Value;
                else
                    e.CellElement.ResetValue(VisualElement.BackColorProperty, ValueResetFlags.Local);
            }
            else
            {
                if (normalHour.HasValue)
                    e.CellElement.BackColor = normalHour.Value;
                else
                    e.CellElement.ResetValue(VisualElement.BackColorProperty, ValueResetFlags.Local);
            }
        }
Esempio n. 2
0
 private void radScheduler1_CellClick(object sender, SchedulerCellEventArgs e)
 {
     this.radTxtEventList.Text          += "CellClick\r\n";
     this.radTxtEventList.SelectionStart = this.radTxtEventList.TextLength;
     this.radTxtEventList.ScrollToCaret();
 }