SlideShare a Scribd company logo
1 of 18
石野 光仁@アイライト
   セッションの目的
     Metro アプリでの印刷デモを見てもらう
     印刷のサンプル・プログラムを見てもらう


   セッションのゴール
     Metroアプリでの印刷を理解する
   名前
     石野 光仁
   所属
     Microsoft MVP for C#
      ▪ 2003/10 ~ 現在
     コミュニティ
      ▪ アイライト主催
       ▪ http://www.ailight.jp
Metro スタイル 印刷の紹介
  プリンタドライバ
  Metroで印刷   デモ
  プログラム解説
  サンプル・プログラム デモ
参考:メモリ不足の話
   v3 プリンター ドライバー
     Windows8以前のドライバーモデル
     デスクトップ アプリ:従来通り利用可能
     Metro スタイル:オプションがすべて解放さ
    れた状態
   v4 プリンター ドライバー
     Windows8用に設計されたドライバーモデル
     Metro スタイルアプリをサポート
      ▪ 従来のデスクトップアプリでも利用可能
     カスタマイズUIの表示が可能
   デバイスチャーム
   アプリケーション内から印刷
     ボタン等
   Windows.Graphics.Printing. PrintManager
     public event TypedEventHandler<PrintManager,
       PrintTaskRequestedEventArgs> PrintTaskRequested;
     public static PrintManager GetForCurrentView();
     public static IAsyncOperation<bool> ShowPrintUIAsync();
private void Page_Loaded(object sender, RoutedEventArgs e)
{
       var printManager = PrintManager.GetForCurrentView();
       printManager.PrintTaskRequested +=
                               printMan_PrintTaskRequested;
}

void printMan_PrintTaskRequested(PrintManager sender,
                               PrintTaskRequestedEventArgs args)
{
        args.Request.CreatePrintTask("VSUG Test Print",
                       e => e.SetSource(_IPrintDocumentSource));
}
   Windows.UI.Xaml.Printing. PrintDocument
     IPrintDocumentSource DocumentSource { get; }
     event GetPreviewPageEventHandler
      GetPreviewPage;
     event PaginateEventHandler Paginate;
     void SetPreviewPage(int pageNumber, UIElement
      pageVisual);
public sealed partial class MainPage : Page
{
        protected PrintDocument _PrintDocument = null;
        protected IPrintDocumentSource _IPrintDocumentSource = null;

