[英]Windows Phone Programming Visual Studio
I am programming some applications for the Windows Phone and am looking for some standard debugging practices that I cannot figure out how to do in a Windows Phone project in Visual Studio. 我正在为Windows Phone编写一些应用程序,并且正在寻找一些我无法弄清楚在Visual Studio的Windows Phone项目中如何做的标准调试实践。
MessageBox.show()
(it seems that I cannot import System.Windows.Forms) MessageBox.show()
(似乎无法导入System.Windows.Forms) All help is appreciated! 感谢所有帮助!
you can use Debbugger.Log which will output to debug window 您可以使用Debbugger.Log它将输出到调试窗口
http://msdn.microsoft.com/en-in/library/system.diagnostics.debugger.log(v=vs.95).aspx http://msdn.microsoft.com/zh-CN/library/system.diagnostics.debugger.log(v=vs.95).aspx
Indeed, you cannot import System.Windows.Forms from a Windows Phone project. 的确,您不能从Windows Phone项目中导入System.Windows.Forms。 In the case of WP7 you will program using a subset of Silverlight.
对于WP7,您将使用Silverlight的子集进行编程。 With that in mind, there is a Message Box control in Silverlight for WP7 using the System.Windows namespace: http://msdn.microsoft.com/en-us/library/system.windows.messagebox(VS.95).aspx
考虑到这一点,在Silverlight中,使用System.Windows命名空间的WP7中有一个消息框控件: http : //msdn.microsoft.com/zh-cn/library/system.windows.messagebox(VS.95).aspx
I suggest that you approach your debugging needs by leveraging unit tests instead of printing to the Message Box. 我建议您通过利用单元测试而不是打印到消息框来满足调试需求。
For advanced tracing and logging you may want to take a look on 对于高级跟踪和日志记录,您可能需要看一下
Silverlight and WP7 Exception Handling and Logging building block Silverlight和WP7异常处理和日志构建基块
Debug.WriteLine(Something);
Debug.WriteLine(Something);
just like Console.WriteLine(Something);
Console.WriteLine(Something);
. Something
will automatically be converted to string. Something
将自动转换为字符串。 This is as simple as it can get. MessageBox
control. MessageBox
控件。 It's present in System.Windows
namespace. System.Windows
命名空间中。 You can also use some third party toolkit like Coding4Fun if you need customized messagebox.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.