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

北京网站域名快速备案百度推广是否做网站

北京网站域名快速备案,百度推广是否做网站,wordpress图片怎么并排显示图片,wordpress的分享插件下载地址WPF的MVVM设计模式从winform转变到WPF的过程#xff0c;难点主要还是在MVVM的设计模式。当然#xff0c;如果依然采用winform的涉及方式#xff0c;在每个控件背后绑定事件的方式运用在wpf中#xff0c;依然可行#xff0c;但是假如GUI改版#xff0c;其背后绑定的特别为… WPF的MVVM设计模式从winform转变到WPF的过程难点主要还是在MVVM的设计模式。当然如果依然采用winform的涉及方式在每个控件背后绑定事件的方式运用在wpf中依然可行但是假如GUI改版其背后绑定的特别为此界面设计的事件不得不多数弃用。而MVVM最大的好处是将一切业务逻辑放在ViewModel中 将GUI的操作放在view中将数据结构放在Model中如图摘自MSDN实际使用使用了Prism框架省去了去构造实现INotifyPropertyChanged的基类直接继承BindableBasenamespace Prism.Mvvm{ // // 摘要: // Implementation of System.ComponentModel.INotifyPropertyChanged to simplify models. public abstract class BindableBase : INotifyPropertyChanged { protected BindableBase(); // // 摘要: // Occurs when a property value changes. public event PropertyChangedEventHandler PropertyChanged; // // 摘要: // Notifies listeners that a property value has changed. // // 参数: // propertyName: // Name of the property used to notify listeners. This value is optional and can // be provided automatically when invoked from compilers that support System.Runtime.CompilerServices.CallerMemberNameAttribute. protected virtual void OnPropertyChanged([CallerMemberName] string propertyName null); // // 摘要: // Raises this objects PropertyChanged event. // // 参数: // propertyExpression: // A Lambda expression representing the property that has a new value. // // 类型参数: // T: // The type of the property that has a new value protected virtual void OnPropertyChangedT(ExpressionFuncT propertyExpression); // // 摘要: // Checks if a property already matches a desired value. Sets the property and notifies // listeners only when necessary. // // 参数: // storage: // Reference to a property with both getter and setter. // // value: // Desired value for the property. // // propertyName: // Name of the property used to notify listeners. This value is optional and can // be provided automatically when invoked from compilers that support CallerMemberName. // // 类型参数: // T: // Type of the property. // // 返回结果: // True if the value was changed, false if the existing value matched the desired // value. protected virtual bool SetPropertyT(ref T storage, T value, [CallerMemberName] string propertyName null); }以及用来构造Command的基类DelegateCommandnamespace Prism.Commands{ // // 摘要: // An System.Windows.Input.ICommand whose delegates do not take any parameters for // Prism.Commands.DelegateCommand.Execute and Prism.Commands.DelegateCommand.CanExecute. public class DelegateCommand : DelegateCommandBase { // // 摘要: // Creates a new instance of Prism.Commands.DelegateCommand with the System.Action // to invoke on execution. // // 参数: // executeMethod: // The System.Action to invoke when System.Windows.Input.ICommand.Execute(System.Object) // is called. public DelegateCommand(Action executeMethod); // // 摘要: // Creates a new instance of Prism.Commands.DelegateCommand with the System.Action // to invoke on execution and a Func to query for determining if the command can // execute. // // 参数: // executeMethod: // The System.Action to invoke when System.Windows.Input.ICommand.Execute(System.Object) // is called. // // canExecuteMethod: // The System.Func1 to invoke when System.Windows.Input.ICommand.CanExecute(System.Object) // is called public DelegateCommand(Action executeMethod, Funcbool canExecuteMethod); protected DelegateCommand(FuncTask executeMethod); protected DelegateCommand(FuncTask executeMethod, Funcbool canExecuteMethod); // // 摘要: // Factory method to create a new instance of Prism.Commands.DelegateCommand from // an awaitable handler method. // // 参数: // executeMethod: // Delegate to execute when Execute is called on the command. // // 返回结果: // Constructed instance of Prism.Commands.DelegateCommand public static DelegateCommand FromAsyncHandler(FuncTask executeMethod); // // 摘要: // Factory method to create a new instance of Prism.Commands.DelegateCommand from // an awaitable handler method. // // 参数: // executeMethod: // Delegate to execute when Execute is called on the command. This can be null to // just hook up a CanExecute delegate. // // canExecuteMethod: // Delegate to execute when CanExecute is called on the command. This can be null. // // 返回结果: // Constructed instance of Prism.Commands.DelegateCommand public static DelegateCommand FromAsyncHandler(FuncTask executeMethod, Funcbool canExecuteMethod); // // 摘要: // Determines if the command can be executed. // // 返回结果: // Returns true if the command can execute, otherwise returns false. public virtual bool CanExecute(); // // 摘要: // Executes the command. public virtual Task Execute(); // // 摘要: // Observes a property that is used to determine if this command can execute, and // if it implements INotifyPropertyChanged it will automatically call DelegateCommandBase.RaiseCanExecuteChanged // on property changed notifications. // // 参数: // canExecuteExpression: // The property expression. Example: ObservesCanExecute((o) PropertyName). // // 返回结果: // The current instance of DelegateCommand public DelegateCommand ObservesCanExecute(ExpressionFuncobject, bool canExecuteExpression); // // 摘要: // Observes a property that implements INotifyPropertyChanged, and automatically // calls DelegateCommandBase.RaiseCanExecuteChanged on property changed notifications. // // 参数: // propertyExpression: // The property expression. Example: ObservesProperty(() PropertyName). // // 类型参数: // T: // The object type containing the property specified in the expression. // // 返回结果: // The current instance of DelegateCommand public DelegateCommand ObservesPropertyT(ExpressionFuncT propertyExpression); }}第一次使用MVVM设计模式没有理解在多个ViewModel之间通信所以不得不采用单一ViewModel和多个view这样导致了一个ViewModel的臃肿和复杂看似结构简单但是实际的逻辑越来越混乱。在没有理解Event Aggregator如何使用的情况下这是可行方案。MVVM使用感受最主要的感受是MVVM将UI和业务逻辑分离UI就只写UI不用像WinForm一样在每个事件背后如果要获得UI某个TextBox的数据得通过如下获取public void SomeButton_Clicked(object sender, EventArgs e){ string text textBox1.Text; DoSomeThings(text); ...}同样后台事件要更新前台UI数据时pubic void SomeButton_Clicked(object sender, EvnetArgs e){ DoOtherThings(); textBox1.Text Some Text;}这种硬编码的形式遇到UI的重大变化必须就将背后事件对应UI的控件名称全部更改才能继续运行。当软件达到一定复杂度这样做就是灾难性的。而MVVM使用了数据绑定虽然增加了一点代码但是带来的好处巨大。在ViewModel中先定义要绑定的数据private string name;public string Name{ get{return name;} set{ if (name ! value) { name value; OnPropertyChanged(Name); // 实现INotifyPropertyChanged接口 }}}然后在view中将其和TextBox数据绑定TextBox Text{Binding Name, ModeTwoWay}这里的数据绑定方式是双向绑定后台数据变化会自动通知前台UI线程更新数据相反前台UI线程更改了数据后台的数据也会相应变化。这样在实际数据更新时不用去查看绑定的UI控件名称也不用担心在其他线程更新控件数据时要用oneControl.Invoke(Action action)。总结第一次使用MVVM感受到的优点数据绑定不用考虑具体UI控件的名称不用手动更新UI数据。UI可操作性更大支持template业务逻辑和UI分离界面改版方便但同样带来了缺点代码量明显增加对于小软件来说开发没有WinFrom来的敏捷
http://www.zqtcl.cn/news/326209/

