YOUR FIRST PROJECT WITH XAMARIN AND MVVMCROSS 4

As MvvmCross 4 project setup is slightly different than with MvvmCross 3.5, I have created this video so that everyone can get up and running with the new MvvmCross 4.

Platforms: iOS, Android and WindowsPhone.

Here are the steps from the video:

CORE PCL

1 – In Xamarin Studio, create a new solution
Select « Cross-platform -> Library -> Portable Library »

2 – Project name : « HelloMvx4.Core »
Solution name : « HelloMvx4 »

3 – Add « MvvmCross StarterPack » NuGet package

4 – Change PCL profile to 259

iOS

5 – Add a new project to the solution
Select « iOS -> App -> Single View App »

6 – App name : « HelloMvx4 »
Project name : « HelloMvx4.Touch »

7 – Add reference to « HelloMvx4.Core » project

8 – Add « MvvmCross StarterPack » NuGet package

9 – Put « AppDelegate.cs.txt » content in « AppDelegate.cs »

10 – Set as startup project and start simulator, that’s it !

ANDROID

11 – Add a new project to the solution
Select « Android -> App -> Android App »

12 – App name : « HelloMvx4 »
Project name : « HelloMvx4.Droid »

13 – Add reference to « HelloMvx4.Core » project

14 – Add « MvvmCross StarterPack » NuGet package

15 – Open « SplashScreen.cs » and replace « drawable/icon » with « mipmap/icon » (Only for Xamarin Studio, not needed for Visual Studio).

16 – Delete « MainActivity.cs »

17 – Change target framework to « Android 5 »

18 – Set as startup project and start simulator, that’s it !

WINDOWS PHONE

For windows phone I use VisualStudio community 2015,
with Windows 10 running on Parallels 11 under a Mac.

19 – Add a new project to the solution
Select « VisualC# -> Windows -> Windows 8 -> Windows Phone -> Blank App (Windows Phone) »

20 – Project name : « HelloMvx4.Store »

21 – Add reference to « HelloMvx4.Core » project

22 – Add « MvvmCross StarterPack » NuGet package

23 – Open « App.xaml.cs » file, replace the following code section in the « OnLaunched » function:


if (rootFrame.Content == null)
{
var setup = new Setup(rootFrame);
setup.Initialize();

var start = Mvx.Resolve<MvvmCross.Core.ViewModels.IMvxAppStart>();
start.Start();
}

24 – Add « using MvvmCross.Platform » in order to compile

25 – Set as startup project and start simulator, that’s it !

By | 2018-04-04T14:34:20+00:00 mai 5th, 2016|Xamarin development|72 719 Comments

72 719 Comments