SlideShare una empresa de Scribd logo
1 de 51
VSUG DAY – Summer (2012.06.16)

JavaScript + HTML5 と
C# + XAML で作る
Windows 8 アプリ
            小島 富治雄
自己紹介
•   小島 富治雄
•   @Fujiwo
•   福井コンピュータ株式会社
•   Microsoft MVP C# (2005-2012)



               VSUG DAY - Winter 2012.06.16   2
アジェンダ

 1. Windows 8                  3. WinRT とは何か



 2. Metro スタイル                 4. デモ


                VSUG DAY - Winter 2012.06.16
Windows 8




            VSUG DAY - Winter 2012.06.16
Windows 8

二本立て!
• Metro スタイル UI
• 従来デスクトップ

            VSUG DAY - Winter 2012.06.16
Windows 8
4エディション
  Windows 8
  Windows 8 Pro                            x86
                                           x64
  Windows 8 Enterprise
  Windows RT                               ARM

            VSUG DAY - Winter 2012.06.16
Windows 8 と Windows RT
             従来デスクトップ アプリ                 Metro スタイル アプリ

Windows 8    •   従来通り                     • 全画面
x86/x64          Win32 API                • 新 API “WinRT”
             •   .NET                     • C#/VB+XAML
             •   Silverlight              • JavaScript+HTML5
             •   ほとんどそのまま動作               • C++ + XAMLで
                                            ネイティブ アプリも可
                                          • Market Place で配布
Windows RT   ×                                • 審査あり
ARM


                    VSUG DAY - Winter 2012.06.16
Windows RT
「Metro スタイルアプリなら全て他の
Windows 8 と互換性がある」わけではない
   ○ HTML + JavaScript で作ったもの
   ○ C# + XAML で作ったもの
   × C++ + XAML
      ネイティブなので Windows RT では
      バイナリ互換なし
             VSUG DAY - Winter 2012.06.16
Metro スタイル




        VSUG DAY - Winter 2012.06.16
Metro スタイル



大きく GUI の考え方を変える必要
これまでの GUI と混ぜられない


        VSUG DAY - Winter 2012.06.16
Metro スタイル
タッチ & マウス/キーボード
基本フルスクリーン
  カスケード ウィンドウじゃない
  タイトルバー、従来のメニューがない
横長
  横スクロール
        VSUG DAY - Winter 2012.06.16
Metro スタイル アプリ
新たな GUI への対応
ライブタイル
  バッチ
チャーム
アプリ バー
トースト通知
セマンティック ズーム
        VSUG DAY - Winter 2012.06.16
Metro スタイル
通常明示的に「終了」しない
  裏に回ってもサスペンド状態で継続
  (メモリ不足になったときなどに)
            不意に終了される
  他のタブレットやスマートフォン同様
  状態保存のタイミングも 変わってくる
     「サスペンド時に状態保存」
        VSUG DAY - Winter 2012.06.16
Metro アプリ ライフサイクル
  実行開始
 (Activate)
                 アクティブ


      一時停止                    実行再開
     (Suspend)                (Resume)

                 非アクティブ
要状態の保存                                        終了
              VSUG DAY - Winter 2012.06.16
                                           (Terminate)
Metro スタイル アプリ

    – 移植性

      VSUG DAY - Winter 2012.06.16
Metro スタイル – 移植性
従来デスクトップアプリからの
    移植は容易?
   UI が全然違うので困難
   API が異なるので困難
Windows Phone 7 アプリからの
        移植は容易?
   XAML 部分は似ている
   将来は可能に?

          VSUG DAY - Winter 2012.06.16
どちらも Metro UI だが…
Windows Phone 7
   Silverlight for Windows Phone
        .NET 4相当
   XNA (Xbox と共通)
Windows 8
   WinRT + DirectX
   .NET 4、4.5
             VSUG DAY - Winter 2012.06.16
Windows Phone 8 で
統合化の動き?
タブレットとスマートフォン
でコードの共通化?
  iOS や Android と同様

          VSUG DAY - Winter 2012.06.16
WinRT とは何か?


     VSUG DAY - Winter 2012.06.16
WinRT


  何それ?
  .NET と何が違うの?

        VSUG DAY - Winter 2012.06.16
WinRT とは何か?

デスクトップアプリ用
  従来の Win32 API
Merto スタイル アプリ用
  “WinRT”
        VSUG DAY - Winter 2012.06.16
WinRT とは何か?
Win32 API とは別の
          Windows RunTime
   Win32 API を置き換える
   Metro アプリ用
