万本电子书0元读

万本电子书0元读

顶部广告

Cross-platform UI Development with Xamarin.Forms电子书

售       价:¥

5人正在读 | 0人评论 9.8

作       者:Paul F. Johnson

出  版  社:Packt Publishing

出版时间:2015-08-26

字       数:421.3万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This book is intended for mobile software developers who are fed up with having three different code sets for the same application. If you want to put your code on all mobile platforms with minimum fuss, and just want to develop but haven't got the time to be digging too far into a particular platform, this is the book for you. Some basic knowledge of C# is assumed.
目录展开

Cross-platform UI Development with Xamarin.Forms

Table of Contents

Cross-platform UI Development with Xamarin.Forms

Credits

About the Author

Acknowledgments

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. In the Beginning…

Application planning

The design templates

A messenger – a shopping list of features

Speech to text and text to speech

Other considerations

Cross-platform considerations

Language considerations

Online translation services

The internal data structure

The messenger data structure

The message

Contacts

Backend storage

Making sure the messages get through

Setting up for Android

Setting up for iOS

Creating your iOS profile

Creating and configuring for push notifications

Exporting the certificate for Azure

Adding packages to your application

Summary

2. Let's Get the Party Started

What is Xamarin Forms?

Pages

Layouts

Views

Cells

So, how does this all work?

Storing information

Instantiating Xamarin Forms within an app

Android

iOS

Windows Phone

Adding Windows Phone to your project

Import from Mac into Visual Studio

Adding the libraries

Modifying the XAML code

Dependency injection

Inversion of Control?

Implementing DI

Customizing the UI

Gestures, maps, and WebViews

Gestures

Adding a gesture recognizer

WebViews

Displaying a web page

Displaying a generated web page

Displaying a web page from a file

Displaying a web page from a file – iOS

Displaying a web page from a file – Android

Displaying a web page from a file – Windows Phone

Maps

Setting up on iOS

Setting up on Android

Setting up on Windows Phone

Adding a map

Adding a zoom facility to a map

Sticking a pin in it

Summary

3. Making It Look Pretty and Logging In

Introducing the standard UI login experience

Abstract this, abstract that

When size really does matter

Let the device help you

That button, though…

The custom renderer

Creating a custom renderer

Customizing for Android

Implementing on iOS

A complex UI example

An Android custom renderer

An iOS custom renderer

Implementing a login screen

UI positioning

Making it look good

Using EventTrigger

Further trigger enhancements

Summary

4. Making Your Application Portable

PCLs – the pros and cons

If you don't have the full .NET base, what is the point of having a PCL?

If you don't have access to parts of libraries, such as hardware access, how can they be implemented?

Is there a processor speed hit?

Writing your PCL library

Examining the code

The old code

The new code

Other options for PCL

Summary

5. Data, Generics, and Making Sense of Information

A history lesson

.NET generics

Restrictions on using a generic class

The generic methods

Modern linked lists

LINQ me up baby – yeah!

Jumping into the code

Wait, hold on, that's wrong!

The database helper class

Generic types within the helper class

Interfacing with the data classes

Creating the helper class

The database connection

Setting up the database

Data, data everywhere…

The code bit

Getting funky with Func

Getting data back out

Too much information!

Getting Linq'd

Finding data with LINQ

Where

First and FirstOrDefault

Single and SingleOrDefault

Select

As a loop

Inline

SelectMany

Last and LastOrDefault

Ordering data

OrderBy

t=>t?

OrderByDescending

ToList, ToArray, ToDictionary, and ToLookup

Filters and mutables within LINQ

Skipping and taking data

Skip and SkipWhile

Take and TakeWhile

Other LINQ methods

Aggregate

All

Any

SequenceEqual

Summary

6. A View to a Kill

Touch-a-touch-a-touch me

Wanted… dead or alive

Knowing me, knowing you

Start all over

Little boxes made of ticky-tacky

Can we fix it? Yes we can!

Back to basics

Uncle Tommy, there's more at the door…

Size matters

And then she cried out – more

Move over Beethoven

Now you see me, now you don't

Here we go again…

Problem 1 – talking with the PCL

Problem 2 – the Android approach

