zoukankan
html css js c++ java
编程要素
Interface, Event, Wrapper
Code
//
an interface
public
interface
IOperator
{
event
EventHandler OperationCompleted;
void
Operate();
}
//
a base implementation
public
class
OperatorBase : IOperator
{
public
event
EventHandler OperationCompleted;
public
virtual
void
Operate()
{
throw
new
Exception(
"
Not implemented
"
);
}
protected
virtual
void
OnOperationCompleted(EventArgs e)
{
if
(
this
.OperationCompleted)
{
this
.OperationCompleted(
this
, e);
}
}
}
//
a wrapper base
public
class
OperatorWrapperBase : IOperator
{
IOperator mWrappee;
public
OperatorWrapperBase(IOperator wrappee)
{
this
.mWrappee
=
wrappee;
}
public
IOperator Wrappee
{
get
{
return
mWrappee;}
}
public
virtual
void
Operate()
{
this
.Wrappee.Operate();
}
public
event
EventHandler OperationCompleted
{
add
{
this
.Wrappee.OperationCompleted
+=
value; }
remove
{
this
.Wrappee.OperationCompleted
-=
value; }
}
}
查看全文
相关阅读:
正则表达式解决身份证号码和手机号
redis:集群配置
linux:NFS
xshell提示必须安装最新的更新
linux:ssh远程调用tomcat脚本时候出错
linux:scp从入门到刚入门
linux:SSH最简单教程
nginx;keepalived配置出现主主的解决方法(脑裂问题)
(4)事件处理——(4)网页上的多个脚本(Multiple scripts on one page)
[php]应用控制器(一)
原文地址:https://www.cnblogs.com/mrfangzheng/p/1165225.html
最新文章
POJ --- 3740
自定义动态添加评分标签
移动端网站或APP点击后出现闪动或灰色背景
增量发布
easydialog.js
css定义多重背景动画
chrome浏览器字体小于12px的解决方式
盒子在页面内居中
禁止选择文字和文本超出显示省略号
leetcode157
热门文章
leetcode72
leetcode161
leetcode527
leetcode408
leetcode91
lintcode104
lintcode612
lintcode544
lintcode642
一些做vue前端的经验
Copyright © 2011-2022 走看看