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

AppointmentDialogViewModel constructor

3 Answers 52 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 07 Jan 2013, 10:45 AM
Hello,

I've noticed that the public constructor for the AppointmentDialogViewModel class is marked as obsoleted and "will be deleted".

I'd like to ask you to reconsider deleting it.

Specifically, our scenario is that we have a split screen which:
- on the top area shows a ScheduleView
- on the bottom area shows a GridView of "unassigned" stuff, which can be dragged&dropped onto the ScheduleView for assignment

For the GridView, when double-clicking any of the items, we want to show almost the same information (95%) as when it would be assigned in the scheduleview. To reuse code we simply create a SchedulerWindow-derived window, set its content to a SchedulerWindow and create an AppointmentDialogViewModel for this window. Everything works great and we actually reuse the UI as well as the window command handlers & stuff.

If you'll remove the public constructor, any idea how we could accomplish the same scenario? Maybe you could replace the constructor with a factory method?...

Thanks,
Adrian

3 Answers, 1 is accepted

Sort by
0
Ken
Top achievements
Rank 1
answered on 07 Jan 2013, 12:15 PM
Also, there is a bug in the latest version 1129: the public constructor of AppointmentDialogViewModel calls into the internal constructor passing "null" for the value of the "scheduleViewTimeZone" parameter.

This causes the code to crash on the call to ConvertDateTimeToOneTimeZoneFromAnother, because inside this method "scheduleViewTimeZone"'s GetUtcOffset() method will be called, so a NullReferenceException will be thrown.

Because of this exception our scenario described in the post above doesn't work at all at the moment. Can you please try to either fix this problem or make the internal constructor public in the next release?

Thanks,
Adrian
0
Miroslav Nedyalkov
Telerik team
answered on 10 Jan 2013, 04:05 PM
Hi Adrian,

Thank you for sharing us your scenario.

We changed the ViewModel slightly during a refactoring of the TimeZone feature and the old constructor cannot initialize the ViewModel correctly. We will consider making the Internal constructor public, but the old one will stay obsolete.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ken
Top achievements
Rank 1
answered on 10 Jan 2013, 09:12 PM
Hi Miroslav,

Thanks for the answer. I am currently using the same approach, I made the internal constructor public and recompiled the sources. It works fine.

Regards,
Adrian
Tags
ScheduleView
Asked by
Ken
Top achievements
Rank 1
Answers by
Ken
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Share this question
or