上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: 本文用一个动态变化的clock,模拟时钟的数据变化,即每一次事件触发,都会发送给subscriber不同的值。namespace EventKeyWord{ /// <summary> /// Summary description for Class1. /// </summary> class Test { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static... 阅读全文
posted @ 2013-03-04 18:02 Shanghai Jim Zhou 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 一般.NET中的事件申明格式都是:public delegate void PlayGameHandler(object sender, CustomEventArgs e); sender表示事件发起者,e表示事件需要传输入的一些参数.本文主要讲述一个事件:Zhang在上班中玩游戏(事件),Wang知道了,然后扣张的钱,最后张的钱被扣了.主要代码逻辑如下:namespace DelegateEventDemo{ class Class1 { static void Main(string[] args) { Console.Wri... 阅读全文
posted @ 2013-03-04 17:47 Shanghai Jim Zhou 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 本文用Mouse,Cat,Host的例子,讲解设计模式中非常著名的观察者模式:Cat叫的时候, Mouse开始Escape, Host惊醒。这是观察者和动作发起者: public delegate void ShoutDelegate(string str); public class Cat { public event ShoutDelegate ShoutEvent; public void OnShout(string str) { if (ShoutEvent!=null) { ... 阅读全文
posted @ 2013-03-04 17:34 Shanghai Jim Zhou 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 开篇:.NET中的Delegate和Event是使用最为频繁的关键字之一,在程序设计中,非常方便的可以实现特定的功能,基于学习的目的,本系列特地总结几篇博文,说明Delegate和Event的异同。1 观察者模式(Mouse, Cat, Host)2 上班玩游戏--事件模式3 Clock 动态模式4 用方法限制事件只能被单个订阅者订阅5 用事件访问器限制只能被单个订阅者订阅下面是Delegate和Event的一些异同:1) 事件可以定义在Struct, Class, Interface里, delegate可以放在类里面进行申明(不能放在Interface里面)也可以放在整个命名空间中进行申明 阅读全文
posted @ 2013-03-04 17:07 Shanghai Jim Zhou 阅读(277) 评论(0) 推荐(0) 编辑
摘要: This post is just used to review the link related knowledges. There are two methods we can use to reverse a linked nodes, one is recursive, another is non-recursive. Both are contained in this post, since the code is quite simple, I am not going to illustrate this in details, you can just practice i 阅读全文
posted @ 2013-02-24 21:13 Shanghai Jim Zhou 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 在开始了解上下文之前,先来复习下.NET的应用程序的逻辑结构。通常情况下,一个进程只能运行一个应用程序。但在.NET环境下,一个进程可以运行多个应用程序,而这里的应用程序则以应用程序域划分,同一个应用程序或者程序集可以加载到同一进程的不同应用程序域中去。上图中没有标识出的是线程,线程和应用程序域并不是简单的一对一,或者一对多的关系。在一个应用程序域中可以有几个线程存在,而一个线程也可以跨多个应用程序域访问资源(但一定时间内,每个线程是在应用程序域中执行的)。这里讨论的重点不在线程和应用程序域的关系,因此可以简单的认为两者平级,示例图也不用标出来了。因此应用程序域示意图如下:与上下文相关的类有两 阅读全文
posted @ 2013-02-05 22:39 Shanghai Jim Zhou 阅读(3315) 评论(0) 推荐(0) 编辑
摘要: Sometimes, you do not want the main WinForm form to show, so you can try the following five steps: static class Fom1:Form { public Form1() { // 1 (The best way) this.ShowInTaskbar = false; this.WindowState = FormWindowState.Minimized; } ... 阅读全文
posted @ 2013-01-23 20:42 Shanghai Jim Zhou 阅读(211) 评论(0) 推荐(0) 编辑
摘要: In the current project I am working on, the client wants to open the FTP site in the resources management window instead of the web browser, to be honest, I have tried many ways like using the ExceShell or start a resource management process, but all failed. Finally, I figured out why all those meth 阅读全文
posted @ 2013-01-23 20:30 Shanghai Jim Zhou 阅读(292) 评论(0) 推荐(0) 编辑
摘要: If you have developed a Windows Form project, you must haved experienced the OpenFileDialog class, but WinForm does not provided a class named OpenFolderDialog. Thus today, I'd like to share with your the implementation of OpenFolderDialog class as below.First, you need to add the reference to S 阅读全文
posted @ 2013-01-23 20:03 Shanghai Jim Zhou 阅读(409) 评论(0) 推荐(0) 编辑
摘要: If you are using NSIS to build your software installation package, you probably need the NSIS script. Since NSIS does not provide the build-in method to kill the process that is running during the installation process, we need the plug-ins to help to do this.1 Put the plug-ins in the NSIS installati 阅读全文
posted @ 2013-01-20 23:04 Shanghai Jim Zhou 阅读(857) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 下一页