Completed
Last Updated: 09 Nov 2016 13:52 by Rodrigo Cesar
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 25 Oct 2016 06:02
Category: Scheduler/Reminder
Type: Bug Report
7
FIX. RadScheduler - incorrect ruler's start time in WeekView when using (UTC-03:00) Brasilia Time zone
1. Add RadSchedulerNavigator and a RadScheduler. Change the view type to Week View.
2. Associate the RadSchedulerNavigator to RadScheduler. Change the PC's time zone to (UTC-03:00) Brasilia Time zone
3. Change the PC's date to 21 Oct 2016 and run the application.
4. When you change the time zone in RadSchedulerNavigator to (UTC-03:00) Brasilia Time zone, you will notice that the ruler starts from 23.

Workaround: 

public Form1()
{
    InitializeComponent();

    radSchedulerNavigator1.AssociatedScheduler = radScheduler1;

    this.radScheduler1.ActiveViewChanged += radScheduler1_ActiveViewChanged;
    this.radScheduler1.CellElementMouseDown += radScheduler1_CellElementMouseDown; 
    this.radScheduler1.AppointmentEditDialogShowing += radScheduler1_AppointmentEditDialogShowing;
    radScheduler1.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Week; 
}

DateTime? date = null;

private void radScheduler1_CellElementMouseDown(object sender, MouseEventArgs e)
{
    SchedulerCellElement cell = this.radScheduler1.ElementTree.GetElementAtPoint(e.Location) as SchedulerCellElement;
    if (cell != null)
    {
        date = cell.Date;
    }
}

CustomEditAppointmentDialog dialog = null;

private void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
{
    if (dialog == null)
    {
        dialog = new CustomEditAppointmentDialog();
    }
    e.AppointmentEditDialog = dialog;
    if (date != null && !e.Appointment.Start.Equals(date))
    {
        e.Appointment.Start = (DateTime)date;
    }
    date = null;
}

private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
{
    SchedulerDayView dayView = e.NewView as SchedulerDayView;
    SchedulerWeekView weekView = e.NewView as SchedulerWeekView;
    if (dayView != null || weekView != null)
    {
        RulerPrimitive ruler = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Ruler;
        ruler.GetType().GetField("defaultOffset", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(ruler, 0.0f);
    }
}

public class CustomEditAppointmentDialog : EditAppointmentDialog
{
    protected override void LoadSettingsFromEvent(IEvent sourceEvent)
    {
        base.LoadSettingsFromEvent(sourceEvent);
        this.dateStart.Value = sourceEvent.Start;
        this.timeStart.Value  = sourceEvent.Start;
    }
}



5 comments
Rodrigo Cesar
Posted on: 28 Oct 2016 11:07
Great! I want to stop renewing the Telerik annual support payment. But to get this bug fix I need to continue paying! This is a good way to stay earning money!
I think you should continue releasing bug fix to old versions and include only feature in new versions.
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 28 Oct 2016 07:41
Hello Max, 

Thank you for writing back. 

I agree that the problem should be solved in the RadScheduler directly. However, it is not possible to apply the fix externally as a workaround for the user. We will do our best to address this issue in R1 2017. For the time being, you can use a custom EditAppointmentDialog as it is demonstrated above.

I hope this information helps.


Max
Posted on: 27 Oct 2016 13:47
Hi Desislava,

Sorry, but the workaround does not work properly.

If you try to create an appointment on Sunday from 00:00 to 01:00, you can see that the appointment is not created with the correct time. Please, check the image attached for more details.

I believe this problem should be solved directly in the component (RadScheduler or RadSchedulerNavigator), otherwise we have to create a lot of events to try to work around the problem and this is not feasible for us.

Please, let me know if you further clarifications.

Thanks in advanced.

Best regards,

Max
Attached Files:
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 27 Oct 2016 07:31
Hello Max, 

Thank you for writing. 

The provided workaround behaves as expected on my end. However, if you switch between the views, it is necessary to handle the ActiveViewChanged event and set the ruler's offset to 0. Please refer to the updated code snippet above.

I hope this information helps. If you have any additional questions, please let me know.


Max
Posted on: 25 Oct 2016 13:46
The Workaround does not work!

You can send me a test project with Workaround?

Please, continue trying to solve the issue.

Thanks.