Alright, so today we'll be doing a Xamarin.Native tutorial, of which we will be writing an application from scratch to being able to do SQLite database transactions.
This tutorial will be pretty detailed, in which we'll make an app which you can proudly upload to the app store ;). Or at least, it'll give you all you need to know from scratch until you can make a deployable app.
The final app will hopefully look like this:
Mockup made using MarvelApp. I highly recommend them!
Of course, to follow this tutorial, you'll need a few things:
The good thing is, that's it! Of course, if you don't have a Mac that might pose a problem.
First up, let's create a new Xamarin.Native project.
Boot up your Visual Studio 2017. Click File > New Project.
Choose Visual C# > Cross-Platform > Cross Platform App (Xamarin), as per depicted in the screenshot below. Name the project InvoiceJe.
Click OK. Now you'll encounter this dialog:
For our purpose, choose Blank App, Native and Portable Class Library (PCL). Click OK.
You will get another dialog asking for the target and minimum platform versions for the Universal Windows Platform app.
Simply choose the default and click 'OK'.
Cool, now you're all set up. Your Solution tree will look like this.
Now, the Portable Class Library represents code that is shared across all platforms. The Android, iOS and UWP obviously represents code for each platform respectively.
Feel free to divide however you want, but usually we'll put all the business logic codes inside the portable class library and the UI ones inside each platform (though sometimes things get hairy inside the UI codes, but that's a problem for another day).
Try Running Each App
Alright, for now let's try running each project.
Universal Windows Platform
Let's try with Universal Windows Project. This is easy because we can simply run it on our machine.
The methodology is: Deploy -> Run.
First, make sure you've selected InvoiceJe.UWP as the Startup Project and set it to deploy on the Local Machine at the top bar.
In the solution explorer, Right-Click on InvoiceJe.UWP and click Deploy. This will deploy the UWP on the local machine.
Next, click the Play button at the top bar. Your UWP app will now run.
You can also run your app on Windows phone by setting it to Developer Mode. Then simply plug it in and change from Local Machine to your phone.
For Android, I prefer using my Android phone.
First you'll need to set it to Developer Mode.
Next, you'll need to install Android Debug Bridge (ADB) USB Driver if you're unlucky (and in Android development, you are always unlucky).
Download and install it here: https://software.intel.com/protected-download/385047/494732
(The full article about it is here, but just download the driver at the above link and install it)
Now, after installing the ADB driver, plug your Android in. Your Android will now be a choice.
Your phone will now be in the toolbar. Change the Play Button from deploying into the Emulator to your phone.
Now, Right-Click on InvoiceJe.Android and click Deploy. Then, click the Play button. Yay!
iOS will be a bit involved because you need to Setup your Mac for Development with Xamarin first.
Once you have Setup your Mac, at the Play button, change it to your desired emulator (iPhone/iPad) and then simply click the Play button.
Alright, so did you manage all of them? Alright, so our next plaything will be Android. So, let's go!
Table of Contents
Databinding No Database
Databinding Setup (DO THIS FIRST BEFORE PROCEEDING FURTHER DOWN THE LIST): http://miaw.xyz/b/post/2017/07/25/xamarin-native-tutorial-invoiceje-databinding-setup
Databinding with Database
Setup EntityFramework and SQLite: http://miaw.xyz/b/post/2017/08/03/xamarin-native-tutorial-invoiceje-sqlite-database (DO THIS FIRST BEFORE PROCEEDING FURTHER DOWN THE LIST)
UWP: In progress
Android: In progress
iOS: In progress
(But I'm pretty sure you have already realized that you simply need to replace the methods inside RabbitService to call the database instead. And yeah you may need to refresh your screens)
Consuming RESTful Webservice + Animations
Setup: http://miaw.xyz/b/post/2017/09/20/xamarin-native-tutorial-consuming-webservice-setup (DO THIS FIRST BEFORE PROCEEDING FURTHER DOWN THE LIST)
UWP: In Progress
iOS: In progress