20150812 4시간만에 따라해보는 windows 10 앱 개발

85
4시간만에 따라해보는 Windows 10 앱 개발 김영욱 Evangelist [email protected]

Upload: youngwook-kim

Post on 21-Jan-2017

600 views

Category:

Mobile


0 download

TRANSCRIPT

Page 1: 20150812  4시간만에 따라해보는 windows 10 앱 개발

4시간만에따라해보는Windows 10 앱개발

김영욱 Evangelist

[email protected]

Page 2: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Agenda

1. UWP

2. XAML Controls

3. Networking

4. Linq

5. Data Binding

7. SQLite Local Database

8. Toast

9. Adaptive UI

Page 3: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Introducing the UWP

Page 4: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Phone Small Tablet2-in-1s

(Tablet or Laptop)Desktops

& All-in-OnesPhablet Large TabletClassic Laptop

Xbox IoTSurface Hub Holographic

Windows 10

Page 5: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

One Store +One Dev Center

Reuse Existing Code

One SDK + Tooling

Adaptive User Interface

NaturalUser Inputs

One Universal Windows Platform

Page 6: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Universal Windows Platform

A single API surfaceA guaranteed API surface

The same on all devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Page 7: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Windows app

A single binary Running on any device

Testing for capabilities

Adjusting to devices

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Page 8: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

2:05

Hello devices

Page 9: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Page 10: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Platform extensions

Device-specific APIFamily-specific capabilities

Compatible across devices

Unique update cadence

PhoneDevice

XboxDevice

DesktopDevice

Windows Core

Universal Windows Platform

Windows App

Phoneextension

Xboxextension

Desktopextension

Page 11: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Universal Windows Platform

One Operating SystemOne Windows core for all devices

One App PlatformApps run across every family

One Dev CenterSingle submission flow and dashboard

One Store Global reach, local monetization Consumers, Business & Education

Page 12: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Windows 10operating system

Bridging technologies

Win32desktop

Webhosted

JavaAndroid

Obj.CiOS

Universal Windows Platform

WWAC++& CX

.Netlanguages

HTMLDirectX

XAML

C++

.Netlanguages

MFCWFWPF

.Netruntime

Page 13: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Let’s talk about bridge technologies

Objective-CAt Build we announced iOS code can be reused in a Windows app

AndroidAt Build we announced Android code can be reused in a Windows app to run on Windows Phone

WebAt Build we announced web sites can be wrapped to run on Windows

Win32At Build we announced that Classic Windows Apps (CWA) can be packaged as an Appx

Page 14: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Blend for Visual Studio

The XAML Developer’s IDEAlways part of Visual Studio

Uses the Visual Studio shell

Full auto-complete & intellisense

• Validation

• Snippets

• Peek

File & solution management

Resource management

Data management

Animation

States

Page 15: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Visual Studio 2015 Editions

EnterpriseArchitecture Modeling, Diagnostics, VSO/ALM & Release Management

ProfessionalArchitecture Validation, VSO/ALM & Feedback Management

Community EditionsVisual Studio Professional Edition

Page 16: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Microsoft Developer Network

Microsoft documentationhttp://msdn.Microsoft.com

http://dev.Windows.com

Microsoft traininghttp://msevents.Microsoft.com

http://MicrosoftVirtualAcademy.com

MSDN SubscriptionOperating Systems

Server/Client Products

Developer Tools

Azure/O365 Credits

Page 17: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Developer unlock

Page 18: 20150812  4시간만에 따라해보는 windows 10 앱 개발

XAML controls

Page 19: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Layout controls

<Border Thickness="" Brush="" />

<Canvas />

<Grid />

<RelativePanel />

<ScrollViewer />

<SplitView DisplayMode="" />

<StackPanel Orientation="" />

<VariableSizedWrapGrid />

<ViewBox Stretch="" />

Page 20: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Canvas

Page 21: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

StackPanel

Page 22: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Grid

Page 23: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

WrapGrid

Page 24: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

ScrollViewer

Page 25: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Viewbox

Page 26: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

RelativePanel

Some child elementsact as anchors

Most child elementsrelate to others

It's a layout techniquefriendly with States

Page 27: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Buttons

<Button Content="" />

<HyperlinkButton />

<RepeatButton />

<ToggleButton IsChecked="" />

Page 28: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Text controls

<TextBox Text="" />

<PasswordBox Text="" />

<TextBlock Text="" />

<RichEditBox Content="" />

<RichTextBlock Content="" />

<BitmapIcon UriSource="" />

<FontIcon Glyph="" />

