IDialogService.cs

Jan 16, 2015 at 4:13 PM
Hi,

I'm just starting out with MVVM Light, and after watching Laurent's Evolve and Pluralsight videos, I am attempting to create a Xamarin Forms application with an Azure Mobile Services backend. In general I am grasping the concepts but struggling a bit with the correct approach to the architecture. I may well have some more questions regarding that! :)

Anyway, being a newbie, I have hit a problem that has confused me a little. I have used the implementation of the IDialogService contained in the Flowers.Forms example. When I compile my solution, I get an error stating that a method of the interface has not been implemented correctly.

Error 3 'Courses.Forms.Helpers.DialogService' does not implement interface member 'GalaSoft.MvvmLight.Views.IDialogService.ShowMessage(string, string, string, string, System.Action<bool>)'. 'Courses.Forms.Helpers.DialogService.ShowMessage(string, string, string, string, System.Action<bool>)' cannot implement 'GalaSoft.MvvmLight.Views.IDialogService.ShowMessage(string, string, string, string, System.Action<bool>)' because it does not have the matching return type of 'System.Threading.Tasks.Task<bool>'. C:\Users\Steven\documents\visual studio 2013\Projects\PinSheet\PinSheet\PinSheet\Helper\DialogService.cs 8 18 PinSheet

If I peek at the IDialogService, I can see, as the error suggests, that method should return a Task<bool>.

So, is the interface correct and should the implementation return Task<bool> or is it incorrect?

5.0.2.32240 is the version of the GalaSoft.MvvmLight PCL assembly from NuGet.

Any help would be appreciated and apologies if this is a silly question.

Thanks

Steven
Coordinator
Jan 20, 2015 at 7:39 PM
Hi,

Yes the interface in the Nuget package changed since Evolve. Normally you should have used the DLLs from the References folder instead of Nuget, these contained the "old" interface that is implemented in the code.

In order to avoid confusion, I re-uploaded a corrected version of the Flowers.Forms sample, which is compatible with the updated IDialogService. Please re-download it from
http://1drv.ms/1yNA7qU

Cheers
Laurent
Marked as answer by stevendwebster on 1/20/2015 at 12:56 PM
Jan 20, 2015 at 7:56 PM
Hi Laurent,

thank you so much for responded to my question and updating the example.

I was actually just coming on here to add a comment saying that I had found confirmation on the change log that you had deliberately added the Task<bool>.

Cheers

Steven