Problem 3 – the iOS approach

Problem 4 – Windows Phone

She's a killer…

Modifying on Windows Phone

Let's see what's left

Summary

References

7. Connect Me to Your Other Services

Let's take a REST

POST and GET

So far, it's easy

Transferring JSON to something we can use

It's a bit messy, isn't it?

The practicalities

Let's make a start

Using Json.NET

Which is better?

The Windows Communication Framework

Using the web service

Adding a web reference

Summary

References

8. What a Bind!

A bit of a history lesson

Binding the mobile arena

A simple binding project

Let's step it up a notch

LINQ, anyone?

How to perform the binding

Can we do anything else with the bindings?

IValueConverter

Setting the horizontal position

Any other alternatives?

To the next level, we will go!

Android

Extension methods

The text width and height

Taking into account the text typeface

Converting a drawable image to a bitmap image

Adding to your list

Simulating to add a message

Summary

9. Addressing the Issue

Addressing issues

The address storage class

Accessing the internal address book

The native implementation

The native implementation for Android

The native implementation for iOS

Using the Xamarin mobile component

Installing through the component store

Installing through NuGet

Mixing components and packages

Errors

Xamarin Mobile

Viewing the address book

What is WeakReference?

Using BindingContext

Weak reference versus BindingContext

Summary

10. This is the World Calling…

Using GPS and push notifications

Setting up the iOS provisioning profile

Setting up push notifications in the app

Setting up Android for push notifications

Setting up the Android push notifications in the app

Additional permissions

The broadcast receiver

The Android service

The Register action

The Unregister action

Listening for a return

Receive

Handling the actions in code

Handling the messages

What about GPS and maps?

Why bother?

Adding the geolocation events to the code

Adding the geolocation events to Android

Adding the geolocation events to iOS

In the PCL

Creating the Xamarin Forms map

Adding the map

Map types and pins

Two caveats to be aware of

Updating the UI very often

Deregistering the listener

Summary

11. A Portable Settings Class

The native platform storage

The iOS native platform storage

The Android native platform storage

The Windows Phone native platform storage

Constructing a persistent and cross-platform settings system

Creating the initial data

Creating the implementation of the IUserSettings interface – Android

Saving preferences

Loading preferences

Creating the implementation of the IUserSettings interface – iOS

Creating the implementation of the IUserSettings interface – Windows Phone

Is there an alternative?

The XML-based solution

The GetSet class

The UserData class

The serializer class

The SQLite solution

Summary

12. Xamarin Forms Labs

What is Xamarin Forms Labs?

Installing Xamarin Forms Labs in your project

Checkboxes

iOS

Android

Windows Phone

In the PCL

The resolver

Rolling your own

PCL

The magical type T

The devil is in the detail

Should it stay or should it go?

The general UI considerations

What have we currently got?

Marrying the interface to the UI

The web view

List views

What else is there to add?

Generating the UI

Platform-specific considerations

Let's make a start – Android

iOS

Windows Phone

Creating the library

Summary

13. Social Media into the Mix

Connect me up, Scotty

Setting up the event system and interface

Setting up your Android code

Broadcast whatcha-ma-call-it?

Setting up the interface

Listening for connectivity on Windows Phone

Adding a notification

Setting up iOS

Setting up Windows Phone

Adding social media to your app

The difference between OAuth and OAuth2

Implementing OAuth

Installing Xamarin.Auth from NuGet

OAuth1 for Twitter

Let's jump on

Authentication in the application

Using OAuth2

The user interface

Summary

References

14. Bringing It All Together

Setting up Azure

Signing up

Adding data

Adding storage

Setting up the application

Adding Azure

Adding the Azure login API

Putting some meat on the bones

Sign up and log in with the same code

The automatic login

The required data to sign up

The data organization

Wrapping up the login and base settings

The Azure Storage

Storing data

Setting and storing

The messenger application

What about displaying the messages?

The message composition

Speech to text

The message composition

Lazy image loading

Contacts

Using social media

The direct invitation

Are the words "I have a cunning plan" marching with ill-deserved confidence in the direction of this?

Displaying and storing the attachments

Using file streams to save and load

And that's it!

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部