<SymbolIcon Icon="" />

<PathIcon Data="" />

Page 29: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

SplitViewIsPaneOpen="True" IsPaneOpen="False"

DisplayMode=

"Inline"

DisplayMode=

"Overlay"

DisplayMode=

"CompactInline"

DisplayMode=

"CompactOverlay"

Page 30: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

2:05

SplitView

Page 31: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

App bars and commands

<AppBar />

<CommandBar />

<AppBarButton Label="" Icon="" />

<AppBarToggleButton IsChecked="" />

<AppBarSeparator />

Page 32: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

2:05

AppBar

Page 33: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Networking

Page 34: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Daum 검색 APIhttp://developers.daum.net/

Page 35: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Daum Open APIs

Page 36: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Daum Open APIs

Page 37: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

System.Net.Http.HttpClient

Namespace: System.Net.Http.HttpClientAssembly: System.Net.Http (in System.Net.Http.dll)

Page 38: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

System.Net.Http.HttpClient

Page 39: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Entity Class

class BookItem

{public Int64 Id { get; set; }public string Title { get; set; }public string Category { get; set; }public string ImageUrl { get; set; }public string Description { get; set; }

}

Page 40: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Linq

Page 41: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Architecture

OthersC# VB.NET

.NET Language Integrated Query (LINQ)

LINQto SQL

LINQto Objects

LINQto XML

LINQto Datasets

LINQto Entities

LINQ data source providers

ADO.NET support for LINQ

Page 42: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

LINQ to Objects

C#int[] nums = new int[] {0,4,2,6,3,8,3,1};double average = nums.Take(6).Average();var above = from n in nums

where n > averageselect n;

Page 43: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

System.Net.Http.HttpClient

Page 44: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

Linq

Page 45: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Data binding

Page 46: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Data binding basics

Page 47: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

https://msdn.microsoft.com/ko-kr/library/ms752347(v=VS.110).aspx

Page 48: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Dynamic Data

Use data binding to connect to a data sourceTypical data source would be a view model

Page 49: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

Data Binding

Page 50: 20150812  4시간만에 따라해보는 windows 10 앱 개발

SQLite Local Database

Page 51: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

SQLite.org

Documentation

SQL Syntax

C/C++ API Reference

Source and toolsdownload

Page 52: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Choice of .NET APIs

SQLite-NETLINQ syntaxLightweight ORM

SQLitePCLSQL statementsThin wrapper around the SQLite C API

using (var conn = new SQLiteConnection("demo.db"))

{

Customer customer = null;

using (var statement = conn.Prepare(

"SELECT Id, Name FROM Customer WHERE Id = ?"))

{

statement.Bind(1, customerId);

if (SQLiteResult.DONE == statement.Step()) {

customer = new Customer() {

Id = (long)statement[0],

Name = (string)statement[1] };

}

}

}

var db =new SQLite.SQLiteAsyncConnection(App.DBPath);

var _customer = await(from c in db.Table<Customer>() where c.Id == customerIdselect c).FirstOrDefaultAsync();

if (customer != null) {

var Id = _customer.Id; var Name = _customer.Name;

}

…and others!

Page 53: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Installing SQLitePCL to your Solution

Page 54: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

SQLitePCL

Page 55: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Create database and tables

private void LoadDatabase()

{

// Get a reference to the SQLite database

conn = new SQLiteConnection("sqlitepcldemo.db");

string sql = @"CREATE TABLE IF NOT EXISTS

Customer (Id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

Name VARCHAR( 140 ),

City VARCHAR( 140 ),

Contact VARCHAR( 140 )

);";

using (var statement = conn.Prepare(sql))

{

statement.Step();

}

}

Page 56: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Insert

// SqlConnection was opened in App.xaml.cs and exposed through property conn

var db = App.conn;

try

{

using (var custstmt = db.Prepare("INSERT INTO Customer (Name, City, Contact) VALUES (?, ?, ?)"))

{

custstmt.Bind(1, customerName);

custstmt.Bind(2, customerCity);

custstmt.Bind(3, customerContact);

custstmt.Step();

}

}

catch (Exception ex)

{

// TODO: Handle error

}

Page 57: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Select

public Customer GetCustomer(int customerId)

{

Customer customer = null;

using (var statement = dbconn.Prepare("SELECT Id, Name, City, Contact FROM Customer WHERE Id = ?"))

{

statement.Bind(1, customerId);

if (SQLiteResult.DONE == statement.Step())

{

customer = new Customer()

{

Id = (long)statement[0],

Name = (string)statement[1],

City = (string)statement[2],

Contact = (string)statement[3]

};

}

}

return customer;

}

