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

做视频搬运哪个网站最赚钱10000个免费货源网站

做视频搬运哪个网站最赚钱,10000个免费货源网站,做导航网站把别人的网址链接过来要经过允许吗,emlog 转wordpress在大型项目的开发过程中,需要多人协同工作,来加速项目完成进度。 比如一个软件有100个form,分给100个人来写,每个人完成自己的Form.cs的编写之后,要在Mainform调用自己写的Form。 如果按照正常的Form form1 new For…

 

在大型项目的开发过程中,需要多人协同工作,来加速项目完成进度。

比如一个软件有100个form,分给100个人来写,每个人完成自己的Form.cs的编写之后,要在Mainform调用自己写的Form。

如果按照正常的Form form1 = new Form()这种写法来构造窗口的话,相当于每个人都要改动Mainform.cs文件,这100个人只要有1个人在Mainform中改错代码了,那么该项目就在至关重要的Mainform.cs里埋下了1个bug,这是非常危险的一件事!

所以为了降低编码的耦合性,让每个人只要关心自己的类,不用关心mainform相关的代码,可以用特性加反射的方式来提高程序的健壮性。下面就是一个例子:

 BaseForm.cs代码如下:

using System;
using System.Windows.Forms;namespace WinFormsApp1
{public enum CusFormType{HomePage,                          // 主页UserInfoPage,                  // 员工信息页LogPage,                       // 日志页SettingPage,                     // 系统设置页}public partial class BaseForm : Form{public BaseForm() { }public BaseForm(object par, Func<CusFormType, object, ActionType, BaseForm> func){param = par;Func = func;}public object param;public Func<CusFormType, object, ActionType, BaseForm> Func { get; set; }public class FormTypeAttribute : Attribute{public CusFormType[] tableType;public FormTypeAttribute(params CusFormType[] types)    //构造函数{tableType = types;}}}
}

MainForm.cs代码如下:


//#define HAHA
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Windows.Forms;
using static WinFormsApp1.BaseForm;namespace WinFormsApp1
{    public enum ActionType{New,Refresh}public partial class Mainform : Form{Func<CusFormType, object, ActionType, BaseForm> operFunc => FormOper;//Lambda 表达式是与匿名方法类似的内联表达式,但更加灵活;public Mainform(){InitializeComponent();GetTableTypeDic();}public static Dictionary<CusFormType, Type> tableTypeDic = new Dictionary<CusFormType, Type>();private void GetTableTypeDic(){var baseType = typeof(BaseForm);var allTypes = this.GetType().Assembly.GetTypes().Where(p => !p.IsInterface && baseType.IsAssignableFrom(p)).ToList();//通过反射获取所有继承自BaseForm的类的typeforeach (var item in allTypes){var attrs = item.GetCustomAttributes(typeof(FormTypeAttribute), false);//在派生类中重写时,返回应用于此成员并由System.type标识的自定义属性数组foreach (var attr in attrs){var curAttr = attr as FormTypeAttribute;if (curAttr.tableType != null){foreach (var type in curAttr.tableType)tableTypeDic[type] = item;}}}}private BaseForm FormOper(CusFormType tableType, object par, ActionType actionType = ActionType.New){if (tableTypeDic.ContainsKey(tableType)){if (actionType == ActionType.New){BaseForm tableForm = null;{tableForm = Activator.CreateInstance(tableTypeDic[tableType], new object[] { par, operFunc }) as BaseForm;tableForm.Text = tableType.ToString();}tableForm.Show();return tableForm;}}return null;}private void button1_Click(object sender, EventArgs e){operFunc.Invoke(CusFormType.HomePage, null,ActionType.New);}}
}

Form1代码如下:

using System;namespace WinFormsApp1
{[FormTypeAttribute(CusFormType.HomePage)]public partial class Form1 : BaseForm{public Form1(object par, Func<CusFormType, object, ActionType, BaseForm> func):base(par,func){InitializeComponent();}private void button1_Click(object sender, EventArgs e){Func.Invoke(CusFormType.LogPage,null,ActionType.New);}}
}

form2代码如下:

using System;namespace WinFormsApp1
{[FormTypeAttribute(CusFormType.LogPage)]public partial class Form2 : BaseForm{public Form2(object par, Func<CusFormType, object, ActionType, BaseForm> func) : base(par, func){InitializeComponent();}private void button1_Click(object sender, EventArgs e){Func.Invoke(CusFormType.SettingPage,null,ActionType.New);}}
}

form3代码就不用贴出来了,就是随便新建的一个form。

http://www.hengruixuexiao.com/news/55697.html

相关文章:

  • 大连网站建设选高合科技网络营销总结
  • 上饶商城网站建设互联网域名注册查询
  • 义乌的论坛网站建设营销模式有哪些 新型
  • wordpress 主题制作 教程百度快速优化软件
  • 织梦微电影分享网站织梦整站源码如何做个网站推广自己产品
  • wordpress 移动版插件成都网站快速优化排名
  • 怎样申请免费网站平面设计正规培训机构
  • c 做动态网站可以吗seo属于什么职位类型
  • 网站建设方案有哪几种关键词指数
  • zara网站建设需求分析企业关键词优化推荐
  • 自我介绍ppt模板免费seo软文代写
  • 什么网站做兼职可靠营销网站建设推广
  • 宁波网站推广软件百度一下你就知道了百度一下
  • 专做logo网站叫什么企业门户网站的设计与实现
  • 百度收录好的网站排名市场推广计划方案
  • 网站制作需要学习什么西安百度推广开户多少钱
  • wordpress怎么使用插件搜索引擎优化方案
  • 旅游网站开发系统关键词搜索引擎
  • 网上做实验的网站金华网站建设
  • 视频上传网站建设线上卖货平台有哪些
  • 网站行业新闻怎么做seo建站营销
  • 建设工程有限公司 网站网络舆情优化公司
  • 怎么弄免费的php空间做网站seo排名工具
  • 陕西电商b2c网站建设公司石嘴山网站seo
  • 短链接在线生成官网免费南宁seo手段
  • 做感恩网站的图片素材竞价排名的服务模式是
  • 定制网站 北京免费行情软件网站下载
  • 建设银行兰州分行网站百度竞价在哪里开户
  • 织梦做的网站如何上线青山seo排名公司
  • 重庆发布微信公众号seo企业推广案例