<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                我之前開發一個軟件 winMarkdown,這個軟件在關閉需要提示用戶還沒有保存東西,需要保存,如果用戶選擇退出,那么把數據存放。 在Metro程序中,沒有傳統的窗口,當我們要用需要交互的消息提示時,在Win8時代,引入了一個MessageDialog來取代常用的MessageBox。 我在MainPage,掛起`App.Current.Suspending += suspend;` ~~~ private async void suspend(object sender, Windows.ApplicationModel.SuspendingEventArgs e) { SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral(); MessageDialog message_dialog = new MessageDialog("當前還在運行,確定退出", "退出"); message_dialog.Commands.Add(new UICommand("確定", cmd => { }, "退出")); message_dialog.Commands.Add(new UICommand("取消", cmd => { })); message_dialog.DefaultCommandIndex = 0; message_dialog.CancelCommandIndex = 1; IUICommand result = await message_dialog.ShowAsync(); if (result.Id as string == "退出") { } deferral.Complete(); } ~~~ `SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral();`掛起還要做,直到`deferral.Complete();` ~~~ MessageDialog message_dialog = new MessageDialog("當前還在運行,確定退出", "退出"); message_dialog.Commands.Add(new UICommand("確定", cmd => { }, "退出")); message_dialog.Commands.Add(new UICommand("取消", cmd => { })); ~~~ 兩個按鈕,一個確定,一個取消,可以UICommand ID作為點擊后,是哪個按鈕點擊 ~~~ MessageDialog.DefaultCommandIndex按ESC選擇按鈕 MessageDialog.CancelCommandIndex按enter按鈕 ~~~ ~~~ IUICommand result = await message_dialog.ShowAsync(); if (result.Id as string == "退出") { } ~~~ 程序要調試掛起,需要生命周期,點擊掛起? ![](https://box.kancloud.cn/2016-04-08_5707637499af5.jpg) 我們按enter就會點擊確定 而我們對于MessageDialog功能還是覺得不夠,ContentDialog可以定義復雜的Xaml自定義 我們把MessageDialog換ContentDialog ~~~ ContentDialog content_dialog = new ContentDialog() { Title = "退出", Content = "當前還在運行,確定退出", PrimaryButtonText = "確定", SecondaryButtonText = "取消", FullSizeDesired = true, }; content_dialog.PrimaryButtonClick += (_s, _e) => { }; await content_dialog.ShowAsync(); ~~~ ![](https://box.kancloud.cn/2016-04-08_57076374b17bb.jpg) ~~~ <UserControl x:Class="produproperty.content" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:produproperty" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <TextBlock Grid.Row="0" Text="當前還在運行,確定退出"></TextBlock> <CheckBox Grid.Row="1" Content="保存"></CheckBox> </Grid> </UserControl> ~~~ ~~~ ContentDialog content_dialog = new ContentDialog() { Title = "退出", Content = new content(), PrimaryButtonText = "確定", SecondaryButtonText = "取消", FullSizeDesired = false, }; content_dialog.PrimaryButtonClick += (_s, _e) => { }; await content_dialog.ShowAsync(); ~~~ ![](https://box.kancloud.cn/2016-04-08_57076374c7977.jpg) 參見:? [http://www.cnblogs.com/TianFang/p/4857205.html](http://www.cnblogs.com/TianFang/p/4857205.html)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看