Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Future Decoded - VisualStudio and Xamarin talk

Stuart Lodge
November 14, 2014

Future Decoded - VisualStudio and Xamarin talk

Presented by @slodge at FutureDecoded London 12 Nov 2014

An intro to Xamarin inside Visual Studio

Sample code is at https://github.com/slodge/future-decoded-demo

Stuart Lodge

November 14, 2014
Tweet

More Decks by Stuart Lodge

Other Decks in Technology

Transcript

  1. What are Xamarin.iOS & Xamarin.Android? Microsoft .Net Win32 Mono Unix

    Xamarin.Android Android Xamarin.iOS iOS C++ COM C++ ObjC Java
  2. What are Xamarin.Android & Xamarin.iOS? Native Android and iOS apps

    written in C# • A .Net runtime on Android and iOS • .Net class libraries (e.g. System.IO.File) • .Net “Bindings” for Java and ObjectiveC objects • Tools (standalone & integrated into VS)
  3. Button button = new Button(this); button.setText("Brian Cox"); button.setOnClickListener(new View.OnClickListener() {

    @Override public void onClick(View view) { label.setText(editText.getText()); } }); layout.addView(button); var button = new Button(this); button.Text = “Brian Cox"; button.Click += (sender, args) => { label.Text = editText.Text; }; layout.AddView(button); C#
  4. Button button = new Button(this); button.setText("Brian Cox"); button.setOnClickListener(new View.OnClickListener() {

    @Override public void onClick(View view) { label.setText(editText.getText()); } }); layout.addView(button); var button = new Button(this); button.Text = “Brian Cox"; button.Click += (sender, args) => { label.Text = editText.Text; }; layout.AddView(button); C# Use common C# CamelCase conventions
  5. Button button = new Button(this); button.setText("Brian Cox"); button.setOnClickListener(new View.OnClickListener() {

    @Override public void onClick(View view) { label.setText(editText.getText()); } }); layout.addView(button); var button = new Button(this); button.Text = “Brian Cox"; button.Click += (sender, args) => { label.Text = editText.Text; }; layout.AddView(button); C# Use properties, not get/set method pairs
  6. Button button = new Button(this); button.setText("Brian Cox"); button.setOnClickListener(new View.OnClickListener() {

    @Override public void onClick(View view) { label.setText(editText.getText()); } }); layout.addView(button); var button = new Button(this); button.Text = “Brian Cox"; button.Click += (sender, args) => { label.Text = editText.Text; }; layout.AddView(button); C# Use C# events instead of listener interfaces
  7. var button = new UIButton(new RectangleF(10, 150, 300, 40)); button.SetTitle(“Brian

    Cox“, UIControlState.Normal); button.TouchUpInside += (sender, args) => { // the action to take }; View.AddSubView(button); C# UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchUpInside]; [button setTitle:@“Brian Cox" forState:UIControlStateNormal]; [view addSubview:button];
  8. var button = new UIButton(new RectangleF(10, 150, 300, 40)); button.SetTitle(“Brian

    Cox“, UIControlState.Normal); button.TouchUpInside += (sender, args) => { // the action to take }; View.AddSubView(button); C# UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchUpInside]; [button setTitle:@“Brian Cox" forState:UIControlStateNormal]; [view addSubview:button]; Use common C# CamelCase conventions Use properties, not get/set method pairs Use C# events instead of delegate protocols
  9. var button = new UIButton(new RectangleF(10, 150, 300, 40)); button.SetTitle(“Brian

    Cox“, UIControlState.Normal); button.TouchUpInside += (sender, args) => { // the action to take }; View.AddSubView(button); C# UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchUpInside]; [button setTitle:@“Brian Cox" forState:UIControlStateNormal]; [view addSubview:button]; Use enum values for constants
  10. Search for…. Enter search term Go My Booky Wook 1

    My Booky Wook 2 …. A Google Books app www.googleapis.com/books/v1/volumes?q=...
  11. What does Xamarin give VS? • A .Net RunTime on

    Android • Android “New Project” templates • C# bindings to Android Java Class Libraries • … with C# semantics • Linq, async, .Net, … • Tools for Compilation, Deployment, Debugging and Publishing • Nuget & components • A fast Android emulator • Excellent docs • An axml designer • Prompt platform updates (phone, tablet, tv, watch…)
  12. What does Xamarin give VS? • A .Net RunTime on

    Android • Android “New Project” templates • C# bindings to Android Java Class Libraries • … with C# semantics • Linq, async, .Net, … • Tools for Compilation, Deployment, Debugging and Publishing • Nuget & components • A fast Android emulator • Excellent docs • An axml designer • Prompt platform updates (phone, tablet, tv, watch…) • A .Net RunTime on iOS • iPhone and iPad “New Project” templates • C# bindings to ObjectiveC Class Libraries • … with C# semantics • Linq, async, .Net, … • Tools for Compilation, Deployment, Debugging and Publishing • Nuget & components • Excellent docs • A storyboard designer • Prompt platform updates (iOS x, 64-bit, AppleWatch?)
  13. What does Xamarin give VS? • A .Net RunTime on

    Android • Android “New Project” templates • C# bindings to Android Java Class Libraries • … with C# semantics • Linq, async, .Net, … • Tools for Compilation, Deployment, Debugging and Publishing • Nuget & components • A fast Android emulator • Excellent docs • An axml designer • Prompt platform updates (phone, tablet, tv, watch…) • A .Net RunTime on iOS • iPhone and iPad “New Project” templates • C# bindings to ObjectiveC Class Libraries • … with C# semantics • Linq, async, .Net, … • Tools for Compilation, Deployment, Debugging and Publishing • Nuget & components • Excellent docs • A storyboard designer • Prompt platform updates (iOS x, 64-bit, AppleWatch?) • PCL support • F# support – first class! • Libraries (Xamarin.Mobile, Xamarin.Social, Xamarin Forms) • Profilers • A cracking installer • Sketches • Excellent docs + Xamarin University • Xamarin Test Cloud • Xamarin Insights • A future decoded? • The aqueducts?
  14. Perfection would be boring… • It’s not free • For

    iOS development a Mac is required • Swear box occasionally required • VS tools functionality lags behind the XS tools – also, currently (IMO) not as fast or robust • Sometimes you have to drop down to XS, to the Mac and to the Google and Apple tools • Sometimes you do need to pull in third party native libraries – this is possible, tools are available to help, but can sometimes get hairy • You will need to buy “some” phones and tablets • You do need platform knowledge… • You do need platform commitment…
  15. Preferred text layout (no bullets) www.bbits.co.uk [email protected] +44 203 126

    4885 Video is on: http://vimeo.com/64097175 Video is on: http://vimeo.com/64097175
  16. Community Groups http://windowsapps.london/ Nov 26th – Preparing for Windows 10

    Dec 17th – From Windows Phone to Xamarin http://www.meetup.com/London-Mobile-Dev Nov 11th – Cross Platform Development with MvvmCross http://www.meetup.com/ Glasgow-Mobile-NET-Developers/ http://www.eventbrite.co.uk/o/ waw-wag-1935092487
  17. Satya Nadella CEO Microsoft Sir Bob Geldof Entrepreneur, philanthropist and

    political activist Sara Murray OBE Entrepreneur and businesswoman Jeremy Paxman Author, journalist and former Newsnight presenter Sir Martin Sorrell CEO of WPP Group Dame Stella Rimington Author and former Director General of MI5 12.11.14 at ExCeL London More information and ticket registration at www.futuredecoded.com