正文内容加载中...
posted @ 2013-07-11 14:22 DebugLZQ 阅读(5639) 评论(5) 编辑
摘要: 在.NET中,我们使用try-catch-finally来处理异常。但,当一个Exception抛出,抛出Exception的代码又没有被try包围时,程序就崩溃了。这些异常往往是你没有注意到的。在WPF中,提供了一种处理这些个异常的方式。举例来说明。1.先抛出个异常,不用try包围它。在MainW...阅读全文
posted @ 2013-07-08 09:01 DebugLZQ 阅读(7314) 评论(8) 编辑
摘要: 有时我们不希望我们的WPF应用程序可以同时运行有多个实例,当我们试图运行第二个实例的时候,已经运行的实例也应该弹出来。我们可以用Mutex来实现打开App.xaml.cs,在App类中添加如下内容 public partial class App : Application { [DllImport("user32", CharSet = CharSet.Unicode)] static extern IntPtr FindWindow(string cls, string win); [DllImport("user32")] ...阅读全文
posted @ 2013-07-04 22:09 DebugLZQ 阅读(1987) 评论(6) 编辑
摘要: I believe the biggest distinction is that a stub you have already written with predetermined behavior. So you would have a class that implements the dependency (abstract class or interface most likely) you are faking for testing purposes and the methods would just be stubbed out with set responses. 阅读全文
posted @ 2013-07-03 21:48 DebugLZQ 阅读(303) 评论(2) 编辑
摘要: “Logical resources may be of various types, such as brushes, geometries, styles, and templates.Placing all those resources in a single file such as App.xaml hinders maintainability. A betterapproach would be to separate resources of different types (or based on some other criteria) totheir own files阅读全文
posted @ 2013-07-02 22:03 DebugLZQ 阅读(7505) 评论(8) 编辑
摘要: “Sometimes binary resources are defined in one assembly (typically a class library), but areneeded in another assembly (another class library or an executable). WPF provides a uniformand consistent way of accessing these resources using the pack URI scheme.”假如我们定义一个WPF User Control Library,并在其中添加一张图阅读全文
posted @ 2013-07-02 13:15 DebugLZQ 阅读(1338) 评论(0) 编辑
摘要: WPF中的Binary Resource(二进制资源)是相对于前面所说的Logical resource(逻辑资源)而说的,一般指Image、XML文件等。注意:这里说的是Resource"资源",和Content"内容"是不同的。1.Content VS Resource一般我们向工程中添加一个二进制的资源,如图片。我们设置它的属性,设置成资源和内容是不同的!简单的说下两者的区别:“When the Build Action is set to Content (as in the jellyfish example), the resource is阅读全文
posted @ 2013-07-02 07:30 DebugLZQ 阅读(907) 评论(2) 编辑
摘要: 这篇博文分享下保龄球计分算法。计分规则描述如下:A game of tenpins bowling lasts ten frames, in each of which the bowler makes one or two attempts to knock down ten pins arran...阅读全文
posted @ 2013-07-01 20:24 DebugLZQ 阅读(918) 评论(1) 编辑
摘要: “Sometimes it's useful to use one of the selected colors or fonts the user has chosen in theWindows Control Panel Personalization applet (or the older Display Settings in Windows XP),such as Window caption, Desktop color, and Selection color. Furthermore, an applicationmay want to react dynamica阅读全文
posted @ 2013-06-29 23:12 DebugLZQ 阅读(1576) 评论(0) 编辑
摘要: I haven't seen much information online comparing the similarities and differences between the Nunit and MSTest Frameworks. Here I will define the similarities and some of the differences. MSTest AttributeNUnit AttributePurpose[TestMethod][Test]Indentifies of an individual unit test[TestClass][Te阅读全文
posted @ 2013-06-29 01:41 DebugLZQ 阅读(349) 评论(1) 编辑