Upload
jongin-lee
View
789
Download
2
Embed Size (px)
Citation preview
소개이종인
*바람 인터렉티브 Founder* Windows Platform Development MVP * Windows Phone 앱 개발 - Design Me - 대중교통허브
[email protected]://www.facebook.com/BaramInteractive
design me
쓰고 싶다다른 사람과 떠들고 싶다
일상들의 아름다운 순간들을 남기고 주변사람들과 공유하고 싶다
음악을 마음껏 듣고 싶다맛 집 정보를 얻고 싶다
건강을 관리하고 싶다
빠르게 기록하고 정리하고 싶다
+
놀고 싶다
Universal Windows AppShared Project
Shared Project
Logic, View Model, Model, Design As-sets,View(Common)
Windows Phone
ViewPlatform specific logic
Windows
ViewPlatform specific logic
Responsive designGrid.Row xGrid.Column
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="100" /> <ColumnDefinition Width=“Auto" /> <ColumnDefinition Width="100" /> </Grid.ColumnDefinitions> <Rectangle Grid.Column=“0" Grid.ColumnSpan=“2" /></Grid>
<Grid> <Grid.RowDefinitions> <RowDefinition Height=“100" /> <RowDefinition Height=“Auto" /> <RowDefinition Height=“100" /> </Grid. RowDefinitions> <Rectangle Grid.Row=“1" /></Grid>
0
1
2
0 1 2
Responsive designGrid 화면크기에 대응 x
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width=“50" /> <ColumnDefinition Width=“1*" /> <ColumnDefinition Width="1*" /> <ColumnDefinition Width=“50" /> </Grid.ColumnDefinitions></Grid>
50 501*
1*
50 501*
1*
50 501*
1*
Responsive designViewbox x
1366x768 1920x1080
<Grid Background="Black"> <GridView Margin="100,100,0,0"> <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> </GridView></Grid>
1366x768 1920x1080
<Grid Background="Black"> <Viewbox HorizontalAlignment="Left"> <GridView Margin="100,100,0,0" Height="768" > <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> <Rectangle Fill="Red" Height="200" Width="200" /> </GridView> </Viewbox></Grid>
Element 비율 따라 크기 조정 Element 크기 조정
Responsive design윈도우 사이즈가 변했을 때 xprotected override void OnNavigatedTo(NavigationEventArgs e){ this.navigationHelper.OnNavigatedTo(e);
Window.Current.SizeChanged += Current_SizeChanged;}
protected override void OnNavigatedFrom(NavigationEventArgs e){ this.navigationHelper.OnNavigatedFrom(e); Window.Current.SizeChanged -= Current_SizeChanged;}
/// <summary>/// 윈도우의 사이즈가 변했을 때 이벤트/// </summary>public void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e){ double windowWidth = e.Size.Width; double windowHeight = e.Size.Height;
// 로직}
User data윈도우 기기간 데이터 동기화
( 데이터가 100kb 미만 , 간결한 설정 등 , 즉결성 보장 X)
Roaming Storage
( 데이터가 100kb 이상 , 데이터 용량이 큼 )
비용 지출 X 비용 지출 O
서버 혹은 클라우드 서비스 사용
User dataRoaming storage 를 통한 데이터 동기화
StorageFolder roamingFolder = ApplicationData.Current.RoamingFolder;
public async void SaveText(string saveText){ StorageFile sampleFile = await roamingFolder.CreateFileAsync("dataFile.txt", CreationCollisionOption.ReplaceExisting); await FileIO.WriteTextAsync(sampleFile, saveText);}
ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings; public void SaveSetting(){ roamingSettings.Values["exampleSetting"] = "Hello World"; roamingSettings.Values["HighPriority"] = "65";}
설정 저장
텍스트 저장
User dataOnlineIdAuthenticator 를 통한 Onedrive 동기화public class WindowsAccountAuthenticator{ OnlineIdAuthenticator authenticator;
public WindowsAccountAuthenticator() { authenticator = new OnlineIdAuthenticator(); }
/// <summary> /// 마이크로소프트 계정 로그인 및 인증 /// </summary> public async Task SignIn() { var targetArray = new List<OnlineIdServiceTicketRequest>(); targetArray.Add(new OnlineIdServiceTicketRequest("wl.signin", "DELEGATION"));
var result = await authenticator.AuthenticateUserAsync(targetArray, CredentialPromptType.PromptIfNeeded);
string AccessToken = result.Tickets[0].Value; }}
User data
Microsoft 계정 로그인( 이미 기기 연결시 생략 )
사용자에게 권한 동의
Access Token 받아옴
OnlineIdAuthenticator 를 통한 Onedrive 동기화
OnlineIdAuthenticator
Sign in
AccessToken
Access Token 으로Onedrive 와 동기화
User dataCredential Locker
API 가 User name 과 Password 를 안전하게 저장함 , Roaming 됨
MSAApp
App
void SaveCredential(string username, string password){ PasswordVault vault = new PasswordVault(); PasswordCredential cred = new PasswordCredential("MyAppResource", username, password); vault.Add(cred);}
IReadOnlyList<PasswordCredential> RetrieveCredential(string resource){ PasswordVault vault = new PasswordVault(); return vault.FindAllByResource(resource);}
Azure mobile serviceCustom API
Ex)TimeChecker
요청
현재 시간체크
현재시간리턴
https://{ServiceName}.azure-mobile.net/api/{API Name}
Rest API
C# - SDK
DateTimeOffset result = await App.{MobileServiceClientName}.InvokeApiAsync<DateTimeOffset>(“{API Name}", HttpMethod.Get, null);
"2015-01-30T13:26:11.829Z"
리턴
Azure mobile servicePush Notification
Azure MobileServicePush
wns apns gcm
// windowsvar toast = @"<toast><visual> <binding template=""ToastText01""><text id=""1"">Hello</text></binding></visual></toast>";await Notifications.Instance.Hub.SendWindowsNativeNotificationAsync(toast,userTag);
// apnsvar alert = "{\"aps\":{\"alert\":\"Hello\"}}";await Notifications.Instance.Hub.SendAppleNativeNotificationAsync(alert,userTag);
// gcmvar notif = "{ \"data\" : {\"msg\":\"Hello\"}}";await Notifications.Instance.Hub.SendGcmNativeNotificationAsync(notif,userTag);
Azure mobile service디바이스간 데이터 동기화 시나리오
Storage
Custom API
Azure MobileService
변경데이터
1
2Push
notifica-tion
동기화3 앱 켜질시동기화
Azure web service서비스에서의 웹 서비스 활용
계정 가입요청
Azure MobileService
인증 메일전송
Azure WebService
계정 인증요청
계정 인증
인증 완료
Portable Class LibraryDesign Me 에서의 PCL 사용
PCL
AzureWeb Service
AzureMobile Ser-
vice
(Shared code, logic, datamodel.. Etc)
UniversalWindows
App데이터 모델
공유
Portable Class LibraryData model 공유
PCL
UniversalApp
Mobile Ser-vice
Controllerpublic class Request{ public string request { get; set; }}
public class Result{ public string result { get; set; }}
Controller
public async Task<HttpResponseMessage>Post(Request request){ Result result = new Result(); // 처리 return Request.CreateResponse (HttpStatusCode.OK, result);}
Request
Request request = new Request()
Result result = await App.{ClientName} .InvokeApiAsync<Request, Result> (“APIName", request);
Cross platform
WebAndroidiOS
Azure 와 Xamarin, PCL 을 활용한 개발 프로세스
Service
요구
Server
Shared Logic,Code,View
개발
배포
Win-dows
PlatformSpecific