缺少.NET功能在Metro风格的应用程序?应用程序、风格、功能、NET

2023-09-03 10:46:33 作者:证明给你看

大多是出于好奇,我开始编程在Visual Studio 2011的一个小的Metro风格工程,即是在Windows开发preVIEW发布的之一。它结合XAML的设计和(在我的项目)C#为code-落后。

Mostly out of curiosity, I started programming a small "Metro Style" project in Visual Studio 2011, the one that was released in Windows Developer Preview. It combines XAML for the design and C# (in my project) for the code-behind.

C#的经验几乎等于你在Visual Studio 2008中使用.NET框架4.0之一,保存这些特点,我是不是能够找到:

The C# experience is mostly identical to the one you get on Visual Studio 2008 with .NET framework 4.0, save for these features that I wasn't able to find :

System.Console ,这使调试有点难度, 和 System.Threading.Thread.Sleep(时间跨度),这是比较不方便的,因为这一点正是我现在需要的。 System.Console, which make debugging a bit more difficult, And System.Threading.Thread.Sleep(TimeSpan), which is a bit more inconvenient since that's exactly what I needed right now.

那么,这些功能实际上是缺少/禁用,还是我只是看在错误的地方?先谢谢了。

So are these features actually missing / disabled, or did I just look in the wrong place ? Thanks in advance.

推荐答案

我没有安装preVIEW,所以我无法检查。但是,这里有两个想法:

I don't have the Preview installed, so I can't check. But here are two thoughts:

System.Console可能不可用,因为在Metro风格的应用程序没有控制台。检查Debug.WriteLine是可用的。它直接写入到Visual Studio中的调试窗口。

System.Console is probably not available, because there is no Console in Metro style applications. Check if Debug.WriteLine is available. It writes directly to the Debug window in Visual Studio.

Metro风格的应用程序不应该阻塞线程延长持续时间。一切,需要超过几毫秒的时间应该以异步的方式来完成。看 对于某种方式在一段时间之后,执行异步回调,例如,一个定时器。或者,你也许能等待的时间跨度(如TaskEx.Delay在异步CTP)。结束

Metro style applications are not supposed to block threads for extended durations. Everything that takes more than a few milliseconds should be done in an asynchronous way. Look for some way to execute an asynchronous callback after some time, e.g., a timer. Or you might be able to await the end of a time span (like TaskEx.Delay in the Async CTP).