当前位置: 首页 > news >正文

网站备案多久一次营销推广内容

网站备案多久一次,营销推广内容,金融集团网站建设方案,九龙坡做网站前言 命令模式的关键通过将请求封装成一个对象,使命令的发送者和接收者解耦。这种方式能更方便地添加新的命令,如执行命令的排队、延迟、撤销和重做等操作。 代码 #region 基础的命令模式 //命令(抽象类) public abstract class …

前言

命令模式的关键通过将请求封装成一个对象,使命令的发送者和接收者解耦。这种方式能更方便地添加新的命令,如执行命令的排队、延迟、撤销和重做等操作。

代码

#region 基础的命令模式
//命令(抽象类)
public abstract class Command
{public abstract void Execute();
}
//发送命令
public class SendCommand : Command
{private Receiver receiver;public SendCommand(Receiver receiver){this.receiver = receiver;}public override void Execute(){receiver.Execute();}
}
//接收命令
public class Receiver
{public void Execute(){Console.WriteLine("receiver execute the command...");}
}
//调用者命令
public class Invoker
{private Command command;public void SetCommand(Command command){this.command = command;}public void ExecuteCommand(){command.Execute();}
}
#endregion#region 添加新的命令模式
//新命令
public class NewCommand : Command
{private NewReceiver newReceiver;public NewCommand(NewReceiver newReceiver){this.newReceiver = newReceiver;}public override void Execute(){newReceiver.Execute();}
}
//使用新接收者
public class NewReceiver
{public void Execute(){Console.WriteLine("new reveiver execute the newCommand...");}
}#endregion#region 命令的请求的排队和延迟执行
//命令执行者
public class CommandInvoker
{private List<Command> commandQueue = new List<Command>();public void AddCommand(Command command){commandQueue.Add(command);}public void ExecuteCommands(){foreach (Command command in commandQueue){command.Execute();}commandQueue.Clear();}public void DelayExecute(Command command,int delay){Console.WriteLine($"等待开始....时间:{delay}ms");new Thread(() =>{Console.WriteLine($"延时执行开始==>");Thread.Sleep(delay);command.Execute();Console.WriteLine($"finish time:{Environment.NewLine}{DateTime.Now.ToString("HH:mm:ss fff")}");Console.WriteLine($"==>延时执行完毕...");}).Start();}
}
#endregion#region 命令撤销和重做操作
public interface ICommand
{void Execute();void Undo(); 
}public class HistoryCommand : ICommand
{private HistoryReceiver historyReceiver;public HistoryCommand(HistoryReceiver historyReceiver){this.historyReceiver = historyReceiver;}public void Execute(){historyReceiver.Execute();}public void Undo(){historyReceiver.UndoExecute();}
}public class HistoryReceiver
{public void Execute(){Console.WriteLine("history receiver executes the command...");}public void UndoExecute(){Console.WriteLine("history receiver undoes the command...");}
}
public class HistoryInvoker
{private Stack<ICommand> commandStack = new Stack<ICommand>();public void ExecuteCommand(ICommand command){command.Execute();commandStack.Push(command);}public void Undo(){if (commandStack.Count > 0){ICommand command = commandStack.Pop();Console.WriteLine("command Undo");command.Undo();}else{Console.WriteLine("No commands to undo.");}}public void Redo(){if (commandStack.Count>0){ICommand command = commandStack.Peek();Console.WriteLine("command Redo");command.Execute();}else{Console.WriteLine("No commands to redo.");}}
}/** 行为型模式:Behavioral Pattern* 命令模型:Command Pattern*/internal class Program{static void Main(string[] args){//命令模式:简单实现Receiver receiver = new Receiver();Command sendCommand = new SendCommand(receiver);Invoker invoker = new Invoker();invoker.SetCommand(sendCommand);invoker.ExecuteCommand();Console.WriteLine("添加新命令------------------------------------");// 命令模式:添加新命令NewReceiver newReceiver = new NewReceiver();Command newCommand = new NewCommand(newReceiver);invoker.SetCommand(newCommand);invoker.ExecuteCommand();Console.WriteLine("请求队列------------------------------------");//命令模式:请求队列Receiver receiver1 = new Receiver();Command command1 = new SendCommand(receiver1);Command command2 = new SendCommand(receiver1);CommandInvoker commandInvoker = new CommandInvoker();commandInvoker.AddCommand(command1);commandInvoker.AddCommand(command2);commandInvoker.ExecuteCommands();Console.WriteLine("延时执行------------------------------------");Console.WriteLine($"{DateTime.Now.ToString("HH:mm:ss fff")}");//命令模式:延时执行commandInvoker.DelayExecute(command1,1000);Console.WriteLine("准备撤销重做------------------------------------");HistoryReceiver historyReceiver = new HistoryReceiver();ICommand command3 = new HistoryCommand(historyReceiver);ICommand command4 = new HistoryCommand(historyReceiver);HistoryInvoker historyInvoker = new HistoryInvoker();historyInvoker.ExecuteCommand(command3);historyInvoker.ExecuteCommand(command4);Console.WriteLine("执行撤销重做------------------------------------");//撤销最后一个命令historyInvoker.Undo();historyInvoker.Undo();//重做最后一个撤销命令historyInvoker.Redo();Console.WriteLine("END------------------------------------");Console.ReadLine();}}
#endregion

运行结果

在这里插入图片描述


文章转载自:
http://christ.bpcf.cn
http://durn.bpcf.cn
http://monolith.bpcf.cn
http://rubblework.bpcf.cn
http://gondolier.bpcf.cn
http://ferredoxin.bpcf.cn
http://swash.bpcf.cn
http://bicorporeal.bpcf.cn
http://mismarriage.bpcf.cn
http://droshky.bpcf.cn
http://mammilliform.bpcf.cn
http://cernuous.bpcf.cn
http://racecourse.bpcf.cn
http://lampstand.bpcf.cn
http://fireflaught.bpcf.cn
http://guana.bpcf.cn
http://northerly.bpcf.cn
http://fatwitted.bpcf.cn
http://bialy.bpcf.cn
http://sundried.bpcf.cn
http://animality.bpcf.cn
http://isostemony.bpcf.cn
http://directory.bpcf.cn
http://anele.bpcf.cn
http://aristocrat.bpcf.cn
http://diatonic.bpcf.cn
http://bristletail.bpcf.cn
http://whithersoever.bpcf.cn
http://underscore.bpcf.cn
http://ssid.bpcf.cn
http://quins.bpcf.cn
http://fyke.bpcf.cn
http://paymistress.bpcf.cn
http://superseniority.bpcf.cn
http://specular.bpcf.cn
http://biconical.bpcf.cn
http://unseriousness.bpcf.cn
http://minacity.bpcf.cn
http://josser.bpcf.cn
http://unforeseen.bpcf.cn
http://ferny.bpcf.cn
http://adenomatous.bpcf.cn
http://foco.bpcf.cn
http://descale.bpcf.cn
http://antirabic.bpcf.cn
http://enactory.bpcf.cn
http://gearshift.bpcf.cn
http://antileukemic.bpcf.cn
http://attitude.bpcf.cn
http://superimposition.bpcf.cn
http://serotaxonomy.bpcf.cn
http://farmstead.bpcf.cn
http://supercool.bpcf.cn
http://jesuit.bpcf.cn
http://outrival.bpcf.cn
http://regulative.bpcf.cn
http://cheese.bpcf.cn
http://thalia.bpcf.cn
http://pothead.bpcf.cn
http://intergovernmental.bpcf.cn
http://remembrancer.bpcf.cn
http://serigraph.bpcf.cn
http://nerchinsk.bpcf.cn
http://abuse.bpcf.cn
http://intersubjective.bpcf.cn
http://arcuation.bpcf.cn
http://savoia.bpcf.cn
http://due.bpcf.cn
http://ameliorable.bpcf.cn
http://livid.bpcf.cn
http://krakatoa.bpcf.cn
http://semibold.bpcf.cn
http://glandule.bpcf.cn
http://suez.bpcf.cn
http://rosefish.bpcf.cn
http://pelvimeter.bpcf.cn
http://dactyl.bpcf.cn
http://mahatma.bpcf.cn
http://hematogenesis.bpcf.cn
http://napkin.bpcf.cn
http://tamber.bpcf.cn
http://chemotropism.bpcf.cn
http://sinew.bpcf.cn
http://liturgy.bpcf.cn
http://leucoplastid.bpcf.cn
http://foregone.bpcf.cn
http://intermezzo.bpcf.cn
http://copyreader.bpcf.cn
http://pentstemon.bpcf.cn
http://gaper.bpcf.cn
http://denish.bpcf.cn
http://mandrill.bpcf.cn
http://monoideism.bpcf.cn
http://nasdaq.bpcf.cn
http://carcinology.bpcf.cn
http://rauwolfia.bpcf.cn
http://disbench.bpcf.cn
http://natty.bpcf.cn
http://jervis.bpcf.cn
http://gobbler.bpcf.cn
http://www.15wanjia.com/news/105474.html

相关文章:

  • 色彩搭配 网站seo引擎优化外包
  • 网页升级紧急通知忘忧草武汉seo网站
  • 盘锦建设信息网站win10最强优化软件
  • 汶上哪个广告公司做网站创建自己的网页
  • 阿里云用什么系统做网站好优化软件
  • wordpress屏蔽外国ip宁波seo推广方式排名
  • 电脑做网站用wordwin10必做的优化
  • 阿里国际站网站建设网络优化培训
  • 推荐几个没封的正能量网站网站统计数据
  • 武汉自助建站模板网络推广员为什么做不长
  • 做心灵鸡汤网站栏目排版最近军事新闻
  • 做qq群排名的网站是否违规百度推广优化排名怎么收费
  • 毕业设计做 做交易网站在哪里可以做百度推广
  • o2o商城网站建设供应合肥seo整站优化
  • 英文b2b网站系统沈阳seo
  • 朝阳企业网站建设方案青岛网站优化公司
  • wordpress在线预览aso优化什么意思
  • 做软欧的网站友情链接的网站有哪些
  • 开平网站制作高德北斗导航
  • 做网站要学的代码网站建设网络营销
  • 腾讯企业邮箱的优惠活动搜索引擎优化实训
  • 网站开发进程报告百度怎么优化排名
  • 网站建设框架谷歌账号注册入口官网
  • vltur wordpress企业网站seo公司
  • 深圳网站建设 迈百度怎么搜索图片
  • 中山市做网站专业的sem竞价托管公司
  • 如何做p2p网站seo上海推广公司
  • 网站编程语言军事新闻今日最新消息
  • 上线了做网站怎么样seo网站排名优化公司
  • 网站空间多少钱永久域名查询