State of the Art in Mobile Development - AndRES Käver, 2016

Slides:



Advertisements
Similar presentations
Mobile App Development Using: Presented by Tyler Richey Images from
Advertisements

Who are these guys? Bruce Pulley Senior Mobile Applications Developer Andrew Rumbley Senior.
Amanda Silver Director of Program Management Visual Studio Tools for Client Applications Cross-Platform Development using Visual Studio.
CROSS PLATFORM DEVELOPMENT WITH MVVM CROSS By Ken Tucker.
Dinko Jakovljević Microsoft Student Partner | BambooLab
WinRT Apps
Real world Windows Phone development Igor
C# everywhere Building cross-platform apps with Xamarin Gill
Building Silverlight Applications Using the MVVM pattern An Introduction by Peter Messenger Senior Developer – Qmastor
Alejandro Campos Magencio MS Technical Extreme Code Sharing with C# Y A XB.
Mobile Development with Xamarin Mark Allan Ranyart
Introducing Xamarin 2.0 Introducing Xamarin 2.0 Michael Hutchinson
Hot Tuna CROSS PLATFORM DEVELOPMENT WITH.NET, XAMARIN AND MVVMCROSS.
Developing Mobile Applications using MVVM with Xamarin Forms
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Copyright© Jeffrey Jongko, Ateneo de Manila University Android.
Xamarin.Forms Hands On.
Developing Native iOS, Android, and Windows apps in C# with Xamarin
Developing Enterprise Mobile Apps with Xamarin Loren Horsager CEO, Mobile Composer.
Adam Calderon – C# MVP Application Development Practice Lead Interknowlogy.
V 1.0 Programming III. Automatic notifications (…Changed, INofityPropertyChanged, ObservableCollection ) Data formatters Data conversions Resources.
The Windows Runtime (WinRT) is the shared runtime and API space used by store apps across the Windows platform (phone and client) 5 Common WinRT.
Understanding Xamarin Development Matt
Windows Phone MVVM and Unit Testing Step by Step Andy Wigley Windows Phone Development MVP, Mobile Software Consultant APPA Mundi Ltd WPH208.
Microsoft UI Stack Ronnie Saurenmann Technical Evangelist, Microsoft Switzerland
Using NativeScript to develop native apps for IOS and Android
Windows 10 UWP MVVM In Depth
04 |Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio Ben Riga
V 1.0 Programming III. Automatic notifications with data binding (…Changed, INofityPropertyChanged, ObservableCollection, DataTemplate) Data formatters.
New for dependency properties register for property changes.
Model View ViewModel Architecture. MVVM Architecture components.
05 | Xamarin Forms, kódosztási technikák Farkas Bálint | Technical Evangelist | Microsoft.
Windows 8 apps and the MVVM pattern SILVERLIGHTSHOW.NET WEBINARS SERIES GILL CLEEREN, October 16 th
/DEV/TM #1 Building Cross-Platform Apps with Xamarin and MvvmCross Flavius-Radu DEMIAN.
Why Learn Android? Largest installation base of any operating system Over 20,000 Android devices exist Businesses will likely move more to device-based.
Build Fast and Beautiful Apps with Xamarin.Forms
What’s New In Xamarin.Forms
Whats New Xamarin and VC++ with VS 2017
Xamarin Development with
Cross-platform app development
12/29/2017 2:33 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
In Windows 8 Store Applications
Real world Windows Phone development
Maximizing Reach Through Cross-Platform Mobile Development
Xamarin: The Future of Mobile Development
Introduction to Xamarin Forms
Xamarin Studio Xamarin Curriculum for Xamarin Studio
Uvod u Xamarin.Forms Almir Vuk App Impact 4/20/2018 3:04 AM
Ben Riga 02 | Basics of View Models Ben Riga
Basic Controls and Plugins
Mobility for Real Estate – Extending JDE Core Data to User Fingertips
Microsoft Build /23/ :01 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
android architecture components with mvvm
Xamarin Technology By: Ammar Salman Instructor: Dr. Jim Fawcett
Lecture 3 Multiple Pages.
Microsoft Connect /19/2018 7:55 PM
What is it all about? .NET MeetUp in Amsterdam, NL (2017/7/11)
Tips and tricks for developing Metro style apps using XAML
What?   Accounts Accounts subscription Azure Pass Code Azure Pass Code.
Microsoft Ignite /2/2019 1:15 AM Power Up Your Cross Platform Mobile Code with Platform Specific Features using Xamarin Alec Tucker MOB331 © 2015.
Page Navigation and Data Binding in Windows Runtime Apps
What’s new for Windows 8 Devs Part 2
How to organize and document your classes
ListView and GridView (2)
Android Platform, Android App Basic Components
A very brief introduction
Introduction to Android
Bringing existing managed code into Metro style apps
Presentation transcript:

