• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 55  文章 - 15  trackbacks - 0
            <2013年1月>
            303112345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜


            31 Days of Windows 8 -- Live Tiles:http://www.jeffblankenburg.com/2012/11/09/31-days-of-windows-8-day-9-live-tiles/
            MSDN--創(chuàng)建瓷貼和鎖屏 : http://msdn.microsoft.com/library/windows/apps/Hh465377

            創(chuàng)建瓷貼的步驟:

             1. 命名空間:
             
            using namespace Windows::UI::Notifications;
            using namespace Windows::Data::Xml::Dom;

            2. 選取模板   http://msdn.microsoft.com/zh-CN/library/windows/apps/xaml/windows.ui.notifications.tiletemplatetype
            3. 設(shè)置模板中的屬性,最好將WideTile和SquareTile合并在一起,這樣不論你的Tile是哪種形態(tài)都有動態(tài)效果。
            4. 更新Tile

            下面是一個完整步驟: 
             1using namespace Windows::UI::Notifications; // Notification命名空間
             2using namespace Windows::Data::Xml::Dom; // DOM標準函數(shù)命名空間
             3namespace WFC = Windows::Foundation::Collections;
             4
             5XmlDocument^ tileXml = TileUpdateManager::GetTemplateContent(TileTemplateType::TileWideImageAndText01);//獲得模板
             6
             7XmlNodeList^ tileTextAttributes = tileXml->GetElementsByTagName("text");
             8tileTextAttributes->Item(0)->InnerText = "Hello World! My very own tile notification";//設(shè)置text屬性
             9
            10XmlNodeList^ tileImageAttributes = tileXml->GetElementsByTagName("image");
            11static_cast<XmlElement^>(tileImageAttributes->Item(0))->SetAttribute("src""ms-appx:///images/redWide.png");  //此處如果要使用Assets中的圖片的話,直接用SetAttribute("src","Tile.png");                      
            12static_cast<XmlElement^>(tileImageAttributes->Item(0))->SetAttribute("alt""red graphic");// 設(shè)置image屬性
            13
            14XmlDocument^ squareTileXml = TileUpdateManager::GetTemplateContent(TileTemplateType::TileSquareText04); //獲得方形模板
            15XmlNodeList^ squareTileTextAttributes = squareTileXml->GetElementsByTagName("text");
            16squareTileTextAttributes->Item(0)->AppendChild(squareTileXml->CreateTextNode("Hello World! My very own tile notification"));//設(shè)置text屬性
            17IXmlNode^ node = tileXml->ImportNode(squareTileXml->GetElementsByTagName("binding")->GetAt(0), true);
            18tileXml->GetElementsByTagName("visual")->Item(0)->AppendChild(node);//將方形模板插入Wide模板
            19
            20TileNotification^ tileNotification = ref new TileNotification(tileXml);
            21
            22int seconds = 10;
            23auto cal = ref new Windows::Globalization::Calendar();
            24cal->AddSeconds(seconds);    
            25tileNotification->ExpirationTime = cal->GetDateTime();//設(shè)置消失時間
            26
            27TileUpdateManager::CreateTileUpdaterForApplication()->Update(tileNotification); //顯示Tile
            28
            29

            也可以使用XML文件設(shè)置屬性:
             1    // create a string with the tile template xml
             2    auto tileXmlString = "<tile>"
             3        + "<visual>"
             4        + "<binding template='TileWideText03'>"
             5        + "<text id='1'>Hello World! My very own tile notification</text>"
             6        + "</binding>"
             7        + "<binding template='TileSquareText04'>"
             8        + "<text id='1'>Hello World! My very own tile notification</text>"
             9        + "</binding>"
            10        + "</visual>"
            11        + "</tile>";
            12
            13    // create a DOM
            14    auto tileDOM = ref new Windows::Data::Xml::Dom::XmlDocument();
            15
            16    // load the xml string into the DOM, catching any invalid xml characters 
            17    tileDOM->LoadXml(tileXmlString);
            18
            19    // create a tile notification
            20    auto tile = ref new TileNotification(tileDOM);
            21
            22    // Send the notification to the app's application tile
            23    TileUpdateManager::CreateTileUpdaterForApplication()->Update(tile);
            24
            25    OutputTextBlock->Text = tileDOM->GetXml();

            清理瓷貼
                TileUpdateManager::CreateTileUpdaterForApplication()->Clear();

            使用瓷貼隊列
                一個應(yīng)用程序中最多能使用5個瓷貼,如果開啟了瓷貼隊列,會按照先后順序放入隊列中。之后TileNotification的顯示時間和顯示順序?qū)⒉皇艹绦蚩刂疲@時的控制權(quán)是在系統(tǒng)手中的。
                為了便于控制瓷貼的顯示,我們一般給瓷貼一個Tag用于辨識,當新的瓷貼的Tag與舊瓷貼的Tag相同時,舊瓷貼被新瓷貼代替。如果不同,隊列頭上的瓷貼被踢出隊列。
                最近的瓷貼總是被立即顯示。另外,當隊列中已經(jīng)有了5個瓷貼的時候,其中一個使用了Expirate,那么當這個瓷貼消失之后,將不再在隊列中,也不會再顯示它了。
                使用瓷貼隊列的方法是:
                 TileUpdateManager::CreateTileUpdaterForApplication()->EnableNotificationQueue(true);
                禁止瓷貼隊列的方法:
                 TileUpdateManager::CreateTileUpdaterForApplication()->EnableNotificationQueue(false);

            瓷貼的圖片問題
                  用于Tile的圖片不能大于200K,像素不能大于1024*1024,但是我們的Tile最大是310*150,所以我們在使用圖片的時候要考慮到大小問題。
            posted on 2013-01-03 14:31 Dino-Tech 閱讀(1456) 評論(1)  編輯 收藏 引用 所屬分類: Windows 8

            FeedBack:
            # re: Dino Windows 8 學(xué)習(xí)筆記(十二) - 動態(tài)瓷貼 2013-01-04 00:46 custom research papers
            Very ncie good spot s oncie great!  回復(fù)  更多評論
              
            狠狠久久综合| 久久99国产精品二区不卡| 久久免费香蕉视频| 久久AV高潮AV无码AV| 久久er99热精品一区二区| 中文字幕亚洲综合久久2| 国产精品免费久久| 久久人人爽人人爽人人AV东京热| 国产成年无码久久久久毛片| 久久一本综合| 99久久精品久久久久久清纯| 99久久综合国产精品免费| 久久婷婷国产麻豆91天堂| 国产精品中文久久久久久久| 久久精品国产亚洲麻豆| 18禁黄久久久AAA片| 大香网伊人久久综合网2020| 色偷偷88888欧美精品久久久| 深夜久久AAAAA级毛片免费看 | 久久国产精品99精品国产| 蜜桃麻豆www久久国产精品| 九九久久99综合一区二区| 久久久久久曰本AV免费免费| 久久精品无码av| 久久精品国产99久久久香蕉| 韩国无遮挡三级久久| 久久精品国产亚洲AV香蕉| 天天影视色香欲综合久久| 午夜不卡888久久| 欧美久久精品一级c片片| 2021久久精品国产99国产精品| 久久人人爽人人爽人人片AV不 | 色综合久久久久综合体桃花网| 久久97精品久久久久久久不卡| 99久久er这里只有精品18| 99久久国产精品免费一区二区| 精品久久久久成人码免费动漫 | 91精品国产综合久久精品| 久久久久久国产精品免费无码| 久久精品国产亚洲av麻豆色欲| 久久国产精品一国产精品金尊 |