相关文章:

  • 互站网站源码用jsp做网站一般会用到什么
  • 个人免费设计网站fomo3d 网站怎么做
  • 菏泽做网站公司公关公司经营范围
  • 钓鱼网站营销型网站建设实战
  • 可以下载电影的网站怎么做做网站公司西安
  • 自己做签名网站网店美工培训教程
  • 宁波产品网站设计模板php 网站 教程
  • 制作一个网站的费用是多少免费网站空间怎么
  • 如何建立自己的微网站网站建设教程怎么建
  • seo网站项目讲解沈阳网红
  • 苏州大型网站建设公司网站外链优化
  • 阿里云购买域名后怎么建网站沂南网站设计
  • 网站建设基础考试php网站开发入门
  • 广州五屏网站建设seo诊断报告示例
  • 周浦高端网站建设公司信阳做网站的公司
  • 博客网站怎么建设湛江新闻头条最新消息
  • 外贸网站建设 评价有没有教做网站实例视频
  • 县 住房和城乡建设局网站wordpress接入支付宝
  • 网站建设初期推广方式天津网站建设案例
  • 销项税和进项导入是在国税网站做吗凡科网站模块
  • 苏州建网站皆去苏州聚尚网络常州企业建站系统
  • 网站建设明细wordpress 主题稳定
  • 网站设计论文前言怎么写肇庆网站开发哪家专业
  • 商城建站系统松江新城做网站公司
  • 长沙招聘做搜狗pc网站优化排
  • 辽宁智能建站系统价格金融做市场广告挂哪些网站
  • 做外贸的有哪些网站互动平台游戏
  • 网站设计最好的公司idc网站模板源码下载
  • 网站建设历史视频制作软件有哪些
  • 加盟网站制作定制桥的设计网站建设