        private void Page_Loaded(object sender, RoutedEventArgs e)
    {
        _PrintDocument = new PrintDocument();

        _PrintDocument.Paginate += _PrintDocument_Paginate;
        _PrintDocument.GetPreviewPage +=

        _PrintDocument_GetPreviewPage;

        _IPrintDocumentSource = _PrintDocument.DocumentSource;
public sealed partial class MainPage : Page
{
         protected PrintDocument _PrintDocument = null;
         protected IPrintDocumentSource _IPrintDocumentSource = null;

         void _PrintDocument_Paginate(object sender, PaginateEventArgs e)
         {
         }

         void _PrintDocument_GetPreviewPage(object sender,GetPreviewPageEventArgs e)
         {
        Canvas page = new Canvas();

        var image = new Image();
        var bitmap = new BitmapImage(new Uri("ms-appx:///Assets/VSUG.png"));
        image.Source = bitmap;

        page.Children.Add(image);

        _PrintDocument.SetPreviewPage(e.PageNumber, page);
    }
   PrintDocument_Paginate(object sender, PaginateEventArgs e)
     E.PrintTaskOptionsの値
   Windows.UI.Xaml.Printing. PrintDocument
     IPrintDocumentSource DocumentSource { get; }
     event AddPagesEventHandler AddPages;
     event GetPreviewPageEventHandler
        GetPreviewPage;
       event PaginateEventHandler Paginate;
       void SetPreviewPage(int pageNumber, UIElement
        pageVisual);
       void AddPage(UIElement pageVisual);
       void AddPagesComplete();
void _PrintDocument_AddPages(object sender, AddPagesEventArgs e)
{
     Canvas page = new Canvas();

    var image = new Image();
    var bitmap = new BitmapImage(
                           new Uri("ms-appx:///Assets/VSUG.png"));
    image.Source = bitmap;

    page.Children.Add(image);

       _PrintDocument.AddPage(page);
       _PrintDocument.AddPagesComplete();
}
PrintManager                    PrintDocument
     GetForCurrentView();             DocumentSource

                                Paginate += //印刷前の情報取得

    PrintTaskRequested +=       GetPreviewPage += //プレ
                                ビュー
プリントの機能があることを伝え                   SetPreviewPage() //設定
              る
 args.Request.CreatePrintTask   AddPages += //印刷
                                   AddPage () //ページを追加
                                   AddPagesComplete () //完
                                了
   メモリ不足
     メモリ使用量:90%以上
      ▪ どのプロセスが持っているのか見えない
      ▪ 仮想メモリを使いまくって、ディスクアクセスが止
        まらない
     再起動しても直らない


   解決方法
     完全再起動:Shutdown /r
   Windows 8 の印刷の概要
     http://msdn.microsoft.com/ja-
     jp/library/windows/hardware/hh852373
   Windows 8 Release Preview Metro style
    app samples - C#, VB.NET, C++,
    JavaScript
     http://code.msdn.microsoft.com/windowsapps/
      Windows-8-Modern-Style-App-Samples
     Print sample
http://www.ailight.jp

More Related Content

Viewers also liked

デスクトップアプリ開発者が押さえておくべき Windows 8時代の変革
デスクトップアプリ開発者が押さえておくべきWindows 8時代の変革デスクトップアプリ開発者が押さえておくべきWindows 8時代の変革
デスクトップアプリ開発者が押さえておくべき Windows 8時代の変革Yuya Yamaki
 
CRIB Board of Advisors
CRIB Board of AdvisorsCRIB Board of Advisors
CRIB Board of AdvisorsRidge Mursman
 
つ部 Android 勉強会 2013年4月 発表資料
つ部 Android 勉強会 2013年4月 発表資料つ部 Android 勉強会 2013年4月 発表資料
つ部 Android 勉強会 2013年4月 発表資料Kenji Nagase
 
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39kimthoa3124
 
Blowing Performance Spa parts
Blowing Performance Spa partsBlowing Performance Spa parts
Blowing Performance Spa partsLargo, Florida
 
つ部 Android 勉強会 2013年9月 発表資料
つ部 Android 勉強会 2013年9月 発表資料つ部 Android 勉強会 2013年9月 発表資料
つ部 Android 勉強会 2013年9月 発表資料Kenji Nagase
 
Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653
Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653
Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653kimthoa3124
 
Final project- Nicole Mitchell
Final project- Nicole MitchellFinal project- Nicole Mitchell
Final project- Nicole Mitchelljburleigh0722
 
Mcpppt
McppptMcpppt
Mcppptjlweb
 
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39kimthoa3124
 
áLbum de fotografías
áLbum de fotografíasáLbum de fotografías
áLbum de fotografíasJüän Riveroz
 

Viewers also liked (13)

デスクトップアプリ開発者が押さえておくべき Windows 8時代の変革
デスクトップアプリ開発者が押さえておくべきWindows 8時代の変革デスクトップアプリ開発者が押さえておくべきWindows 8時代の変革
デスクトップアプリ開発者が押さえておくべき Windows 8時代の変革
 
CRIB Board of Advisors
CRIB Board of AdvisorsCRIB Board of Advisors
CRIB Board of Advisors
 
つ部 Android 勉強会 2013年4月 発表資料
つ部 Android 勉強会 2013年4月 発表資料つ部 Android 勉強会 2013年4月 発表資料
つ部 Android 勉強会 2013年4月 発表資料
 
Nevada county gardening
Nevada county gardeningNevada county gardening
Nevada county gardening
 
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
 
Blowing Performance Spa parts
Blowing Performance Spa partsBlowing Performance Spa parts
Blowing Performance Spa parts
 
つ部 Android 勉強会 2013年9月 発表資料
つ部 Android 勉強会 2013年9月 発表資料つ部 Android 勉強会 2013年9月 発表資料
つ部 Android 勉強会 2013年9月 発表資料
 
Karla Munoz
Karla MunozKarla Munoz
Karla Munoz
 
Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653
Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653
Căn hộ phố đông quận 9 giá rẻ 11.3tr , lh 0989.707.653
 
Final project- Nicole Mitchell
Final project- Nicole MitchellFinal project- Nicole Mitchell
Final project- Nicole Mitchell
 
Mcpppt
McppptMcpppt
Mcpppt
 
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
Căn hộ phố đông 66 m2, 735tr, lh 0915.45.75.39
 
áLbum de fotografías
áLbum de fotografíasáLbum de fotografías
áLbum de fotografías
 

Similar to Metro スタイル アプリで印刷

「Windows 8 ストア アプリ開発 tips」 hokuriku.net vol.11 (2013年1月26日)
「Windows 8 ストア アプリ開発 tips」  hokuriku.net vol.11 (2013年1月26日)「Windows 8 ストア アプリ開発 tips」  hokuriku.net vol.11 (2013年1月26日)
「Windows 8 ストア アプリ開発 tips」 hokuriku.net vol.11 (2013年1月26日)Fujio Kojima
 
第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーション
第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーション第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーション
第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーションMasashi Umezawa
 
Azure IoT Edge で Custom Vision
Azure IoT Edge で Custom VisionAzure IoT Edge で Custom Vision
Azure IoT Edge で Custom VisionYoshitaka Seo
 
リアルFacebookガジェットを作った(ロングバージョン)
リアルFacebookガジェットを作った(ロングバージョン)リアルFacebookガジェットを作った(ロングバージョン)
リアルFacebookガジェットを作った(ロングバージョン)Mariko Goda
 
Chrome Extensionsの基本とデザインパターン
Chrome Extensionsの基本とデザインパターンChrome Extensionsの基本とデザインパターン
Chrome Extensionsの基本とデザインパターンYoichiro Tanaka
 
OSC2011 Androidハンズオン
OSC2011 AndroidハンズオンOSC2011 Androidハンズオン
OSC2011 AndroidハンズオンKatsumi Honda
 
Android Lecture #04 @PRO&BSC Inc.
Android Lecture #04 @PRO&BSC Inc.Android Lecture #04 @PRO&BSC Inc.
Android Lecture #04 @PRO&BSC Inc.Yuki Higuchi
 
データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回Naoyuki Yamada
 
Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界Yuji Takayama
 
小さな開発会社でもできた、WordPress 新ビジネスの可能性 -WordCamp Kansai 2024-
小さな開発会社でもできた、WordPress 新ビジネスの可能性  -WordCamp Kansai 2024-小さな開発会社でもできた、WordPress 新ビジネスの可能性  -WordCamp Kansai 2024-
小さな開発会社でもできた、WordPress 新ビジネスの可能性 -WordCamp Kansai 2024-KojiMaruyama5
 
Titanium Mobile
Titanium MobileTitanium Mobile
Titanium MobileNaoya Ito
 
How to django at first
How to django at firstHow to django at first
How to django at firstMaito Kuwahara
 
Extending the Unity Editor Extended
Extending the Unity Editor ExtendedExtending the Unity Editor Extended
Extending the Unity Editor ExtendedMasamitsu Ishikawa
 
【ネイティブアドを支えるPhantomJS】
【ネイティブアドを支えるPhantomJS】【ネイティブアドを支えるPhantomJS】
【ネイティブアドを支えるPhantomJS】Kengo Shimada
 
初めての Data api cms どうでしょう - 大阪夏の陣
初めての Data api   cms どうでしょう - 大阪夏の陣初めての Data api   cms どうでしょう - 大阪夏の陣
初めての Data api cms どうでしょう - 大阪夏の陣Yuji Takayama
 
WordPress widget api
WordPress widget apiWordPress widget api
WordPress widget apiTakami Kazuya
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejsTakayoshi Tanaka
 

Similar to Metro スタイル アプリで印刷 (20)

「Windows 8 ストア アプリ開発 tips」 hokuriku.net vol.11 (2013年1月26日)
「Windows 8 ストア アプリ開発 tips」  hokuriku.net vol.11 (2013年1月26日)「Windows 8 ストア アプリ開発 tips」  hokuriku.net vol.11 (2013年1月26日)
「Windows 8 ストア アプリ開発 tips」 hokuriku.net vol.11 (2013年1月26日)
 
Flashup 8
Flashup 8Flashup 8
Flashup 8
 
第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーション
第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーション第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーション
第142回Smalltalk勉強会 - PharoJSで作るWebアプリケーション
 
Azure IoT Edge で Custom Vision
Azure IoT Edge で Custom VisionAzure IoT Edge で Custom Vision
Azure IoT Edge で Custom Vision
 
リアルFacebookガジェットを作った(ロングバージョン)
リアルFacebookガジェットを作った(ロングバージョン)リアルFacebookガジェットを作った(ロングバージョン)
リアルFacebookガジェットを作った(ロングバージョン)
 
Chrome Extensionsの基本とデザインパターン
Chrome Extensionsの基本とデザインパターンChrome Extensionsの基本とデザインパターン
Chrome Extensionsの基本とデザインパターン
 
OSC2011 Androidハンズオン
OSC2011 AndroidハンズオンOSC2011 Androidハンズオン
OSC2011 Androidハンズオン
 
Android Lecture #04 @PRO&BSC Inc.
Android Lecture #04 @PRO&BSC Inc.Android Lecture #04 @PRO&BSC Inc.
Android Lecture #04 @PRO&BSC Inc.
 
データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回データマイニング+WEB勉強会資料第6回
データマイニング+WEB勉強会資料第6回
 
Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界Data apiで実現 進化するwebの世界
Data apiで実現 進化するwebの世界
 
小さな開発会社でもできた、WordPress 新ビジネスの可能性 -WordCamp Kansai 2024-
小さな開発会社でもできた、WordPress 新ビジネスの可能性  -WordCamp Kansai 2024-小さな開発会社でもできた、WordPress 新ビジネスの可能性  -WordCamp Kansai 2024-
小さな開発会社でもできた、WordPress 新ビジネスの可能性 -WordCamp Kansai 2024-
 
Titanium Mobile
Titanium MobileTitanium Mobile
Titanium Mobile
 
How to django at first
How to django at firstHow to django at first
How to django at first
 
emc++ chapter32
emc++ chapter32emc++ chapter32
emc++ chapter32
 
Extending the Unity Editor Extended
Extending the Unity Editor ExtendedExtending the Unity Editor Extended
Extending the Unity Editor Extended
 
Vue入門
Vue入門Vue入門
Vue入門
 
【ネイティブアドを支えるPhantomJS】
【ネイティブアドを支えるPhantomJS】【ネイティブアドを支えるPhantomJS】
【ネイティブアドを支えるPhantomJS】
 
初めての Data api cms どうでしょう - 大阪夏の陣
初めての Data api   cms どうでしょう - 大阪夏の陣初めての Data api   cms どうでしょう - 大阪夏の陣
初めての Data api cms どうでしょう - 大阪夏の陣
 
WordPress widget api
WordPress widget apiWordPress widget api
WordPress widget api
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs
 

Metro スタイル アプリで印刷

  • 2. セッションの目的  Metro アプリでの印刷デモを見てもらう  印刷のサンプル・プログラムを見てもらう  セッションのゴール  Metroアプリでの印刷を理解する
  • 3. 名前  石野 光仁  所属  Microsoft MVP for C# ▪ 2003/10 ~ 現在  コミュニティ ▪ アイライト主催 ▪ http://www.ailight.jp
  • 4. Metro スタイル 印刷の紹介 プリンタドライバ Metroで印刷 デモ プログラム解説 サンプル・プログラム デモ 参考:メモリ不足の話
  • 5. v3 プリンター ドライバー  Windows8以前のドライバーモデル  デスクトップ アプリ:従来通り利用可能  Metro スタイル:オプションがすべて解放さ れた状態  v4 プリンター ドライバー  Windows8用に設計されたドライバーモデル  Metro スタイルアプリをサポート ▪ 従来のデスクトップアプリでも利用可能  カスタマイズUIの表示が可能
  • 6. デバイスチャーム  アプリケーション内から印刷  ボタン等
  • 7. Windows.Graphics.Printing. PrintManager  public event TypedEventHandler<PrintManager, PrintTaskRequestedEventArgs> PrintTaskRequested;  public static PrintManager GetForCurrentView();  public static IAsyncOperation<bool> ShowPrintUIAsync();
  • 8. private void Page_Loaded(object sender, RoutedEventArgs e) { var printManager = PrintManager.GetForCurrentView(); printManager.PrintTaskRequested += printMan_PrintTaskRequested; } void printMan_PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs args) { args.Request.CreatePrintTask("VSUG Test Print", e => e.SetSource(_IPrintDocumentSource)); }
  • 9. Windows.UI.Xaml.Printing. PrintDocument  IPrintDocumentSource DocumentSource { get; }  event GetPreviewPageEventHandler GetPreviewPage;  event PaginateEventHandler Paginate;  void SetPreviewPage(int pageNumber, UIElement pageVisual);
  • 10. public sealed partial class MainPage : Page { protected PrintDocument _PrintDocument = null; protected IPrintDocumentSource _IPrintDocumentSource = null; private void Page_Loaded(object sender, RoutedEventArgs e) { _PrintDocument = new PrintDocument(); _PrintDocument.Paginate += _PrintDocument_Paginate; _PrintDocument.GetPreviewPage += _PrintDocument_GetPreviewPage; _IPrintDocumentSource = _PrintDocument.DocumentSource;
  • 11. public sealed partial class MainPage : Page { protected PrintDocument _PrintDocument = null; protected IPrintDocumentSource _IPrintDocumentSource = null; void _PrintDocument_Paginate(object sender, PaginateEventArgs e) { } void _PrintDocument_GetPreviewPage(object sender,GetPreviewPageEventArgs e) { Canvas page = new Canvas(); var image = new Image(); var bitmap = new BitmapImage(new Uri("ms-appx:///Assets/VSUG.png")); image.Source = bitmap; page.Children.Add(image); _PrintDocument.SetPreviewPage(e.PageNumber, page); }
  • 12. PrintDocument_Paginate(object sender, PaginateEventArgs e)  E.PrintTaskOptionsの値
  • 13. Windows.UI.Xaml.Printing. PrintDocument  IPrintDocumentSource DocumentSource { get; }  event AddPagesEventHandler AddPages;  event GetPreviewPageEventHandler GetPreviewPage;  event PaginateEventHandler Paginate;  void SetPreviewPage(int pageNumber, UIElement pageVisual);  void AddPage(UIElement pageVisual);  void AddPagesComplete();
  • 14. void _PrintDocument_AddPages(object sender, AddPagesEventArgs e) { Canvas page = new Canvas(); var image = new Image(); var bitmap = new BitmapImage( new Uri("ms-appx:///Assets/VSUG.png")); image.Source = bitmap; page.Children.Add(image); _PrintDocument.AddPage(page); _PrintDocument.AddPagesComplete(); }
  • 15. PrintManager PrintDocument GetForCurrentView(); DocumentSource Paginate += //印刷前の情報取得 PrintTaskRequested += GetPreviewPage += //プレ ビュー プリントの機能があることを伝え SetPreviewPage() //設定 る args.Request.CreatePrintTask AddPages += //印刷 AddPage () //ページを追加 AddPagesComplete () //完 了
  • 16. メモリ不足  メモリ使用量:90%以上 ▪ どのプロセスが持っているのか見えない ▪ 仮想メモリを使いまくって、ディスクアクセスが止 まらない  再起動しても直らない  解決方法  完全再起動:Shutdown /r
  • 17. Windows 8 の印刷の概要  http://msdn.microsoft.com/ja- jp/library/windows/hardware/hh852373  Windows 8 Release Preview Metro style app samples - C#, VB.NET, C++, JavaScript  http://code.msdn.microsoft.com/windowsapps/ Windows-8-Modern-Style-App-Samples  Print sample