• <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

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

                 使用App settings 可以使用戶定制化自己的應(yīng)用。App Settings的高度要同設(shè)備的高度一致,寬度可以有346和646像素兩個(gè)值,可以在代碼中進(jìn)行設(shè)置。另外App Settings 中的設(shè)置要立即反映到應(yīng)用中去。

                 具體的設(shè)計(jì)手冊(cè)可以參考:http://msdn.microsoft.com/en-us/library/windows/apps/hh770544.aspx
                  還是中文版看起來舒服:http://msdn.microsoft.com/zh-cn/library/windows/apps/hh770544.aspx

            如果大家讀了App Settings的快速幫助的話,那么就會(huì)對(duì)App Settings有一定的理解了:
            首先,我們的Settings Pane上面需要一些入口點(diǎn),當(dāng)點(diǎn)擊這些入口點(diǎn)的時(shí)候,我們需要顯示一個(gè)Flyout,這個(gè)Flyout包含了一些設(shè)置選項(xiàng)。
            簡(jiǎn)單介紹一下流程:
            1. 監(jiān)聽Settings Pane的CommsndsRequested事件。
            2. 在關(guān)聯(lián)的回調(diào)中指定命令,對(duì)于每條命令:
                   1). 提供SettingsCommand.Id和SettingsCommand.Label
                   2). 設(shè)置用戶選擇命令時(shí)觸發(fā)的處理程序(SettingsCommands.Invoked)
                   3). 將SettngsCommand對(duì)象添加到ApplicationCommands Vector中去。


            以上的功能可以由SettingsPane類和SettingsCommand類來完成。

             1 ref new class SettingsPane sealed : Platform::Object
             2 {
             3 public:
             4     //獲得當(dāng)前的SettingsPane對(duì)象,該對(duì)象同App view相關(guān)聯(lián)。
             5     static Windows::UI::ApplicationSettings::SettingsPane^ GetForCurrentView();
             6     //顯示該SettingsPane
             7     static un-knownType Show();
             8     //SettingsPane 顯示在屏幕的左邊還是右邊
             9     static property SettingsEdgeLocation Edge { get; }
            10     //用戶打開Settings Pane時(shí)被觸發(fā),在它的回調(diào)方法中添加入口點(diǎn)
            11     event TypedEventHandler<SettingsPane^,SettingsPaneCommandsRequestedEventArgs^>^ CommandsRequested;
            12 }
            SettingsCommand類的構(gòu)造函數(shù):

            SettingsCommand([Windows::Foundation::Metadata::VariantAttribute] Platform::Object^ settingsCommandId, Platform::String^ label, Windows::UI::Popups::UICommandInvokedHandler^ handler)

            總的步驟如下:
            using namespace Windows::UI::ApplicationSettings;
            using namespace Windows::UI::Popup;

             1 void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
             2 {
             3     (void) e;    // Unused parameter
             4     setSettingsPane();
             5 }
             6 
             7 void MainPage::setSettingsPane()
             8 {
             9     commandsRequestedEventRegistrationToken = SettingsPane::GetForCurrentView()->CommandsRequested +=
            10         ref new TypedEventHandler<SettingsPane^, SettingsPaneCommandsRequestedEventArgs^>(this, &MainPage::onCommandRequested);
            11 }
            12 
            13 void MainPage::onCommandRequested(SettingsPane^ settingsPane, SettingsPaneCommandsRequestedEventArgs^ e)
            14 {
            15     UICommandInvokedHandler^ handler = ref new UICommandInvokedHandler(this, &MainPage::onSettingsCommand);
            16     SettingsCommand^ generalCommand = ref new SettingsCommand("generalSettings","General",handler);
            17     e->Request->ApplicationCommands->Append(generalCommand);
            18     SettingsCommand^ helpCommand = ref new SettingsCommand("helpPage","Help", handler);
            19     e->Request->ApplicationCommands->Append(helpCommand);
            20 }
            21 
            22 void MainPage::onSettingsCommand(
            23     Windows::UI::Popups::IUICommand^ command)
            24 {
            25     SettingsCommand^ settingsCommand = safe_cast<SettingsCommand^>(command);
            26     output->Text = settingsCommand->Label + "on SettingsPane clicked!";
            27     output->Text += SettingsPane::Edge.ToString();
            28     //不需要顯式地刪除token,再次點(diǎn)擊按鈕的時(shí)候,如果SettingsPane在顯式,會(huì)自動(dòng)關(guān)閉掉,如果刪除了token,
            29     //那么SettingPane上不再有Entry Point
            30     //SettingsPane::GetForCurrentView()->CommandsRequested-= commandsRequestedEventRegistrationToken;
            31 }
            32 
            33 void OnlyAppSettings::MainPage::Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
            34 {
            35     SettingsPane::Show();
            36 }
            37 
            Note:
            如果下面有一條成立,那么Show()將會(huì)報(bào)異常,或者關(guān)閉
            It is called from snapped app,
            It is called when the current app does not have focus
            It is called when the pane is already displayed.



            需要注意的是,Settings的Header在做動(dòng)畫的時(shí)候需要有100的offset,內(nèi)容200的offset:
                        <!-- Header area for panel -->
                        <Grid Background="#FF7700FF" Grid.Row="0">

                            <Grid Margin="20,19,17,13">

                                <Grid.Transitions>
                                    <TransitionCollection>
                                        <EntranceThemeTransition FromHorizontalOffset="100" />
                                    </TransitionCollection>
                                </Grid.Transitions>

                            </Grid>

                        </Grid>


            1 <!-- Settings Panel Content -->
            2             <Grid Grid.Row="1" Margin="20,24,23,0" VerticalAlignment="Top" Background="Transparent">
            3                 <Grid.Transitions>
            4                     <TransitionCollection>
            5                         <EntranceThemeTransition FromHorizontalOffset="500" /> //這里只要跟上面不一樣,有點(diǎn)效果就可以了
            6                     </TransitionCollection>
            7                 </Grid.Transitions>
            8                 <ContentControl x:Name="_settingscontent" Background="Transparent"/>
            9             </Grid>


            一首比較好聽的歌 yellow submarine Various artists <kids will rock you>2004

            下章研究一下國際化的問題。


            posted on 2013-01-09 13:51 Dino-Tech 閱讀(1206) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Windows 8
            麻豆精品久久精品色综合| 久久国产精品国产自线拍免费| 国产视频久久| 亚洲伊人久久综合影院| 国产成人精品免费久久久久| 欧美日韩中文字幕久久久不卡| 精品少妇人妻av无码久久| 99国内精品久久久久久久| 久久亚洲精品中文字幕| 久久亚洲色一区二区三区| 好属妞这里只有精品久久| 久久中文字幕视频、最近更新| 婷婷伊人久久大香线蕉AV| 久久久亚洲欧洲日产国码是AV| 欧美亚洲国产精品久久蜜芽| 伊人久久大香线蕉成人| 欧美激情精品久久久久久久| 久久精品国产久精国产思思| a高清免费毛片久久| 久久香蕉综合色一综合色88| 国产成人精品三上悠亚久久| 一本一本久久aa综合精品| 久久国产免费| 青青青青久久精品国产h久久精品五福影院1421 | 99久久精品久久久久久清纯| 精品国产乱码久久久久软件| 久久久99精品一区二区| 99久久国产综合精品成人影院| 久久精品国产亚洲AV高清热| 国产精品久久新婚兰兰| 欧美黑人激情性久久| 久久综合久久鬼色| 久久久久97国产精华液好用吗| 国产99久久久久久免费看| 蜜桃麻豆www久久| 91精品国产综合久久香蕉| 一本久久久久久久| 久久精品国产国产精品四凭| 久久精品无码av| 亚洲午夜福利精品久久| 99精品久久久久久久婷婷|