狠狠撸

狠狠撸Share a Scribd company logo
Xamarin ハンズオ
ン
エクセルソフト株式会社
Business Development Manager
田淵 義人
ytabuchi@xlsoft.com
03-5440-7875 / 080-7015-3586
1
自己紹介 ? 田淵義人
? Xamarin コミュニティエバンジェリスト
? Microsoft MVP Visual Studio and Development
Tools 受賞?
? 目指せ!開発も????????営業
? マイナビニュースで連載中
? Build Insider Xamarin TIPS で連載中
? 本書きました(Xamarin の章)
? Twitter: @ytabuchi
? facebook: ytabuchi.xlsoft
? Blog: http://ytabuchi.hatenablog.com/
本日の流れ ? Xamarin ネイティブ基礎講習 30分
? Xamarin ネイティブハンズオン 1時間半
? 休憩 15分
? Xamarin.Forms 基礎購入 30分
? Xamarin.Forms ハンズオン 1時間半
? キャッチアップ、クロージング
3
モバイルアプリ開発に必要
なモノ
4
今までのアプ
リ開発
5
クロスプラットフォーム
開発環境
“No Silver Bullet”
6
Xamarin(ザマリン)
? C# / .NET / Visual Studio
? フル “ネイティブ” アプリ
? API 100% 移植
? コード共通化
7
Xamarin のしくみ
2つの開発手法
8
Xamarin ネ
イティブ
9
Xamarin.For
ms
UI “コード”の共
通化
ビルド時にネイ
ティブ UI にマッ
プ
XAML
10
豊富な開発者
用リソース
? 公式ドキュメント
? ペゾルド本(PDFが無料配布中)
日本語の情報
? Japan Xamarin User Group Conference
? Build Insider
? Qiita
? 田淵のブログ
? 各種ブログへのリンク
11
Xamarin ネイティブ
12
C#
13
var employees = new List<Employee>();
var seniors = from e in employees where e.Salary > 50000 select e;
var client = new HttpClient();
var result = await client.GetStringAsync("");
C# 構文
14
EditText input = new EditText(this);
String text = input.getText().toString();
input.addTextChangedListener(new TextWatcher() { ... });
var input = new EditText(this);
string text = input.Text;
input.TextChanged += (sender, e) => { ... };
Xamarin.Android
15
構成
16
ソースファイル
(C#)
UI 定義
(axml)
メタデータ
(Resources)
Activity
17
Activity 1
UI
Code
Activity 2
UI
Code
Activity 3
UI
Code
Data, files,
images など
アプリ
Layout
18
Pi.axml PiActivity.cs
Activity + Layout
19
<LinearLayout ... >
<TextView ... />
<EditText ... />
<Button ... />
<TextView ... />
</LinearLayout>
[Activity]
public class PiActivity : Activity
{
...
...
}
Resource Id
20
[Activity(MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var et = FindViewById<EditText>(Resource.Id.digitsInput);
...
}
...
}
Intent
21
Intent
22
public class MainActivity : Activity
{
...
void OnClick(object sender, EventArgs e)
{
var intent = new Intent(this, typeof(Activity2));
base.StartActivity(intent);
}
}
Navigation
23
Extra
24
Xamarin.iOS
25
構成
26
ソースファイル
(C#)
UI 定義
(Storyboard + XiB)
メタデータ
(property lists)
Frame
27
Bounds
28
View (コードで)
29
Designer
30
Constraints (制約)
31
Multi Screen
32
Segue
33
Action Segue
34
PerformSegue
35
Xamarin.Forms
36
構成要素?対応システム
37
Pages
Content MasterDetail Navigation Tabbed Carousel
38
Layouts
Stack Absolute Relative Grid ContentView ScrollView Frame
39
Controls
ActivityIndicator BoxView Button DatePicker Editor
Entry Image Label ListView Map
OpenGLView Picker ProgressBar SearchBar 狠狠撸r
Stepper TableView TimePicker WebView EntryCell
ImageCell SwitchCell TextCell ViewCell
40
レンダリング / マッピング
41
C#
42
Microsoft XAML vs Xamarin.Forms XAML
43
サポートされている XAML 機能
44
45
Attributes
46
x:Name Event
47
Event
48
OnPlatform
49
Data Binding (Mvvm)
50
ListPage.xaml
<ListView ItemsSource="{Binding .}" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Image Source="{Binding Photo}" />
<Label Text="{Binding Person}"/>
<Label Text="{Binding Department}" />
<Label Text="{Binding Age, StringFormat='{0}才'}" />
<Label Text="{Binding Followers, StringFormat='Followers: {0}'}" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Data Binding (Mvvm)
51
ListPageViewModel.cs
class ListPageViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string _person;
public string Person
{
get { return _person; }
set
{
if (_person != value)
{
_person = value;
OnPropertyChanged(nameof(Person));
}
}
}
}
Dependency Service
52
IDialer.cs : PCL
public interface IDialer
{
bool Dial(string number);
}
Use
var dialer = DependencyService.Get<IDialer>();
dialer.Dial(translatedNumber);
Dependency Service
53
PhoneDialer.cs / iOS
[assembly: Dependency(typeof(PhoneDialer))]
public class PhoneDialer : IDialer
{
public bool Dial(string number)
{
return UIApplication.SharedApplication.OpenUrl(
new NSUrl("tel:" + number));
}
}
Custom Renderer
54
RoundedButton.cs (PCL)
public class RoundedButton : Button
{
public RoundedButton() { }
}
Custom Renderer
55
RoundedButton.cs (iOS)
[assembly: ExportRenderer(typeof(RoundedButton), typeof(RoundedButtonRenderer))]
class RoundedButtonRenderer : ButtonRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
{
base.OnElementChanged(e);
if (Control != null)
{
var c = UIColor.FromRGB(0.867f, 1.0f, 0.867f); // #ddffdd
Control.Layer.CornerRadius = 25f;
Control.Layer.BackgroundColor = c.CGColor;
}
}
}
Custom Renderer
56
RoundedButton.cs (Android)
if (Control != null)
{
Control.SetBackgroundResource(Resource.Drawable.RoundedButton);
}
RoundedButton.xml (Android)
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#99cc99"/>
<corners android:radius="25dp"/>
</shape>
Xamarin Plugins
https://github.com/xamarin/plugins
57
Xamarin.Forms 完成品
58
ご清聴ありがとうございま
す。ハンズオン楽しんでく
ださい。
ご質問がありましたら、田淵までお気軽にどうぞ
ytabuchi@xlsoft.com
080-7015-3586 / 03-5440-7875
Twitter: @ytabuchi
facebook: ytabuchi.xlsoft
Blog: http://ytabuchi.hatenablog.com/
59

