Windows Phone 7的,登录屏幕重定向和.exit案件? [英] Windows Phone 7, login screen redirect and a case for .exit?

查看:72
本文介绍了Windows Phone 7的,登录屏幕重定向和.exit案件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这已经讨论过广告nauseum,但我想现在我的情况....

I know this has been discussed ad nauseum, but I want to present my case....


  1. 我的发车在我的应用程序页面login.xaml。用户登录,用户名和密码都是通过我的WCF服务认证,用户名被保存在独立存储,然后将用户重定向到MainPage.xaml中。

  1. My start page in my app is login.xaml. The user logs in, the username and password are authenticated through my WCF service, the username is saved in isolated storage, and then the user is redirected to mainpage.xaml.

当用户启动我的应用程序,而且他们已经在独立存储已保存的用户名,他们将被重定向到MainPage.xaml中

When a user starts my app, and they already have a saved username in isolated storage, they are redirected to mainpage.xaml

如果用户点击回从MainPage.xaml中硬键,这重定向到登录界面,这反过来又重定向他们回到MainPage.xaml中,因为他们已经有一个保存的本地用户名。这导致我的应用程序失败,目前的认证,因为用户无法点击后退按钮退出从MainPage.xaml中的应用程序。

If the user hits "back" hard button from mainpage.xaml, this redirects to the login screen, which in turn redirects them back to the mainpage.xaml since they already have a saved local username. This is causing my app to fail certification currently since the user cannot hit the "back" button to exit the app from mainpage.xaml.

在这里,我的直觉是覆盖在BackKeyPress和MainPage.xaml中莫名其妙地退出该应用程序。通过阅读其他职位,我可以看到,这个方法不可用。我的第二个想法是某种方式存储在app.xaml.cs页面会告诉应用程序退出时,在登录页面加载和属性设置为true的财产,但似乎有点哈克以及....

My instinct here is to override the BackKeyPress in mainpage.xaml and exit the app somehow. By reading the other posts, I can see that this method is not available. My second idea was to somehow store a property in the app.xaml.cs page that would tell the app to exit when the login page is loaded and that property is set to true, but that seems a bit hacky as well....

在这里的任何想法?使用。

Any ideas here?

Update解决方案:

UPDATE SOLUTION USED:

什么结束了工作是使登录页面内炫魅枢轴项。 XAML。当用户打开应用程序没有被登录,当前选择的支点项目将切换到登录枢纽项目。如果用户打开应用程序,并已登录的,正常的支点项目将被选中。

What ended up working was to make the login page a pivot item inside mainpage.xaml. When a user opened the app without being logged in, the currently selected pivot item would change to the login pivot item. If the user opened the app and WAS logged in, the normal pivot item would be selected.

推荐答案

我在一个StackPanel中的登录页面和主页面有两个网格组合成一个页面和操作的可视性做到这一点网格以匿名和认证用户所需要的用户界面之间进行切换。这使问题消失,无需骗取历史或拨弄标志。

I do this by combining the login page and the main page into one page with two grids in a stackpanel and manipulating the visibility of the grids to switch between the UI required for anonymous and authenticated users. This makes the problem go away with no need to diddle the history or fiddle with flags.

通过一个合适的转换器和可见性的适当绑定我大概可以跑整场演出没有明确的代码,但是这将是聪明和智能之间的差异的一个很好的例子 - 它工作得非常好,迟早我会的忘记的工作原理(好吧我承认,我这样做,并忘记它如何工作)。

With a suitable converter and appropriate bindings of Visibility properties I could probably run the whole show without explicit code, but that would be a good example of the difference between clever and smart - it works so well that sooner or later I'd forget how it works (ok I confess, I did this and forgot how it worked).

这篇关于Windows Phone 7的,登录屏幕重定向和.exit案件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