博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年4月26日

摘要: 在VS2005中添加了BackgroundWorker组件,该组件在多线程编程方面使用起来非常方便,然而在开始时由于没有搞清楚它的使用机制,走了不少的弯路,现在把我在使用它的过程中的经验与诸位分享一下... 阅读全文

posted @ 2011-04-26 12:29 Fung Gor 阅读(249) 评论(0) 推荐(0)

2011年4月23日

摘要: 默认情况下,C#不允许在一个线程中直接操作另一个线程中的控件,这是因为访问Windows窗体控件本质上不是线程安全的。如果有两个或多个线程操作某一控件的状态,则可能会迫使该控件进入一种不一致的状态。还可能出现其他与线程相关的bug,以及不同线程争用控件引起的死锁问题。因此确保以线程安全方式访问控件非常重要。在调试器中运行应用程序时,如果创建某控件的线程之外的其他线程试图调用该控件,则调试器会引发一个InvalidOperationException异常,并提示消息:“从不是创建控件的线程访问它”。但是在Windows应用程序中,为了在窗体上显示线程中处理的信息,我们可能需要经常在一个线程中引用 阅读全文

posted @ 2011-04-23 19:57 Fung Gor 阅读(1214) 评论(0) 推荐(0)

2011年4月22日

摘要: Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of e-mail to support: Text in character sets other than ASCII Non-text attachments Message bodies with mult... 阅读全文

posted @ 2011-04-22 17:26 Fung Gor 阅读(436) 评论(0) 推荐(0)

摘要: 简介: Lucene 是一个基于 Java 的全文检索工具包,你可以利用它来为你的应用程序加入索引和检索功能。Lucene 目前是著名的 Apache Jakarta 家族中的一个开源项目,下面我们即... 阅读全文

posted @ 2011-04-22 16:24 Fung Gor 阅读(189) 评论(0) 推荐(0)

摘要: using System;using System.ComponentModel;using System.Drawing;using System.Threading;using System.Windows.Forms;namespace BackgroundWorkerExample{ public class Form1 : Form { public Form1() { InitializeComponent(); } private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { // Do not 阅读全文

posted @ 2011-04-22 11:56 Fung Gor 阅读(235) 评论(0) 推荐(0)

摘要: using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Threading;using System.Windows.Forms;using System.Xml;public class Form1 : Form{ private BackgroundWorker backgroundWorker1; private Button downloadButton; private ProgressBar progressBar1; pr 阅读全文

posted @ 2011-04-22 11:53 Fung Gor 阅读(251) 评论(0) 推荐(0)

摘要: using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Threading;using System.Windows.Forms;namespace BackgroundWorkerExample{ public class FibonacciForm : System.Windows.Forms.Form { private int numberToCompute = 0; private int highestPercentageReached = 阅读全文

posted @ 2011-04-22 11:50 Fung Gor 阅读(229) 评论(1) 推荐(0)

摘要: Visual Studio 2010 Other Versions The C# language's exception handling features help you deal with ... 阅读全文

posted @ 2011-04-22 11:40 Fung Gor 阅读(210) 评论(0) 推荐(0)

摘要: IntroductionOne of the things that impressed me when I first started learning .NET was its enhanced exception-handling functionality. By this I mean such features as easy access to the type of exception thrown, full stack trace and inner exceptions. This makes it easy to still get full information i 阅读全文

posted @ 2011-04-22 11:33 Fung Gor 阅读(214) 评论(0) 推荐(0)

摘要: ContentsIntroductionPlan for the worst Check it earlyDon't trust external dataThe only reliable devices are: the video, the mouse and keyboard.Writes can fail, tooCode Safely Don't throw new Exception()Don't put important exception information on the Message fieldPut a single catch (Exce 阅读全文

posted @ 2011-04-22 11:31 Fung Gor 阅读(207) 评论(0) 推荐(0)