More Related Content

What's hot (20)

PPTX
Xamarin Overview
Madoka Chiyoda
?
PDF
Xamarin 基礎講座 2016年7月版
Yoshito Tabuchi
?
PDF
#VSUG LT #JXUG の紹介
Yoshito Tabuchi
?
PDF
Xamarin によるクロスフ?ラットフォームモハ?イルアフ?リ開発
Hironov OKUYAMA
?
PDF
Realm Mobile Platform 概要
Yoshito Tabuchi
?
PPTX
Xamarin の救世主 Unity !
Tatsuji Kuroyanagi
?
PDF
Xamarin 概要 2017/01/15
Yoshito Tabuchi
?
PDF
10分でわかる无料になった齿补尘补谤颈苍
Yoshito Tabuchi
?
PDF
Xamarin 20141212 モバイルカフェスペシャル 「C#で作るiOS/Androidのクロスプラットフォームスマホアプリ開発」
Yoshito Tabuchi
?
PDF
Xamarin から使う Azure
Yoshito Tabuchi
?
PDF
齿补尘补谤颈苍概要
Yoshito Tabuchi
?
PDF
Xamarin de:code セッション:Windows Phone / iOS / Android アプリ同時開発のススメ
Yoshito Tabuchi
?
PDF
Xamarin によるクロスフ?ラットフォームモハ?イルアフ?リ開発(2014.06)
Hironov OKUYAMA
?
PDF
Xamarin 概要 @ 「Xamarin」って何? Wエバンジェリストによる特濃「Xamarin」勉強会 Rev2
Yoshito Tabuchi
?
PDF
Xamarin で今日から始めるクロスプラットフォーム開発
友太 渡辺
?
PDF
[MW08] de:code イベントアプリの作り方 ~ Xamarin.Forms で開発しています ~
de:code 2017
?
PDF
NET Standard と Xamarin
Yoshito Tabuchi
?
PDF
齿补尘补谤颈苍の歩き方
Yoshito Tabuchi
?
PDF
20171202 齿补尘补谤颈苍の歩き方
Yoshito Tabuchi
?
PDF
Xamarin 概要 @ 2015/1/29 CROSS 2015
Yoshito Tabuchi
?
Xamarin Overview
Madoka Chiyoda
?
Xamarin 基礎講座 2016年7月版
Yoshito Tabuchi
?
#VSUG LT #JXUG の紹介
Yoshito Tabuchi
?
Xamarin によるクロスフ?ラットフォームモハ?イルアフ?リ開発
Hironov OKUYAMA
?
Realm Mobile Platform 概要
Yoshito Tabuchi
?
Xamarin の救世主 Unity !
Tatsuji Kuroyanagi
?
Xamarin 概要 2017/01/15
Yoshito Tabuchi
?
10分でわかる无料になった齿补尘补谤颈苍
Yoshito Tabuchi
?
Xamarin 20141212 モバイルカフェスペシャル 「C#で作るiOS/Androidのクロスプラットフォームスマホアプリ開発」
Yoshito Tabuchi
?
Xamarin から使う Azure
Yoshito Tabuchi
?
齿补尘补谤颈苍概要
Yoshito Tabuchi
?
Xamarin de:code セッション:Windows Phone / iOS / Android アプリ同時開発のススメ
Yoshito Tabuchi
?
Xamarin によるクロスフ?ラットフォームモハ?イルアフ?リ開発(2014.06)
Hironov OKUYAMA
?
Xamarin 概要 @ 「Xamarin」って何? Wエバンジェリストによる特濃「Xamarin」勉強会 Rev2
Yoshito Tabuchi
?
Xamarin で今日から始めるクロスプラットフォーム開発
友太 渡辺
?
[MW08] de:code イベントアプリの作り方 ~ Xamarin.Forms で開発しています ~
de:code 2017
?
NET Standard と Xamarin
Yoshito Tabuchi
?
齿补尘补谤颈苍の歩き方
Yoshito Tabuchi
?
20171202 齿补尘补谤颈苍の歩き方
Yoshito Tabuchi
?
Xamarin 概要 @ 2015/1/29 CROSS 2015
Yoshito Tabuchi
?