State of the Art in Mobile Development - AndRES Käver, 2016 Xamarin State of the Art in Mobile Development - AndRES Käver, 2016

X – sharing code cross platform Shared Projects Use the Shared Asset Project type to organize your source code, and use #if compiler directives as required to manage platform-specific requirements. Portable Class Libraries Create a Portable Class Library (PCL) targetting the platforms you wish to support, and use Interfaces to provide platform-specific functionality.

X – sharing code - high level overview

X – Shared Projects

X – Shared Projects Allows you to share code across multiple projects. Shared code can be branched based on the platform using compiler directives using #if __ANDROID__ Code refactoring is problematic, bigger projects are hard to read Partial class can be used instead, whole linux kernel is done with them Application projects can include platform-specific references that the shared code can utilize No output assembly – code is part of the referencing project during compilation Good solution, if code is only shared within app – no distribution to other developers

X – Portable Class Libraries

X – Portable Class Libraries Allows you to share code across multiple projects. Refactoring operations always update all affected references. 
 Cannot use compiler directives. Only a subset of the .NET framework is available to use determined by the profile selected Abstract classes are needed in PCL, fulfilled later in platform specific code A good solution if you plan to share the resulting assembly with other developers. Code readability is generally much better

X - Forms Xamarin.Forms - similar to React-s components Uses XAML and MVVM pattern XAML not mandatory, views can be constructed in code Converted into native views

X - XAML Data binding Source – provides data Target – UI control Data Binding – automatically push changes in source to target and optionally push changes back <Entry Text="{Binding FirstName}" ... />

X - MVVM Model View ViewModel View -> View Model -> Model Data UI ViewModel Logic View -> View Model -> Model Never look up!!!

X - Layouts

X - Navigation

X – Login view Create MVVM folders Add Images to platform projects Model, View, ViewModel Add Images to platform projects iOS - Place images in the Resources folder with Build Action: BundleResource Place images in the Resources/drawable directory with Build Action: AndroidResource. Filename - only lowercase letters, numerals, the underscore, and the period are allowed. Hi-Res images with @2x, @3x suffixes on iOS, Android uses xxxhdpi folders.

X – Login View Add new ContentPage to View folder In Xaml, add StackLayout Define controls inside StackLayout Image Label Entry Button

X – Login View – XAML <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="xapp1.LoginPage"> <ContentPage.Content> <StackLayout Padding="40" Spacing="15" x:Name="loginLayout" BackgroundColor="#F5FCFF"> <Image Source="logo.png" Aspect="AspectFit" /> <Label Text="ContactBase Client" FontSize="20" HorizontalTextAlignment="Center" /> <Entry x:Name="UserName" Placeholder="username" WidthRequest="150" /> <Entry x:Name="Password" Placeholder="password" WidthRequest="150" IsPassword="true" /> <Button x:Name="LoginButton" Text="Login" BackgroundColor="#48BBEC" TextColor="White" WidthRequest="10" Clicked="OnLogin" /> <Label Text="" FontSize="10" HorizontalTextAlignment="Center" TextColor="Red" x:Name="ErrorLabel"/> </StackLayout> </ContentPage.Content> </ContentPage>

X – Login View - code Updates to xaml elements are automatic     public partial class LoginPage : ContentPage     {         public LoginPage()         {             InitializeComponent();         }         public void OnLogin(object o, EventArgs e) {             Debug.WriteLine("user: "+UserName.Text+ " pass:"+Password.Text);             ErrorLabel.Text = "not implemented yet!";             Navigation.PushModalAsync(new AppContainerPage());         }     } Updates to xaml elements are automatic Navigation Push and Pop Modal or not

