Xamarinã§MvvmCrossã使ã£ãã¢ããªã®éçºãã¯ãããã«ããã£ã¦ãPCLãµãã¼ããå ¬å¼ã§ãªãä¸ã«NuGetã¢ãã¤ã³ãä¸å®å®ã ã£ãææã«ããã¸ã§ã¯ããç´æ¥ç·¨éãã¦ç¡çç¢çå°å ¥ããã¨ãããã¿ã¼ã³ãå¤ãã£ãã¨æãã¾ãã
ããããããæ°ã¶æã§Xamarinã§ã®PCLãµãã¼ããNuGetã¢ãã¤ã³ã®ãµãã¼ããæ¹åãããã¨ã«ãããããã¾ã§ãããç°¡åãã¤ç´æçã«åæè¨å®ãã§ããããã«ãªã£ã¦ãã¾ãã
æ¬ç¨¿ã§ã¯2014å¹´3ææç¹ã§ãMacä¸Xamarin Studioã§MvvmCrossã使ã£ãiOS/Androidã¯ãã¹ãã©ãããã©ã¼ã éçºç°å¢ãã»ããã¢ããããæ¹æ³ããç´¹ä»ãã¾ãã
NuGetã®ã»ããã¢ãã
ã¾ããXamarin StudioããNuGetã使ç¨ã§ããããã«ãã¾ãã
Xamarin Studioãèµ·åãã[Xamarin Studio]ã¡ãã¥ã¼ãã[ã¢ãã¤ã³ããã¼ã¸ã£ã¼]ãé¸æãã¾ãã
[Gallery]ã¿ãã®[ãªãã¸ããª]ãããããã¦ã³ãªã¹ãããã[Manage Repositoies...]ãé¸æãã¾ãã
追å ãã¯ãªãã¯ããNuGetã¢ãã¤ã³ã®ãªãã¸ã㪠http://mrward.github.com/monodevelop-nuget-addin-repository/4.0/main.mrep ã追å ãã¾ãã(NuGetã¢ãã¤ã³ã®æ¬å®¶ãã¼ã¸ã¯ https://github.com/mrward/monodevelop-nuget-addin ã«ããã¾ã)
NuGet Package Managementã追å ãããã®ã§ãã¤ã³ã¹ãã¼ã«ãã¾ãã
ããã¸ã§ã¯ãã®ä½æ
ä½æããã¢ããªã®ããã¸ã§ã¯ããä½æãã¾ãã
ã¾ããå ±éãã¸ãã¯ã¨ãªãCoreããã¸ã§ã¯ããä½æãã¾ãã[ãã¡ã¤ã«]ã¡ãã¥ã¼[æ°è¦]ã®ä¸ã«ãã[ã½ãªã¥ã¼ã·ã§ã³]ãé¸ã³ã[C#]ã®[Portable Library]ãé¸æãã¾ãã
ããã¸ã§ã¯ãåã¯ã(ã¢ããªå).Coreãã½ãªã¥ã¼ã·ã§ã³åã¯(ã¢ããªå)ã¨ãã¾ããããã§ã¯ã¢ããªåãCrossTestAppã¨ãã¾ããã ãã®ã¨ããå ã«ããã¸ã§ã¯ãåãã»ãããã¦ããã½ãªã¥ã¼ã·ã§ã³åãç·¨éãã¦ãã ãããå ã«ã½ãªã¥ã¼ã·ã§ã³åãç·¨éããã¨ããã¸ã§ã¯ãåãç·¨éããã¨ãã«é£åãã¦å¤æ´ããã¦ãã¾ãã¾ãã
å¼ãç¶ããã½ãªã¥ã¼ã·ã§ã³ã«ããã¸ã§ã¯ãã追å ãã¦ããã¾ããã½ãªã¥ã¼ã·ã§ã³ã¨ã¯ã¹ããã¼ã©ã«ãããã½ãªã¥ã¼ã·ã§ã³ãå³ã¯ãªãã¯ãã[追å ]ã®[æ°ããããã¸ã§ã¯ãã®è¿½å ]ãé¸ã³ãããã¸ã§ã¯ã追å ãã¾ãã
ä¸è¨ã®2ããã¸ã§ã¯ãã追å ãã¾ã
ãªãã(ã¢ããªå)ã®æ¬¡ã«ã¤ããããã¸ã§ã¯ã種é¡ã®ååã¯ãMvvmCrossã®ä»ã®ä»çµã¿ã¨ãããã¦ãä¸è¨ã®ããã«ãã¦ããã¨ããããããã®ã§ããã«æ²¿ããã¨ãæ¨å¥¨ãã¾ãã
- iOS: Touch
- Android: Droid
- Mac: Mac
- Windowsãã¹ã¯ããã(WPF): Wpf
- Windows Phone: WindowsPhone
- Windows ã¹ãã¢ã¢ããª: WindowsStore
追å ããããã¸ã§ã¯ãã®æ´ç
追å ããããã¸ã§ã¯ãå ã®ãã¡ã¤ã«ã¯MvvmCrossã¨ç«¶åãããä¸è¦ã¨ãªãã®ã§èª¿æ´ãã¦ããã¾ãã
ã¾ããCoreã®ãªãã·ã§ã³ã表示ãã[ãã«ã]ããªã¼[ä¸è¬]ãé¸ã³ã[Current Profile]ã[4.5 - Profile78]ãé¸ã³ã¾ãã
ã¾ããCore ã«è¿½å ããã¦ããMyClass.csã¯åé¤ãã¦ããã¾ãã
Droidã®ããã¸ã§ã¯ãã§ã¯ãMvvmCrossã®NuGetããã±ã¼ã¸ãã»ããã¢ãããããã©ã«ãã®å称ã«åãããããã«ãResourcesãã©ã«ãå ã®åãã©ã«ãåã大æåã«å¤æ´ãã¾ãããã®ã¨ãåç´ã«å¤§æåã«ããã ãã ã¨ãã§ã«åå¨ããã¨ã¢ã©ã¼ããåºããããä¸åº¦éãååãçµç±ãã¦å¤æ´(layoutã_layoutã«ããã¦ãããLayoutã«ããç)ãã¾ãã
ã¾ããããã©ã«ãã®MainActivity.csã¯ä¸è¦ãªã®ã§åé¤ãã¦ããã¾ãã
åç §è¨å®ã®å®ç¾©
DroidãTouchã®ããã¸ã§ã¯ãããåç §è¨å®ãä½æãã¾ããåç §ã®ãã©ã«ããããã«ã¯ãªãã¯ããã¨åç §è¨å®ã®ç»é¢ã表示ããã¾ãã®ã§[Projects]ã¿ããé¸æããCoreã®ããã¸ã§ã¯ããé¸æãã¾ãã
MvvmCrossã®ã¤ã³ã¹ãã¼ã«
ããã¸ã§ã¯ãã«MvvmCrossãã¤ã³ã¹ãã¼ã«ãã¾ããã½ãªã¥ã¼ã·ã§ã³ãå³ã¯ãªãã¯ãã¦[Manage NuGet Packages]ãé¸æãã¾ãã
NuGetã®ããã±ã¼ã¸æ¤ç´¢ãã¤ã¢ãã°ãéãã¾ãã®ã§ãMvvmCrossãæ¤ç´¢ãã[MvvmCross - Hot Tuna Starter Pack]ãé¸æãã¾ãã
ã¤ã³ã¹ãã¼ã«ããã¿ã¼ã²ããã®ããã¸ã§ã¯ããé¸æããç»é¢ã表示ãããã®ã§ããã¹ã¦é¸æãã¦OKãã¯ãªãã¯ãã¾ãã
ãã®å¦çãè¡ãã¨ãããã¸ã§ã¯ãã«ã©ã¤ãã©ãªã追å ãããã²ãªå½¢ãä¸æ°ã«çæããã¾ãã
AppDelegateã®ã³ãã¼
Touchã®ããã¸ã§ã¯ãã«ãAppDelegate.cs.txtãçæããã¾ãã®ã§ãAppDelegate.csã®å 容ããã®ãã¡ã¤ã«ã®å 容ã§ä¸æ¸ããã¾ãã
ä½æ¥ãçµããã°ãAppDelegate.cs.txtã¯ä¸è¦ã¨ãªãã®ã§åé¤ãã¾ãã
ã¨ããããåããã¦ç¢ºèªãã
以ä¸ã§ããã¸ã§ã¯ãã®åæè¨å®ã¯å®äºã§ããã¾ãã¯ããããåããã¦ã¿ã¾ãããã
ç¡äºã«åãã¾ããã§ãããããããã§MvvmCrossã使ã£ãéçºã®æºåãæ´ãã¾ããã