Page 58: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Update

// See if the customer already exists

var existingCustomer = GetCustomer(customer.Id);

if (existingCustomer != null)

{

using (var custstmt =

dbconn.Prepare("UPDATE Customer SET Name = ?, City = ?, Contact = ? WHERE Id=?"))

{

// NOTE when using anonymous parameters the first has an index of 1, not 0.

custstmt.Bind(1, customer.Name);

custstmt.Bind(2, customer.City);

custstmt.Bind(3, customer.Contact);

custstmt.Bind(4, customer.Id);

custstmt.Step();

}

}

Page 59: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Delete

public void DeleteCustomer(int customerId)

{

using (var statement = dbconn.Prepare("DELETE FROM Customer WHERE Id = ?"))

{

statement.Bind(1, customerId);

statement.Step();

}

}

Page 60: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

SQLite using SQLitePCL

Page 61: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Toast

Page 62: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Toasts

Glance (consume)See new information from your apps.

Act (chase, or take actions)Toasts invite you to begin or complete a task.

The toast is the app’s door by chasing (clicking) it.

Additional actions enable users to perform simple tasks without context switching.

Page 63: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Toast templates

If a template meets your needs, go ahead and use it.

Previous templates remainPhone and Windows templates have been merged

Adaptive templateSame XML syntax as tiles

Page 64: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Sending toast

ScheduledSet template and time with “ScheduledToastNotification”

Toast can also be set to be recurring.

LocalSend from (foreground/background) app

This includes desktop apps with “AppUserModelID”

PushUse push services

Page 65: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Interactive toast

Page 66: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Adaptive UI

Page 67: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Page 68: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Page 69: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Adaptive design

Phone (portrait)

Tablet (landscape) / Desktop

Page 70: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Page 71: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Tailored design

Phone (portrait)

Tablet (landscape) / Desktop

Page 72: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Tailored design

Build pages/code for individual familiesUse MRT in App.xaml.cs to determine the family

One-handed interface?Typically phone or small tablets

Test diagonal screen size (<7")

if (physical_diagonal_size <= 7)

// optimized for one-handed operation

rootFrame.Navigate(typeof(MainPage_OneHanded), e.Arguments);

else

rootFrame.Navigate(typeof(MainPage), e.Arguments);

Page 73: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Visual States

Define XAML viewsUnique layout for distinct states

Simplify animationAutomatically implement state transitions

Build in BlendDesign and preview states and transitions

Page 74: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Page 75: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

Visual states

Page 76: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

How to set the visual state

VisualStateManager.Goto(element, state, transition)

public MainPage(){

this.InitializeComponent();this.SizeChanged += (s, e) =>{

var state = "VisualState000min";if (e.NewSize.Width > 500)

state = "VisualState500min";else if (e.NewSize.Width > 800)

state = "VisualState800min";else if (e.NewSize.Width > 1000)

state = "VisualState1000min";VisualStateManager.GoToState(this, state, true);

};}

Page 77: 20150812  4시간만에 따라해보는 windows 10 앱 개발

DEMO

Adaptive triggers

Page 78: 20150812  4시간만에 따라해보는 windows 10 앱 개발

A Developer’s Guide to Windows 10 Preview

http://www.microsoftvirtualacademy.com/training-courses/a-developers-guide-to-windows-10-preview

Page 79: 20150812  4시간만에 따라해보는 windows 10 앱 개발

Adaptive Code

Page 80: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Adding extensions

Page 81: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Extension SDKs

UWP

Windows Core Windows Core Windows Core Windows Core

UWP UWP UWP

Desktop Mobile Xbox More…

Page 82: 20150812  4시간만에 따라해보는 windows 10 앱 개발

The device families you choose determines which APIs you can call freely

Page 83: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Testing for capabilities

IsApiContractPresentIsEnumNamedValuePresentIsEventPresentIsMethodPresentIsPropertyPresentIsReadOnlyPropertyPresentIsTypePresentIsWriteablePropertyPresent

Windows.Foundation.Metadata.ApiInformation

Page 84: 20150812  4시간만에 따라해보는 windows 10 앱 개발

http://windows.Microsoft.com

Test capabilities at runtime

var api = "Windows.Phone.UI.Input.HardwareButtons";

if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent(api))

{

Windows.Phone.UI.Input.HardwareButtons.CameraPressed

+= CameraButtonPressed;

}

Page 85: 20150812  4시간만에 따라해보는 windows 10 앱 개발