Viewers also liked (17)

PDF
Xamarin.Mac をこれからはじめるあなたへ
Tsubasa Hirano
?
PDF
Deep Learning技術の最近の動向とPreferred Networksの取り組み
Kenta Oono
?
PDF
齿补尘补谤颈苍.蹿辞谤尘蝉入门
一希 大田
?
PDF
iOS の動画アフ?リ開発に Xamarin を使ってみた @JXUG #2 East
irgaly
?
PPTX
齿补尘补谤颈苍.蹿辞谤尘蝉実践投入してみて
Masahiko Miyasaka
?
PDF
Raheja Vanya Sector 99A gurgaon
portfolioreal
?
PPTX
Researching the idea of flexible and open learning spaces, student’s agency a...
Global OER Graduate Network
?
ODP
#SciChallenge2017 Smoking
ChristinaAyio
?
PPTX
Journal of Endocrine Disorders
Austin Publishing Group
?
PPSX
CaribeWave 2017 Agenda de Cooperación #SemCaribe
Mirna Yonis / UCV
?
PDF
El nuevo reglamento de protección de datos en la economía digital
Adigital
?
PPTX
World Tuberculosis Day 2017 - Tuberculosis situation in the EU/EEA, 2015
European Centre for Disease Prevention and Control
?
PDF
齿础惭尝入门
一希 大田
?
PDF
XDi Presentation_Lean UX-Workshop@MCBW2017
Stefan Schmitt
?
PPTX
Production ready big ml workflows from zero to hero daniel marcous @ waze
Ido Shilon
?
PPTX
Improve collaboration and confidence with Consumer-driven contracts
Pierre Vincent
?
PPTX
动画配信の基础知识
Daiyu Hatakeyama
?
Xamarin.Mac をこれからはじめるあなたへ
Tsubasa Hirano
?
Deep Learning技術の最近の動向とPreferred Networksの取り組み
Kenta Oono
?
齿补尘补谤颈苍.蹿辞谤尘蝉入门
一希 大田
?
iOS の動画アフ?リ開発に Xamarin を使ってみた @JXUG #2 East
irgaly
?
齿补尘补谤颈苍.蹿辞谤尘蝉実践投入してみて
Masahiko Miyasaka
?
Raheja Vanya Sector 99A gurgaon
portfolioreal
?
Researching the idea of flexible and open learning spaces, student’s agency a...
Global OER Graduate Network
?
#SciChallenge2017 Smoking
ChristinaAyio
?
Journal of Endocrine Disorders
Austin Publishing Group
?
CaribeWave 2017 Agenda de Cooperación #SemCaribe
Mirna Yonis / UCV
?
El nuevo reglamento de protección de datos en la economía digital
Adigital
?
World Tuberculosis Day 2017 - Tuberculosis situation in the EU/EEA, 2015
European Centre for Disease Prevention and Control
?
齿础惭尝入门
一希 大田
?
XDi Presentation_Lean UX-Workshop@MCBW2017
Stefan Schmitt
?
Production ready big ml workflows from zero to hero daniel marcous @ waze
Ido Shilon
?
Improve collaboration and confidence with Consumer-driven contracts
Pierre Vincent
?
动画配信の基础知识
Daiyu Hatakeyama
?
Ad

