MvvmCross / MvvmCross-Forms

Support for Xamarin.Forms on MvvmCross: The .NET MVVM framework for cross-platform solutions, including Xamarin.iOS, Xamarin.Android, Windows and Mac.
http://mvvmcross.com
6 stars 2 forks source link

Samples for Xamarin Forms using MvvmCross #6

Closed martijn00 closed 9 years ago

martijn00 commented 9 years ago

This PR also contains pull request #5

PeterBurke commented 9 years ago

Hi Martijn

I am getting quite excited about this Windows Store target!

The solution though seems to have issues that need fixing before I would recommend that we accept the Pull.

I started by merging #6 (contains #5) locally.

Now some of the Sample projects had compilation errors.

Example.Android

4>C:\VSProjects\MvvmCross-Forms\Samples\Example.Android\SplashScreen.cs(28,50,28,52): error CS0234: The type or namespace name 'OS' does not exist in the namespace 'Example.Android' (are you missing an assembly reference?)
4>C:\VSProjects\MvvmCross-Forms\Samples\Example.Android\SplashScreen.cs(28,33,28,41): error CS0115: 'SplashScreen.OnCreate(OS.Bundle)': no suitable method found to override

I did not investigate, likely to be a missing reference.

Example.WindowsStore

4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1328,9): error APPX1101: Payload contains two or more files with the same destination path 'App.xbf'. Source files: 
4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1328,9): error APPX1101: C:\VSProjects\MvvmCross-Forms\Samples\Example.WindowStore\bin\Debug\App.xbf
4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1328,9): error APPX1101: C:\VSProjects\MvvmCross-Forms\Cirrious.MvvmCross.Forms.Presenter.WindowsStore\bin\Debug\App.xbf
4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1328,9): error APPX1101: Payload contains two or more files with the same destination path 'MainPage.xbf'. Source files: 
4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1328,9): error APPX1101: C:\VSProjects\MvvmCross-Forms\Samples\Example.WindowStore\bin\Debug\MainPage.xbf
4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1328,9): error APPX1101: C:\VSProjects\MvvmCross-Forms\Cirrious.MvvmCross.Forms.Presenter.WindowsStore\bin\Debug\MainPage.xbf

Did not investigate but it looks like a duplication of XBF between Presenter and Sample.

Next I tested examples that did compile

Example.WindowsPhone

As it stands this project will not invoke the WindowsPhone simulator. You need to chahe a property on the property pages. wp

This would bring up the Windows Phone Simulator but nothing would show.

Example.iOS

This example loads something into the iOS Simulator running on my Mac Mini but it looks for a page that does not exist and so nothing shows. My guess is that all samples will have the same problem.

Tale of diagnostic trace:

[0:] 
2015-07-03 13:30:54.852 ExampleiOS[1479:32551] mvx:Diagnostic:  2.00 Showing ViewModel FirstViewModel
[0:] mvx:Diagnostic:  2.00 Showing ViewModel FirstViewModel
[0:] 
2015-07-03 13:30:54.954 ExampleiOS[1479:32551] TouchNavigation:Diagnostic:  2.11 Navigate requested
[0:] TouchNavigation:Diagnostic:  2.11 Navigate requested
[0:] 
2015-07-03 13:30:55.055 ExampleiOS[1479:32551] mvx:Diagnostic:  2.21 Page not found for FirstPage
[0:] mvx:Diagnostic:  2.21 Page not found for FirstPage
[0:] 
2015-07-03 13:30:55.169 ExampleiOS[1479:32551] mvx:Error:  2.31 Skipping request for FirstViewModel
[0:] mvx:Error:  2.31 Skipping request for FirstViewModel
2015-07-03 13:30:55.230 ExampleiOS[1479:32551] Application windows are expected to have a root view controller at the end of application launch

In the file: // MvxPresenterHelpers.cs // 2015 (c) Copyright Cheesebaron. http://ostebaronen.dk

public static Page CreatePage(MvxViewModelRequest request)

Looks for a Type that has a name related to the ViewModel name, which in this case was "FirstViewModel". So it looks for Type "FirstPage" which does not exist in the solution. This is why nothing happens, simply get a black screen.

Now I had previously worked with the original CheeseBaron samples that actually work and it seems to me that these are not the same.

For example in the references:

ios

You can see that the Cheesebaron sample has 4 additional references and in fact uses MvvMCross WebBrowser plugin to go away and search for a movie and then later lookup its details. I liked that sample because it shows the benefit of MvvMCross: a large number of plugins that can cut your development time. This is not to say though that we cannot have other samples as well, but I would have thought that it would have been an easy exercise to bring in these working samples first.

martijn00 commented 9 years ago

Thanks @PeterBurke for testing this. I'll fix the compiling errors. About that there is nothing in the app. This is just a quick example of setting up MvvmCross with Forms, and i didn't intend to add content, but off course PR's which will add something are welcome.

PeterBurke commented 9 years ago

Thanks Martijn

I will recommend the pull if you can fix the compile errors and provide the missing view. This could be a very simple view, e.g. "Hello World".

Items that can be added later to this very simple App:

  1.  An About link that takes the user to a second view
  2.  A test Project that runs a test on the PCL and in this case the only thing that is testable is that clicking the About navigates this requires a mock navigator.

Best

P

From: Martijn van Dijk [mailto:notifications@github.com] Sent: Friday, 3 July 2015 6:53 PM To: MvvmCross/MvvmCross-Forms Cc: peter j c. burke Subject: Re: [MvvmCross-Forms] Samples for Xamarin Forms using MvvmCross (#6)

Thanks @PeterBurkehttps://github.com/PeterBurke for testing this. I'll fix the compiling errors. About that there is nothing in the app. This is just a quick example of setting up MvvmCross with Forms, and i didn't intend to add content, but off course PR's which will add something are welcome.

Reply to this email directly or view it on GitHubhttps://github.com/MvvmCross/MvvmCross-Forms/pull/6#issuecomment-118279984.

martijn00 commented 9 years ago

@PeterBurke i've fixed Android and Windows phone. I can't get Windows Store to work properly, and i have no idea what the problem is currently. I am going to merge this in for now, and then you or anyone else could improve this by creating a new PR.