Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Cross-platform UI Development with Xamarin.Forms

You're reading from  Cross-platform UI Development with Xamarin.Forms

Product type Book
Published in Aug 2015
Publisher
ISBN-13 9781784391195
Pages 330 pages
Edition 1st Edition
Languages
Author (1):
Paul Johnson Paul Johnson
Profile icon Paul Johnson

Table of Contents (22) Chapters

Cross-platform UI Development with Xamarin.Forms
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. In the Beginning… 2. Let's Get the Party Started 3. Making It Look Pretty and Logging In 4. Making Your Application Portable 5. Data, Generics, and Making Sense of Information 6. A View to a Kill 7. Connect Me to Your Other Services 8. What a Bind! 9. Addressing the Issue 10. This is the World Calling… 11. A Portable Settings Class 12. Xamarin Forms Labs 13. Social Media into the Mix 14. Bringing It All Together Index

Chapter 14. Bringing It All Together

From developing mobile apps to using the Xamarin Forms library, we've looked at a variety of aspects until now. Everything has been done for a purpose: to show you how simple it can be to develop something effective with very little effort for three different mobile platforms. This is fine, but as with so many TV series around, there has been an overlooking arc, and this is the case here as well.

In this chapter, we will:

  • Learn how to set up Azure for mobile and storage

  • Take a look at the parts we've covered so far and may be missing from your application

Setting up Azure


Although I have set up Azure with the one month free version of Azure, it offers everything I need to get the code for this chapter up and running without any financial layout. Setting up Azure is a fairly painless process.

Signing up

Let's assume that you have a valid Microsoft login (this can be for Hotmail or any other Microsoft service, such as Skype). You will need to use this to sign up. The initial sign up screen currently looks similar to the following screenshot:

Now, perform the following steps:

  1. Enter the sections as requested. You will need to expand the payment information and fill it as required. Don't worry about supplying a credit/debit card; it's never used unless you say to use it.

  2. Once everything has been filled, click on the Sign up button. You will see the following set up screen:

    Once everything has been set up, the screen will change to this:

  3. Clicking on Start managing my service will take you to the settings screen on the Azure web interface:

    We are interested...

Setting up the application


This application requires you to use Azure and Azure Storage. The libraries for these can be found on either the Xamarin Component store or NuGet. You will also need the service endpoint and the application key. Perform the following steps:

  1. To obtain these, log in to the mobile service. The endpoint is found on the dashboard:

    The key has to be generated. There are three buttons: MANAGE KEYS, RESTART, and DELETE at the bottom of the web interface:

  2. Select MANAGE KEYS. A dialog window will appear that contains the application and the master key.

  3. You will need the APPLICATION KEY. There is a clipboard next to the application key. This is useful because you will need it in the app:

Note

I have split the source into a couple of parts. The code for this section (which includes the push code) can be found in Chapter14/xfmessenger1.

The source code (xfmessenger1) sets up the database, the Azure code, and all the backend work. Rather than reworking on the previous chapters, I...

The Azure Storage


Part of the application allows images and audio to be sent to the recipient. In order to do this, we need to utilize the Azure Storage.

Note

The source for this part can be found in Chapter14/AzureStorage.

In the first part of this chapter, we set up the Azure Storage service as part of setting up Azure.

We have already created the storage, but now, we need to configure the mobile service to use it. Head back to the Azure management portal and click on the Azure Storage menu option. Make a note of the storage account name and the primary key. These will be required to configure the mobile service.

Perform the following steps:

  1. Once you have made a note of all the values, go to the mobile service and select the Configure option. Then, scroll down to the app settings section:

  2. You will need to create two new name/value pairs:

    • STORAGE_ACCOUNT_NAME: This is the name for your storage

    • STORAGE_ACCOUNT_ACCESS_KEY: This is the primary key for the storage

  3. Once you're happy with this, click...

The messenger application


Now that we have the storage and backend sorted, we finally need to perform the messenger part. This is split into four parts:

  • Compose

  • Send/Receive

  • Contacts

  • Push

What about displaying the messages?

Messages are just a list of uneven table items. If we attach an ID to each message list from each contact, we can display the conversation. The conversation is still just a list of uneven table items. These are the simplest of tasks, so there is not much need to spend time on it.

The difficult part is the first message. If we have an ID on each message object that points to parent/previous ID, we can keep going backwards down the list. If parent/previousID is "-1", then it is at the top of the list.

For the conversations, if we have a list of all the objects with parentID of "-1", then we will have the initial message display.

The message composition

This can be done via a text entry on a keyboard or speech to text. To prevent excessive message sizes, we can set an arbitrary limit...

And that's it!


This chapter has covered all the aspects required to produce a half decent messenger application. You can find the final version with just about everything covered in this book (not just this chapter) used to produce the messenger application in the code for this chapter.

Summary


There is nothing difficult in producing a functional Xamarin Forms application. The difficulty comes with the styling of the application, and to some extent, overcoming the shortfalls via injection techniques. Hopefully, this book would have helped you to produce functional and good-looking Xamarin Forms applications for business, pleasure, or personal use for yourself.

I conclude by fulfilling a long time promise that I made to someone very close and dear to me for the end of my second book—the butler did it!

lock icon The rest of the chapter is locked
You have been reading a chapter from
Cross-platform UI Development with Xamarin.Forms
Published in: Aug 2015 Publisher: ISBN-13: 9781784391195
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}