예제 #1
0
        private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            DaysOfWeekControl control = obj as DaysOfWeekControl;
            var newTime = (WeekDayModel)e.NewValue;

            control.Monday    = newTime.HasFlag(WeekDayModel.Monday);
            control.Tuesday   = newTime.HasFlag(WeekDayModel.Tuesday);
            control.Wednesday = newTime.HasFlag(WeekDayModel.Wednesday);
            control.Thursday  = newTime.HasFlag(WeekDayModel.Thursday);
            control.Friday    = newTime.HasFlag(WeekDayModel.Friday);
            control.Saturday  = newTime.HasFlag(WeekDayModel.Saturday);
            control.Sunday    = newTime.HasFlag(WeekDayModel.Sunday);
        }
예제 #2
0
        private static void OnDayOfWeekChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            DaysOfWeekControl control = obj as DaysOfWeekControl;

            WeekDayModel weekDayModel = WeekDayModel.Undefined;

            if (control.Monday)
            {
                weekDayModel |= WeekDayModel.Monday;
            }
            if (control.Tuesday)
            {
                weekDayModel |= WeekDayModel.Tuesday;
            }
            if (control.Wednesday)
            {
                weekDayModel |= WeekDayModel.Wednesday;
            }
            if (control.Thursday)
            {
                weekDayModel |= WeekDayModel.Thursday;
            }
            if (control.Friday)
            {
                weekDayModel |= WeekDayModel.Friday;
            }
            if (control.Saturday)
            {
                weekDayModel |= WeekDayModel.Saturday;
            }
            if (control.Sunday)
            {
                weekDayModel |= WeekDayModel.Sunday;
            }

            control.Value = weekDayModel;
        }