Similar to Xamarin 基礎講座 (20)

PDF
Xamarin 紹介:Windows Phone / iOS / Android アプリ同時開発のススメ 2015/8/20 版
Yoshito Tabuchi
?
PDF
Xamarin 概要 @ 2014/10/18 わんくま同盟 東京勉強会 #92
Yoshito Tabuchi
?
PDF
Windows Phone / iOS / Android アプリ同時開発のススメ
Yoshito Tabuchi
?
PPTX
Xamarin基礎講座 Xamarinハンズオン(2016.09 浜松) #JXUG #jaghama
Hironov OKUYAMA
?
PPTX
Xamarin Dev days 2 xamarin.forms ja
Atsushi Nakamura
?
PDF
齿补尘补谤颈苍概要+最新情報
Yoshito Tabuchi
?
PDF
Xamarin 概要 2014年08月版
Yoshito Tabuchi
?
PDF
Xamarin.Forms のこれまでとこれから
Yoshito Tabuchi
?
PPTX
Developers.io.札幌 xamarinってと?うよ
Shinichi Hirauchi
?
PDF
齿补尘补谤颈苍をこれから始める皆様へ
Yoshito Tabuchi
?
PDF
Xamarin 概要 @ 2014/11/08 第2回 Japan Xamarin User Group Conference 西日本編
Yoshito Tabuchi
?
PDF
Visual Studio + xamarin で始めるモバイル アプリ開発
インフラジスティックス?ジャパン株式会社
?
PDF
XamarinStudio勉強会 2014/09/08
孝文 田村
?
PPTX
かけ算で使いこなす Xamarin
Tatsuji Kuroyanagi
?
PDF
Xamarin を使うとどんなことができるの?
Yoshito Tabuchi
?
PPTX
Xamarin.Forms.WPF を試してみた
m ishizaki
?
PDF
モバイル向けクロスプラットフォーム開発ツール Xamarin の概要とその利点
Yoshito Tabuchi
?
PDF
Xamarin バッドノウハウ大全
Yoshito Tabuchi
?
PDF
Xamarin の特徴と開発手法概要
Yoshito Tabuchi
?
Xamarin 紹介:Windows Phone / iOS / Android アプリ同時開発のススメ 2015/8/20 版
Yoshito Tabuchi
?
Xamarin 概要 @ 2014/10/18 わんくま同盟 東京勉強会 #92
Yoshito Tabuchi
?
Windows Phone / iOS / Android アプリ同時開発のススメ
Yoshito Tabuchi
?
Xamarin基礎講座 Xamarinハンズオン(2016.09 浜松) #JXUG #jaghama
Hironov OKUYAMA
?
Xamarin Dev days 2 xamarin.forms ja
Atsushi Nakamura
?
齿补尘补谤颈苍概要+最新情報
Yoshito Tabuchi
?
Xamarin 概要 2014年08月版
Yoshito Tabuchi
?
Xamarin.Forms のこれまでとこれから
Yoshito Tabuchi
?
Developers.io.札幌 xamarinってと?うよ
Shinichi Hirauchi
?
齿补尘补谤颈苍をこれから始める皆様へ
Yoshito Tabuchi
?
Xamarin 概要 @ 2014/11/08 第2回 Japan Xamarin User Group Conference 西日本編
Yoshito Tabuchi
?
Visual Studio + xamarin で始めるモバイル アプリ開発
インフラジスティックス?ジャパン株式会社
?
XamarinStudio勉強会 2014/09/08
孝文 田村
?
かけ算で使いこなす Xamarin
Tatsuji Kuroyanagi
?
Xamarin を使うとどんなことができるの?
Yoshito Tabuchi
?
Xamarin.Forms.WPF を試してみた
m ishizaki
?
モバイル向けクロスプラットフォーム開発ツール Xamarin の概要とその利点
Yoshito Tabuchi
?
Xamarin バッドノウハウ大全
Yoshito Tabuchi
?
Xamarin の特徴と開発手法概要
Yoshito Tabuchi
?
Ad

