Windows 8 學習筆記(十五)–.Windows 8 RP Metro 墓碑機制思考

來源:互聯網
上載者:User
 剛才做Win8 Metro app時突然想到前段時間一直很糾結的程式生命週期問題,不知在哪邊實現墓碑機制。想到現在在RP版本可能會有改進,經過一番測試,

結論如下:RP版本自動實現了墓碑機制,在關閉程式(視窗拉下或ALT+F4)後10~15秒左右,會執行OnSuspend事件。

測試程式如下:page1中通過點擊按鈕跳轉到Page2:

Window.Current.Content = new TomestonPage(); 
Window.Current.Activate(); 

 

Page2中顯示預設的TextBlock,點擊按鈕修改TextBlock值 <Button Content="Button" HorizontalAlignment="Left" Margin="465,109,0,0" VerticalAlignment="Top" Click="Button_Click_1"/>         

<TextBlock HorizontalAlignment="Left" Height="59" Margin="207,109,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="178" x:Name="tbContent"/>

private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            tbContent.Text = "1234324";
        }

 

一切執行完畢,開啟另一個Metro程式,這時前一個APP應是處於掛起狀態,程式一直沒有進入OnSuspend事件,且過段時間再次進行前一程式,頁面還是保持原狀。經過以上次,我方才得到以上結論,不知結論是否正確,如果是這樣,我們就省事兒多啦~~

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.