简体   繁体   English

从非UI类Windows Phone 8访问应用栏

[英]Accessing applicataion bar from non UI class windows phone 8

In my windows phone app I've a non-UI class which will show and hide a pop up screen when called from the UI page. 在我的Windows Phone应用中,我有一个非UI类,当从UI页面调用时,该类将显示和隐藏弹出屏幕。

I want to hide the application bar when the pop up is shown and show the appbar again when the pop up is closed. 我想在显示弹出窗口时隐藏应用程序栏,并在关闭弹出窗口时再次显示应用程序栏。

Now the challenge here is I've a timer in the non UI class which handles the closing of the pop up. 现在的挑战是,我在非UI类中有一个计时器来处理弹出窗口的关闭。 So from the UI class I can only start the pop up. 因此,从UI类中,我只能启动弹出窗口。 Closing is controlled by the non UI class. 关闭由非UI类控制。 So now I need to access the appbar from the non UI class. 因此,现在我需要从非UI类访问应用栏。

Can any one help me if I can do it or any work around if this cannot be done. 如果可以的话,任何人都可以帮助我,如果无法完成,可以解决任何问题。 ?

Thank you. 谢谢。

Maybe making use of Popup.Closed Event would help: 也许利用Popup.Closed事件将有助于:

private void myPopup_Close(object sender, System.EventArgs e)
{
   // get current Page
   var currentPage = ((App.Current as App).RootVisual as PhoneApplicationFrame).Content as PhoneApplicationPage;
    // hide popup
    currentPage.ApplicationBar.IsVisible = true;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM