Daily Recurrence/Every Weekday

3 posts, 0 answers
  1. Timothy
    Timothy avatar
    37 posts
    Member since:
    Nov 2012

    Posted 27 Jun 2013 Link to this post

    I'm trying to implement a custom recurrence dialog. Actually, due to business needs, I'm combining the the appointment dialog with the recurrence dialog. This means that I'm inheriting the EditAppointmentDialog class and so I can't also inherit the EditRecurrenceDialog class (not in VB.NET anyway).

    Most of it is going well but I'm confused about something. When I create a recurrence by using the Every Weekday radio button under the Daily radio button a weekly recurrence rule for Monday - Friday with an interval of 1 is created. That makes sense. What I don't understand is why the WeeklyRecurrenceSettings.CanShowRecurrenceRule returns false in this situation. Well, what I don't understand is why your code is written to do that (I've looked at your source code). Since it's a weekly recurrence I can't use the DailyRecurrenceSettings control but since the WeeklyRecurrenceSettings control returns false for CanShowRecurrenceRule I can't use that function.

    The recurrence rule should either be interpreted as a daily recurrence or else it should accept WorkDays and Interval = 1 as a valid weekly recurrence.

    I'm considering implementing my own WeeklyRecurrenceSettings control but that seems like overkill.
  2. Timothy
    Timothy avatar
    37 posts
    Member since:
    Nov 2012

    Posted 27 Jun 2013 Link to this post

    I worked around this problem by adding to some code I borrowed from Telerik's source code.

    I changed this:
    For Each pair As KeyValuePair(Of RadRadioButton, IRecurrenceRuleSettingsControl) In Me.radioToSettingsDictionary
        If pair.Value.CanShowRecurrenceRule(Me.RecurrenceRule) Then
            pair.Key.ToggleState = ToggleState.On
            Exit For
        End If
    Next

    To this:
    For Each pair As KeyValuePair(Of RadRadioButton, IRecurrenceRuleSettingsControl) In Me.radioToSettingsDictionary
        If pair.Value.CanShowRecurrenceRule(Me.RecurrenceRule) Then
            pair.Key.ToggleState = ToggleState.On
            If TypeOf pair.Value Is DailyRecurrenceSettings Then
                If Me.RecurrenceRule.Interval = 1 AndAlso TypeOf Me.RecurrenceRule Is WeeklyRecurrenceRule AndAlso CType(Me.RecurrenceRule, WeeklyRecurrenceRule).WeekDays = WeekDays.WorkDays Then
                    CType(pair.Value, DailyRecurrenceSettings).radioButtonEveryWeekday.ToggleState = ToggleState.On
                End If
            End If
            Exit For
        End If
    Next

    I run the above code after I've gotten the recurrence rule in the LoadSettingsFromEvent sub.

    It would be nice if the pertinent portion of this code could be added to the DailyRecurrenceSettings.ShowRecurrenceRule sub.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Anton
    Admin
    Anton avatar
    167 posts

    Posted 02 Jul 2013 Link to this post

    Hi Timothy,

    Thank you for writing.

    We highly appreciate that you brought this case to our attention. We will investigate the logic in this part of RadScheduler and we will consider your suggestion.

    In regards to your workaround, it seems valid and suitable for the case that you described.

    Should you have any other questions or feedback, I will be glad to assist you.

    Regards,
    Anton
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top