260 likes | 373 Vues
Cross Platform Mobile Development with .NET. Greg Shackles Senior Software Engineer OLO Online Ordering greg@ gregshackles.com. Who is this guy?. Greg Shackles greg@gregshackles.com gregshackles.com Twitter: @ gshackles Google+: plus.tl/ gshackles github.com/ gshackles. C# To Go.
E N D
Cross Platform Mobile Development with .NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com
Who is this guy? Greg Shackles greg@gregshackles.com gregshackles.com Twitter: @gshackles Google+: plus.tl/gshackles github.com/gshackles
C# To Go http://shackl.es/CSharpToGo
Cross Platform Solutions and many more…
What is Mono? Implementation of the .NET CLR Open source Cross platform Supports most of .NET 4.0 mono-project.com
MonoTouch Bindings to CocoaTouch .NET – LINQ, generics, etc (Moonlight) AOT compilation Linker Memory management Integrates with Interface Builder ios.xamarin.com
Mono for Android Wraps Java/Android API .NET – LINQ, generics, etc (Moonlight) Linker Visual Studio 2010 or MonoDevelop android.xamarin.com http://xamarin.com/androidbeta
Mono for Android Architecture • Android/Managed Callable Wrappers • JNI bridges to talk between Android and Mono
Mono for Android API .NET events replace listener interfaces Action replaces Runnable Enumerations Properties Attributes and tooling generate configuration Uses standard Android resource files
Reusability Story UI Silverlight MonoTouch Mono for Android C# Business Logic Runtime .NET Mono Platform WP7 iOS Android
Platform Comparison • UI • Tooling • IDE • Designer • Emulator • Multitasking / Lifecycle • Storage • File system • Database • Shared Resources
Comparison: Views WP7 iOS Android Format XAML XIB XML Screen PhoneApplicationPage UIViewController Activity Layout StackPanel N/A (manual) LinearLayout List ListBox UITableView ListView List Item ListBox.ItemTemplate UITableViewCell View Data Source Binding UITableViewSource BaseAdapter
Comparison: Navigation Windows Phone 7 NavigationService.Navigate( newUri("/NextPage.xaml?id=42",UriKind.Relative))); iOS NavigationController.PushViewController( newNextController(42),true); Android var intent = newIntent(); intent.SetClass(this, typeof(NextActivity)); intent.PutExtra(“id",42); StartActivity(intent);
Code Sharing Techniques • Link files • Preprocessor directives #if MONOTOUCH • Messaging (publish/subscribe) • Abstraction • Third party libraries • sqlite-net • TinyIoC/ TinyMessenger • MonoMobile.Extensions
App Architecture App.MonoTouch App.MonoAndroid App.WP7 CC.Core.MonoTouch CC.Core.MonoAndroid CC.Core.WP7 CodeCamp.Core Entities Libraries DataAccess Messaging ViewModels
Questions? 15% Discount - Expires 11/30 https://store.xamarin.com/?discount=fairfieldwestchester