More from Yoshito Tabuchi (15)

PDF
Kong Summit 2021 振り返り
Yoshito Tabuchi
?
PDF
Kong 概要
Yoshito Tabuchi
?
PDF
勉强会参加のススメ
Yoshito Tabuchi
?
PDF
Kong Enterprise の紹介
Yoshito Tabuchi
?
PDF
How does a sales person grow up his community
Yoshito Tabuchi
?
PDF
C# と Xamarin
Yoshito Tabuchi
?
PDF
Xamarin で Cognitive Services を使う
Yoshito Tabuchi
?
PDF
Xamarin で Cognitive Services を使ってみよう
Yoshito Tabuchi
?
PDF
齿补尘补谤颈苍を触り始めた顷の话?触りたい人に向けて?
Yoshito Tabuchi
?
PDF
2018年の齿补尘补谤颈苍の概要と活用方法
Yoshito Tabuchi
?
PDF
Computer Vision と Translator Text API 使ってみた
Yoshito Tabuchi
?
PDF
Xamarin 概要~Windows Embedded の業務用端末から Android へのシームレスな移行~
Yoshito Tabuchi
?
PDF
ちょっとエモい话
Yoshito Tabuchi
?
PDF
Xamarin の概要と活用事例
Yoshito Tabuchi
?
PDF
Xamarin 概要
Yoshito Tabuchi
?
Kong Summit 2021 振り返り
Yoshito Tabuchi
?
Kong 概要
Yoshito Tabuchi
?
勉强会参加のススメ
Yoshito Tabuchi
?
Kong Enterprise の紹介
Yoshito Tabuchi
?
How does a sales person grow up his community
Yoshito Tabuchi
?
C# と Xamarin
Yoshito Tabuchi
?
Xamarin で Cognitive Services を使う
Yoshito Tabuchi
?
Xamarin で Cognitive Services を使ってみよう
Yoshito Tabuchi
?
齿补尘补谤颈苍を触り始めた顷の话?触りたい人に向けて?
Yoshito Tabuchi
?
2018年の齿补尘补谤颈苍の概要と活用方法
Yoshito Tabuchi
?
Computer Vision と Translator Text API 使ってみた
Yoshito Tabuchi
?
Xamarin 概要~Windows Embedded の業務用端末から Android へのシームレスな移行~
Yoshito Tabuchi
?
ちょっとエモい话
Yoshito Tabuchi
?
Xamarin の概要と活用事例
Yoshito Tabuchi
?
Xamarin 概要
Yoshito Tabuchi
?

Xamarin 基礎講座