Extending Xamarin Forms

XamerinFormsPart2

This is Keith’s second part to his earlier session on Introduction to XAML Forms.

Below are my in-session notes:

  • JetBrains dotPeek is a Windows app to help with XAML.  Extremely valuable according to Keith.
  • Demo was in Xamarin Studio (on Mac).  A little more stable than Visual Studio 2015 right now.
  • When starting new project, you have check boxes for target platforms (iOS & Android).
  • UITests projected created for you, by default.
  • Be sure to get latest packages because they’re updated frequently.
  • Creating a new XAML form creates a XAML file and a C# code behind file.
  • Inside XAML <ContentPage>, type in your new controls.
  • He created an Audio Recorder class to record some audio.
  • He’ll be targeting iPhone for this demo.
  • Data binding with BindableProperty type:
    • public static BindableProperty fileNMeProperty = BindableProperty.Create(“FileName”, typeof(string));
    • public string FileName{ get{ return (string)this.GetValue(FileNameProperty);} set{this.SetValue(FileNameProperty, value);}
  • MessagingCenter class lets you communicate between the layers (I presume he means between the code behind layer and the XAML layer).
  • C# code that’s native to the target platform is auto-generated (I think).
  • He built and deployed his demo to his iPhone and recorded his voice.  We didn’t hear the playback, but he swears it played back.  Don’t worry, we trust you Keith. 🙂
  • He created a “renderer” for a platform specific feature (>> on list items on iOS).  It will not fail on other platforms, it just won’t show it.

Quick & Dirty TeamCity (from zero to CI in no time)

IMG_20150711_145030Attending CodeStock 2015, I attended the session “Quick & Dirty TeamCity (from zero to CI (continuous integration) in no time)”.  Below are my notes while in the session.

The session was presented by Joel Marshall @joelmdev.  Thanks for the excellent presentation Joel!

In short, this is using TeamCity (a product with a web front end that lets your developers deploy their apps and giving you the ability to control the building of their product, in addition to automatically running their unit tests and stopping the build (or the ability for another product to deploy) if any of the unit tests fail).  TeamCity can also monitor your source control provider to automatically detect new commits and build them.

IMG_20150711_153314

  • Why TeamCity?
    • Free version supports up to 20 build configurations.
  • Installed build agent and server.
  • Set port to 8080 on dev machine so it doesn’t interfere with local IIS.
  • Edit your firewall to make a rule to open port 8080 if you want others to connect (if you’re setting up on your dev box.  If you’re setting up on a real web server, you’ll be using port 80 and won’t need to open any ports).
  • He set it up to monitor a BitBucket Git repo.
  • He then set up a build configuration and had it retrieve and build source from his Git repo on BitBucket.
  • There are all sorts of things that can happen during build and  you can configure it to take different actions on the results of each build step.
  • Miraculously, Joel successfully configured everything and got it all working.  He said he was more surprised than we were that he got it all working during the live demo.

My Comments on TeamCity (unrelated to the session)

I’ve been using TeamCity for about three and a half years (as a user, not an administrator) with 2 different companies.  I highly recommend this, in addition to using OctoDeploy (also with both companies for the same time period… OctoDeploy can receive builds from TeamCity and deploy them to different environments).

Why TeamCity?

In a company environment with multiple developers, you really don’t want your developers just handing you compiled code, asking  you to deploy it.  You should be publishing compiled code created from source code you have and from YOU building it.

TeamCity builds a deployable product from source code it gets from your source control repository.  The builds are version tagged and connected to the version it came from in Source Control.

If there are any problems with the build or running of unit tests, it will log it and provide you and the developers information on the errors.

You can configure multiple builds for the same product.  For example, you can have one build configuration for a testing environment, another for a QA environment, and another for a production environment.  As you know, all environments usually connect to different databases and web service servers, etc…   TeamCity gives you tools to change the config files from the source to make it work properly with the environment it’s working with.  In Visual Studio, developers can create web.config transforms that provide dev, QA, test, & Prod version (or as many as you like) of their web.config files and TeamCity can automatically recognize them and use the appropriate ones.

Once the product is built successfully, you can use another product to deploy the built code to the proper servers.  OctoDeploy works great with TeamCity and can auto-detect builds from TeamCity and automatically deploy them, or hold them, waiting for permission to deploy to certain environments.

Every production shop should be using tools similar to these, if not these.  It saves so much time and effort and provides an audit trail of what was published and ability to easily roll back bad deployments.  It makes building and deploying a real “thing” as opposed to just some random developer making changes to a production server with no accountability.  As a developer, myself, I want this, so I can’t be blamed for taking down a production server.  I do NOT want access to the production servers.

In addition to all of the advantages above, if you have weird stuff you have to do with any particular build/deployment process, you can automate just about all of it.

Introduction to Xamarin

CodeStock 2015 is the biggest CodeStock, by almost double this years hosted at the Knoxville World’s Fair park Convention Center.  It’s our first year having it at this convention center.  Below are my notes on the intro to Xamarin Forms session.

Xamarin is a cross platform development tool to let you write mobile apps once and deploy to Android, iOS, or Windows Phone.  It’s not from Microsoft, but it’s a .Net platform that allows you to write  your code in C# (and now supports F#).  Below are my in-session notes.

IMG_20150711_105821

 

  • Xamarin FORMS adds shared UI Code (this is new) – No more platform specific.
  • Xamerin has been around since 2000, so not a new or fly by night company.
  • They negotiate on pricing.
  • You have to pay TWICE if you want BOTH iOS And Android. UGH!
  • Xamerin forms is only for Enterprise. DOUBLE UGH!
  • Mac is required for iOS. TRIPPLE UGH!
  • Cloud testing available
    • Automatically test your app on hundreds of mobile devices. Select what to test on. They have a room in Europ filled with hundreds of phones and tablets.
    • Captures screen shots, etc…
  • Xamarin University – $1,995 per developer – Instructor live training. Free for a month right now – but there’s a catch. Only 2 of the courses are available
    • intro – what we’re about
    • and very first one (how to use it)
  • Paid gives you 3 months access to business tier – because you need it to go through the training.
  • Not only can you use C#, but you can also use F#.
  • You HAVE to know the specifics of each platform (iOS & Android)
  • Tools
    • Xamarin Studio (PC or Mac)
    • Visual Studio plugin for VS 2010 and higher (requires biz or enterprise or starter, just not indie)
  • If you want to build for Windows Phone, you have to have Visual Studio.
  • Xamarin Studio doesn’t support iOS
  • VS supports both iOS and Android
  • Xamarin Android Player (emulator) faster than Google’s. Runs on Windows & OSX
  • They have a few images (Lollipop image is available)
  • Doesn’t work well with Windows Phone emulator.
  • Xamarin supports Android Wear, Apple Watch, & Microsoft Band
  • about 90% of code can be shared across platforms
  • PCL = Portable Class Libraries used for the “core” code in multi-platform applications.
  • About 80% of a Xamarin Forms app will be located here.
  • Rosylin compiler already supported in Xamarin.
  • Xamarin Forms
    • Xamarin UI controls are an abstraction above each platform’s native controls, but compile down to platform specific controls. Provides a native experience on each platform.
    • Layouts are common screen layouts that you can choose from.
    • Yes, you can nest layouts in them.
    • Forms made with XAML. — MVVM as a result.
    • Can also do it with code.
    • Extensibility
      • Can embed custom views anywhere.
      • Call platform APIs via shared services.
      • You can go full native API if you want (kind of defeats the purpose of using Xamarin though)
  • Custom Renderers
    • You can override a renderer for a specific platform.
  • Xamarin Forms
    • Reflection will be a problem on iOS because there’s no runtime on iOS.
    • App Quality control
    • Xamarin Insights
      • Real time monitoring, track crashes, know of user problems before they report, get user’s e-mail address, etc…