This is a migrated thread and some comments may be shown as answers.

AppointmentSaving is invoked twice, but only on every other edit

1 Answer 50 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Rian
Top achievements
Rank 1
Rian asked on 25 Aug 2017, 07:00 PM

I have a case where the event handler that handles AppointmentSaving is invoked twice, but only every other time. It goes like this:

 

1) Find a calendar event

2) Drag the edge of the event to make it wider

3) Find a second event, and drag *that* event wider. AppointmentSaving will be called twice.

4) Repeat every other time. (2, 4, 6, 8, etc. with no end)

 

Here's the XAML setting up the event handler:

 

<i:EventTrigger
    EventName="AppointmentSaving">
    <vp:EventToCommandAction
        PassEventArgsToCommand="True"
        Command="{Binding HandleDowntimeSavingCommand, Mode=OneWay}" />
</i:EventTrigger>

 

Here's the event handler itself:

 

public ICommand HandleDowntimeSavingCommand => DelegateCommand.Create<AppointmentSavingEventArgs>(HandleDowntimeSaving);
internal void HandleDowntimeSaving(AppointmentSavingEventArgs eventArgs)
{
    var downtime = (DowntimeViewModel)eventArgs.Appointment;
    var numExceptionsRemoved = RemovePointlessExceptions(downtime);
    var numExceptionsConverted = ConvertExceptionsToIsolatedDowntimes(downtime);
    if (numExceptionsRemoved > 0 && numExceptionsConverted == 0)
    {
        eventArgs.Cancel = true;
    }
}

 

DelegateCommand.Create is used in literally thousands of places; it's not the source of the bug. If I set a breakpoint on the first line of the event handler, it will be hit twice, but only on every second edit.

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 30 Aug 2017, 10:47 AM
Hello Rian,

I tried to reproduce the behavior you've described but was unable to do so. I'm attaching the sample project I've used for the purpose. Can you please have a look at it and let me know how I can modify it in order to replicate the aforementioned issue?

I'm looking forward to your reply.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ScheduleView
Asked by
Rian
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or