.NET とは別もの
   .NET は API ではない
         VSUG DAY - Winter 2012.06.16
Win 32 API と WinRT の比較

Win 32 API                WinRT
従来の API                   新 API
C スタイル                    OOP スタイル
主に デスクトップ ア               主に Metro スタイル
プリ用                       アプリ用

           VSUG DAY - Winter 2012.06.16
VSUG DAY - Winter 2012.06.16
WinRT とは何か?

COM ベースの API
   .NET ではない
   Win32 API よりはオブジェクト指向
   C++ で書かれている


         VSUG DAY - Winter 2012.06.16
Metro アプリの開発環境
•       HTML5/CSS3 + JavaScript                    New!


•       C#, VB + XAML      New!
    •    Silverlight 感覚
•       C++ + XAML            New!

                                                  状況に
WinRT 上で動作                                       合わせて
                                                   選択
                  VSUG DAY - Winter 2012.06.16
HTML5/CSS3 + JavaScript ?

• 描画エンジンは Internet
  Explorer と同じ (Trident)
 •   JavaScript エンジンは Chakra
• WinJS で WinRT が使える
           VSUG DAY - Winter 2012.06.16
参考: C++ + XAML?
•       ネイティブ コード + XAML
•       C++ とは言っても、従来の C++ を拡張
        したもの

C++/CX
    •    C++/CLI ではない
    •    C++11 ではない
              VSUG DAY - Winter 2012.06.16
WinRT とは何か?
C#/VB から呼べる
   CLI から呼ぶ仕組みがある
   型は自動変換
JavaScript から呼べる
   JavaScript から WinRT の API をコール
   “WinJS”


           VSUG DAY - Winter 2012.06.16