X – AppContainer - TabbedView <?xml version="1.0" encoding="UTF-8"?> <TabbedPage          xmlns="http://xamarin.com/schemas/2014/forms"          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"          xmlns:local="clr-namespace:xapp1;assembly=xapp1"          x:Class="xapp1.AppContainerPage">     <local:PersonsPage Title="Persons" Icon="persons.png" />     <local:ContactTypesPage Title="Contact Types" Icon="contacttypes.png" />     <local:LogoutPage Title="Logout" Icon="logout.png" /> </TabbedPage>     public partial class AppContainerPage : TabbedPage     {         public AppContainerPage()         {             InitializeComponent();         }     }

X – Data binding {Binding SomeSource} BindingContext <?xml version="1.0" encoding="UTF-8"?> <ContentPage          xmlns="http://xamarin.com/schemas/2014/forms"          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"          x:Class="xapp1.ContactTypesPage">     <ContentPage.Content>         <StackLayout Padding="40" Spacing="15" BackgroundColor="#F5FCFF">             <Label Text="{Binding TestString}" />         </StackLayout>     </ContentPage.Content> </ContentPage> {Binding SomeSource} BindingContext     public partial class ContactTypesPage : ContentPage     {         public string TestString { get; set; }         public ContactTypesPage()         {             TestString = "Brexit!";             BindingContext = this;             InitializeComponent();         }     }

X – Data binding - List <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="xapp1.ContactTypesPage">     <ContentPage.Content>         <StackLayout Padding="40" Spacing="15" BackgroundColor="#F5FCFF">             <ListView x:Name="ListView" ItemTapped="OnSelected" ItemsSource="{Binding TestStrings}">                 <ListView.ItemTemplate>                     <DataTemplate>                         <ViewCell>                             <ViewCell.View>                                 <Label x:Name="ListItem" Text="{Binding}" />                             </ViewCell.View>                         </ViewCell>                     </DataTemplate>                 </ListView.ItemTemplate>             </ListView>         </StackLayout>     </ContentPage.Content> </ContentPage>

X – Data binding - List ItemTappedEventArgs e – cast to original object DisplayAlert public partial class ContactTypesPage : ContentPage { public List<string> TestStrings { get; set; } public ContactTypesPage() { TestStrings = new List<string>() { "Ahven", "Haug", "Kiisk" }; BindingContext = this; InitializeComponent(); } public void OnSelected(object o, ItemTappedEventArgs e) { var selectedString = e.Item as string; DisplayAlert("Chosen!", selectedString+" was selected!","OK"); } }

X – MVVM - ViewModel ViewModel public class ContactTypesViewModel : INotifyPropertyChanged { private ObservableCollection<ContactType> _contactTypes = new ObservableCollection<ContactType>(); public ObservableCollection<ContactType> ContactTypes { get { return _contactTypes; } set { _contactTypes = value; OnPropertyChanged("ContactTypes"); } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { if (PropertyChanged == null) return; PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } ViewModel

X – MVVM - View <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="xapp1.ContactTypesPage">     <ContentPage.Content>         <StackLayout Padding="40" Spacing="15" BackgroundColor="#F5FCFF">             <ListView x:Name="ListView" ItemTapped="OnSelected" ItemsSource="{Binding ContactTypes}" BackgroundColor="#F5FCFF">                 <ListView.ItemTemplate>                     <DataTemplate>                         <ViewCell>                             <ViewCell.View>                                 <StackLayout Padding="0,0,0,0" Spacing="10"                                          HorizontalOptions="StartAndExpand" Orientation="Horizontal">                                     <Image Source="{Binding ImageUri}" />                                     <Label Text="{Binding ContactTypeName}"                                          HorizontalTextAlignment="Center"                                          VerticalTextAlignment="Center" />                                 </StackLayout>                             </ViewCell.View>                         </ViewCell>                     </DataTemplate>                 </ListView.ItemTemplate>             </ListView>         </StackLayout>     </ContentPage.Content> </ContentPage>

X – MVVM - Codebehind     public partial class ContactTypesPage : ContentPage     {         public ContactTypesViewModel VM { get; set; } = new ContactTypesViewModel();         public ContactTypesPage()         {             this.BindingContext = VM; // this sets the viewmodel/datasource to the XAML.             InitializeComponent();         }         protected async override void OnAppearing()         {             base.OnAppearing();             VM.ContactTypes = new ObservableCollection<ContactType>( await App.ContactTypeManager.GetContactTypesAsync());         }         public void OnSelected(object o, ItemTappedEventArgs e)         {             var selectedContactType = e.Item as ContactType;             DisplayAlert("Chosen!", selectedContactType.ContactTypeName + " was selected!", "OK");         }     }