繁体   English   中英

在项目之间共享对象和信息

[英]Share Objects and Information between projects

我正在制作Windows Phone应用程序,并将我的解决方案分为4个项目。

  • 网络服务
  • MainProject
  • SecondaryProject
  • PortableLibrary

我使用可移植库在所有项目之间共享模型。 但是如何共享信息,我知道我可以使用Uri Scheme共享变量和其他元素:

NavigationService.Navigate(new Uri("/Project;component/URI.xaml", UriKind.Relative));

但是,如果我想解析复杂对象怎么办?

一个带有伪代码和程序流的示例:

**STARTUP->MainProject**
UILoad();                     //Login UI shown
MobileService.Authenticate(); //Authentication stored in Isolated storage through CreditVault.
NavigateTo->MainMenu();       //

**MainMenu->SecondaryProject**
NavigationService.Navigate(new Uri("/SecondaryProject;component/URI.xaml", UriKind.Relative)); 
MobileService.AccessRestrictedInformation(); //How to still be authenticated here?
SavePictureAndInformation();  //How to make Information available to all projects in the solution?

我在startupPage上具有的身份验证使我能够自动重新身份验证用户,这就是为什么将其加密存储的原因。

问题

另一个项目可以访问第一个项目的IsolatedStorage吗?

如果我在启动时对用户进行身份验证,是否还将对在解决方案中另一个项目中创建的移动服务进行身份验证?

我想念一些聪明的东西吗?

外部信息

我需要使用页面设置多个项目,并且无法将它们插入同一项目中。 因此,将其包含在同一项目中不是解决方案。

您可以使用IsolatedStorage在项目之间共享信息,也可以通过以下链接使用application.current.resources http://mikaelkoskinen.net/windows-phone-pass-data-between-pages-application-resources/

希望有人觉得有用:)

暂无
暂无

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

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