言語プロジェクション
      C++
   (ネイティブ)                                  WinRT
                                        (COMベース
 C#/VB       CLR                        ネイティブ)
(マネージ)


JavaScript   Chakra                 WinMD
                                     Windows MetaData
              VSUG DAY - Winter 2012.06.16 (型情報)
WinRT と .NET
WinRT 自体はネイティブ コード
WinRT と .NET は似ているが型が少し違う
   IIterable<T> ⇔ IEnumerable<T>
 参考: .NET 4.5 で Metro アプリ向けに非同
 期が強化
   Windows 8 は .NET 3.5 が入っていない
   .NET 4.5 は Windows Vista に対応しない
             VSUG DAY - Winter 2012.06.16
Metro アプリ

従来の Win32 API は呼べるの?
  DirectX は呼べる

                                       DirectX 11.1

        VSUG DAY - Winter 2012.06.16
参考: デスクトップ アプリの開発環境
従来通り
  C++ + Win32API
  C#, VB + .NET 4, 4.5

Win32 API, .NET, Silverlight 上で動作

             VSUG DAY - Winter 2012.06.16
WinRT での開発の特徴

•非同期プログラミング
•UI コードの分離

     VSUG DAY - Winter 2012.06.16
非同期?
•UI スレッドで重い処理を行うと UI
 が固まる
     同期処理               UIスレッド

     イベント
                     イベントハンドラ
                         で
     イベント
                      時間の掛かる
                        処理


        VSUG DAY - Winter 2012.06.16
非同期
 非同期処理
              UIスレッド                    別スレッド


イベント 1   イベントハンドラ
             1
                                        時間の掛かる
イベント 2   イベントハンドラ
                                          処理
             2
              1 の続き



         VSUG DAY - Winter 2012.06.16
WinRT では多くの API が非同期に
•       非同期呼び出しだらけ
    •    タブレット等のデバイスで有効
    •    50ms 以上掛かる可能性がある API は非同期版のみ
•       非同期呼び出し?
    •   APIの機能リクエストと結果受け取りが別

※ これまでのプログラミング方法では複雑なコードに
   → async/await が有効
 var client = new SyndicationClient();
 var feed = await client.RetrieveFeedAsync(new Uri(feedUri));
                      VSUG DAY - Winter 2012.06.16
UI コードの分離
• XAML + C#/VB
• MVVM パターンが有効
• XAML + C++
• HTML5/CSS3 + JavaScript
         VSUG DAY - Winter 2012.06.16
Visual Studio 2012 RC




            VSUG DAY - Winter 2012.06.16
Visual Studio 2012 RC




            VSUG DAY - Winter 2012.06.16
JavaScript + HTML5/CSS3

DEMO
 • ファイル構成
 • アプリ ライフサイクル

           VSUG DAY - Winter 2012.06.16
Metro アプリ ライフサイクル
  実行開始
 (Activate)
                 アクティブ


      一時停止                    実行再開
     (Suspend)                (Resume)

                 非アクティブ
要状態の保存                                        終了
              VSUG DAY - Winter 2012.06.16
                                           (Terminate)
WinJS のコントロール
•       メニュー
    •   WinJS.UI.Menu
•       アプリバー
    •   WinJS.UI.AppBar
•       リストビュー
    •   WinJS.UI.ListView
等
                 VSUG DAY - Winter 2012.06.16
参考: Promise による非同期処理




        VSUG DAY - Winter 2012.06.16
参考: データバインド




      VSUG DAY - Winter 2012.06.16
セマンティック ズーム




        VSUG DAY - Winter 2012.06.16
C# + XAML

DEMO
 • ファイル構成
 • データバインド
 • ViewModel
            VSUG DAY - Winter 2012.06.16
Metro アプリ ライフサイクル
  実行開始
 (Activate)
                 アクティブ


      一時停止                    実行再開
     (Suspend)                (Resume)

                 非アクティブ
要状態の保存                                        終了
              VSUG DAY - Winter 2012.06.16
                                           (Terminate)
参考資料:
• Metro style app development
  http://msdn.microsoft.com/en-us/windows/apps
• Windows 8 Metro Style App samples
  http://code.msdn.microsoft.com/windowsapps/
• Windows Developer Days 2012 | Channel 9
  http://channel9.msdn.com/Events/Windows-Developer-
  Days/Windows-Developer-Days-2012
• TechEd North America 2012 | Channel 9
  http://channel9.msdn.com/Events/TechEd/NorthAmerica/2
  012
                   VSUG DAY - Winter 2012.06.16
参考: Metro スタイルアプリのガイドライン


• Metro スタイルの設計原則
 http://msdn.microsoft.com/library/ja-
 jp/windows/apps/hh781237
• Metro スタイル アプリのナビゲーション デザイン
 http://msdn.microsoft.com/ja-
 jp/library/windows/apps/hh761500.aspx
• Metro スタイル アプリの UX ガイドライン
 http://msdn.microsoft.com/ja-
 jp/library/windows/apps/hh465424.aspx
                    VSUG DAY - Winter 2012.06.16
VSUG DAY – Summer (2012.06.16)

JavaScript + HTML5 と
C# + XAML で作る
Windows 8 アプリ
            小島 富治雄

Más contenido relacionado

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

20120616 java script+html5とc#+xamlで作るwindows8アプリ 16 9

  • 1. VSUG DAY – Summer (2012.06.16) JavaScript + HTML5 と C# + XAML で作る Windows 8 アプリ 小島 富治雄
  • 2. 自己紹介 • 小島 富治雄 • @Fujiwo • 福井コンピュータ株式会社 • Microsoft MVP C# (2005-2012) VSUG DAY - Winter 2012.06.16 2
  • 3. アジェンダ 1. Windows 8 3. WinRT とは何か 2. Metro スタイル 4. デモ VSUG DAY - Winter 2012.06.16
  • 4. Windows 8 VSUG DAY - Winter 2012.06.16
  • 5. Windows 8 二本立て! • Metro スタイル UI • 従来デスクトップ VSUG DAY - Winter 2012.06.16
  • 6. Windows 8 4エディション Windows 8 Windows 8 Pro x86 x64 Windows 8 Enterprise Windows RT ARM VSUG DAY - Winter 2012.06.16
  • 7. Windows 8 と Windows RT 従来デスクトップ アプリ Metro スタイル アプリ Windows 8 • 従来通り • 全画面 x86/x64 Win32 API • 新 API “WinRT” • .NET • C#/VB+XAML • Silverlight • JavaScript+HTML5 • ほとんどそのまま動作 • C++ + XAMLで ネイティブ アプリも可 • Market Place で配布 Windows RT × • 審査あり ARM VSUG DAY - Winter 2012.06.16
  • 8. Windows RT 「Metro スタイルアプリなら全て他の Windows 8 と互換性がある」わけではない ○ HTML + JavaScript で作ったもの ○ C# + XAML で作ったもの × C++ + XAML ネイティブなので Windows RT では バイナリ互換なし VSUG DAY - Winter 2012.06.16
  • 9. Metro スタイル VSUG DAY - Winter 2012.06.16
  • 10. Metro スタイル 大きく GUI の考え方を変える必要 これまでの GUI と混ぜられない VSUG DAY - Winter 2012.06.16
  • 11. Metro スタイル タッチ & マウス/キーボード 基本フルスクリーン カスケード ウィンドウじゃない タイトルバー、従来のメニューがない 横長 横スクロール VSUG DAY - Winter 2012.06.16
  • 12. Metro スタイル アプリ 新たな GUI への対応 ライブタイル バッチ チャーム アプリ バー トースト通知 セマンティック ズーム VSUG DAY - Winter 2012.06.16
  • 13. Metro スタイル 通常明示的に「終了」しない 裏に回ってもサスペンド状態で継続 (メモリ不足になったときなどに) 不意に終了される 他のタブレットやスマートフォン同様 状態保存のタイミングも 変わってくる 「サスペンド時に状態保存」 VSUG DAY - Winter 2012.06.16
  • 14. Metro アプリ ライフサイクル 実行開始 (Activate) アクティブ 一時停止 実行再開 (Suspend) (Resume) 非アクティブ 要状態の保存 終了 VSUG DAY - Winter 2012.06.16 (Terminate)
  • 15. Metro スタイル アプリ – 移植性 VSUG DAY - Winter 2012.06.16
  • 16. Metro スタイル – 移植性 従来デスクトップアプリからの 移植は容易? UI が全然違うので困難 API が異なるので困難 Windows Phone 7 アプリからの 移植は容易? XAML 部分は似ている 将来は可能に? VSUG DAY - Winter 2012.06.16
  • 17. どちらも Metro UI だが… Windows Phone 7 Silverlight for Windows Phone .NET 4相当 XNA (Xbox と共通) Windows 8 WinRT + DirectX .NET 4、4.5 VSUG DAY - Winter 2012.06.16
  • 18. Windows Phone 8 で 統合化の動き? タブレットとスマートフォン でコードの共通化? iOS や Android と同様 VSUG DAY - Winter 2012.06.16
  • 19. WinRT とは何か? VSUG DAY - Winter 2012.06.16
  • 20. WinRT 何それ? .NET と何が違うの? VSUG DAY - Winter 2012.06.16
  • 21. WinRT とは何か? デスクトップアプリ用 従来の Win32 API Merto スタイル アプリ用 “WinRT” VSUG DAY - Winter 2012.06.16
  • 22. WinRT とは何か? Win32 API とは別の Windows RunTime Win32 API を置き換える Metro アプリ用 .NET とは別もの .NET は API ではない VSUG DAY - Winter 2012.06.16
  • 23. Win 32 API と WinRT の比較 Win 32 API WinRT 従来の API 新 API C スタイル OOP スタイル 主に デスクトップ ア 主に Metro スタイル プリ用 アプリ用 VSUG DAY - Winter 2012.06.16
  • 24. VSUG DAY - Winter 2012.06.16
  • 25. WinRT とは何か? COM ベースの API .NET ではない Win32 API よりはオブジェクト指向 C++ で書かれている VSUG DAY - Winter 2012.06.16
  • 26. Metro アプリの開発環境 • HTML5/CSS3 + JavaScript New! • C#, VB + XAML New! • Silverlight 感覚 • C++ + XAML New! 状況に WinRT 上で動作 合わせて 選択 VSUG DAY - Winter 2012.06.16
  • 27. HTML5/CSS3 + JavaScript ? • 描画エンジンは Internet Explorer と同じ (Trident) • JavaScript エンジンは Chakra • WinJS で WinRT が使える VSUG DAY - Winter 2012.06.16
  • 28. 参考: C++ + XAML? • ネイティブ コード + XAML • C++ とは言っても、従来の C++ を拡張 したもの C++/CX • C++/CLI ではない • C++11 ではない VSUG DAY - Winter 2012.06.16
  • 29. WinRT とは何か? C#/VB から呼べる CLI から呼ぶ仕組みがある 型は自動変換 JavaScript から呼べる JavaScript から WinRT の API をコール “WinJS” VSUG DAY - Winter 2012.06.16
  • 30. 言語プロジェクション C++ (ネイティブ) WinRT (COMベース C#/VB CLR ネイティブ) (マネージ) JavaScript Chakra WinMD Windows MetaData VSUG DAY - Winter 2012.06.16 (型情報)
  • 31. WinRT と .NET WinRT 自体はネイティブ コード WinRT と .NET は似ているが型が少し違う IIterable<T> ⇔ IEnumerable<T> 参考: .NET 4.5 で Metro アプリ向けに非同 期が強化 Windows 8 は .NET 3.5 が入っていない .NET 4.5 は Windows Vista に対応しない VSUG DAY - Winter 2012.06.16
  • 32. Metro アプリ 従来の Win32 API は呼べるの? DirectX は呼べる DirectX 11.1 VSUG DAY - Winter 2012.06.16
  • 33. 参考: デスクトップ アプリの開発環境 従来通り C++ + Win32API C#, VB + .NET 4, 4.5 Win32 API, .NET, Silverlight 上で動作 VSUG DAY - Winter 2012.06.16
  • 35. 非同期? •UI スレッドで重い処理を行うと UI が固まる 同期処理 UIスレッド イベント イベントハンドラ で イベント 時間の掛かる 処理 VSUG DAY - Winter 2012.06.16
  • 36. 非同期 非同期処理 UIスレッド 別スレッド イベント 1 イベントハンドラ 1 時間の掛かる イベント 2 イベントハンドラ 処理 2 1 の続き VSUG DAY - Winter 2012.06.16
  • 37. WinRT では多くの API が非同期に • 非同期呼び出しだらけ • タブレット等のデバイスで有効 • 50ms 以上掛かる可能性がある API は非同期版のみ • 非同期呼び出し? • APIの機能リクエストと結果受け取りが別 ※ これまでのプログラミング方法では複雑なコードに → async/await が有効 var client = new SyndicationClient(); var feed = await client.RetrieveFeedAsync(new Uri(feedUri)); VSUG DAY - Winter 2012.06.16
  • 38. UI コードの分離 • XAML + C#/VB • MVVM パターンが有効 • XAML + C++ • HTML5/CSS3 + JavaScript VSUG DAY - Winter 2012.06.16
  • 39. Visual Studio 2012 RC VSUG DAY - Winter 2012.06.16
  • 40. Visual Studio 2012 RC VSUG DAY - Winter 2012.06.16
  • 41. JavaScript + HTML5/CSS3 DEMO • ファイル構成 • アプリ ライフサイクル VSUG DAY - Winter 2012.06.16
  • 42. Metro アプリ ライフサイクル 実行開始 (Activate) アクティブ 一時停止 実行再開 (Suspend) (Resume) 非アクティブ 要状態の保存 終了 VSUG DAY - Winter 2012.06.16 (Terminate)
  • 43. WinJS のコントロール • メニュー • WinJS.UI.Menu • アプリバー • WinJS.UI.AppBar • リストビュー • WinJS.UI.ListView 等 VSUG DAY - Winter 2012.06.16
  • 44. 参考: Promise による非同期処理 VSUG DAY - Winter 2012.06.16
  • 45. 参考: データバインド VSUG DAY - Winter 2012.06.16
  • 46. セマンティック ズーム VSUG DAY - Winter 2012.06.16
  • 47. C# + XAML DEMO • ファイル構成 • データバインド • ViewModel VSUG DAY - Winter 2012.06.16
  • 48. Metro アプリ ライフサイクル 実行開始 (Activate) アクティブ 一時停止 実行再開 (Suspend) (Resume) 非アクティブ 要状態の保存 終了 VSUG DAY - Winter 2012.06.16 (Terminate)
  • 49. 参考資料: • Metro style app development http://msdn.microsoft.com/en-us/windows/apps • Windows 8 Metro Style App samples http://code.msdn.microsoft.com/windowsapps/ • Windows Developer Days 2012 | Channel 9 http://channel9.msdn.com/Events/Windows-Developer- Days/Windows-Developer-Days-2012 • TechEd North America 2012 | Channel 9 http://channel9.msdn.com/Events/TechEd/NorthAmerica/2 012 VSUG DAY - Winter 2012.06.16
  • 50. 参考: Metro スタイルアプリのガイドライン • Metro スタイルの設計原則 http://msdn.microsoft.com/library/ja- jp/windows/apps/hh781237 • Metro スタイル アプリのナビゲーション デザイン http://msdn.microsoft.com/ja- jp/library/windows/apps/hh761500.aspx • Metro スタイル アプリの UX ガイドライン http://msdn.microsoft.com/ja- jp/library/windows/apps/hh465424.aspx VSUG DAY - Winter 2012.06.16
  • 51. VSUG DAY – Summer (2012.06.16) JavaScript + HTML5 と C# + XAML で作る Windows 8 アプリ 小島 富治雄