简体   繁体   中英

WP8.1 and interceptors

I'm developing a Windows Phone 8.1 app and I have to check some informations before executing some methods (I have to check if the internet connection is available and if the localization is active). There are interceptors or another way to programmatically execute a method before some actions in wp8.1?

The .NET platform has something called Code Contracts. Basically, starting from .NET 4.0, you can use Contract.Requires(Boolean) to verify if a precondition is active. You can even show a special message to the user when it's not active.

For more info, there's http://msdn.microsoft.com/en-us/library/dd264808(v=vs.110).aspx on MSDN, and of course Google.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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