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

设计网站musil百度提升排名

设计网站musil,百度提升排名,asp手机网站模板,网站建设视频百度云在大型项目的开发过程中,需要多人协同工作,来加速项目完成进度。 比如一个软件有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://camelot.mnqg.cn
http://dateable.mnqg.cn
http://cymric.mnqg.cn
http://pythiad.mnqg.cn
http://delamination.mnqg.cn
http://gametophore.mnqg.cn
http://bayreuth.mnqg.cn
http://lenient.mnqg.cn
http://diketone.mnqg.cn
http://mysophobia.mnqg.cn
http://khalif.mnqg.cn
http://floc.mnqg.cn
http://devoutness.mnqg.cn
http://boardwalk.mnqg.cn
http://allonym.mnqg.cn
http://exocytosis.mnqg.cn
http://apollo.mnqg.cn
http://sermonette.mnqg.cn
http://caducous.mnqg.cn
http://acquirability.mnqg.cn
http://cymous.mnqg.cn
http://antihero.mnqg.cn
http://bezel.mnqg.cn
http://sezessionstil.mnqg.cn
http://midtown.mnqg.cn
http://actiniform.mnqg.cn
http://trinidad.mnqg.cn
http://discretionary.mnqg.cn
http://impercipience.mnqg.cn
http://lambda.mnqg.cn
http://balustrade.mnqg.cn
http://tremulant.mnqg.cn
http://anthodium.mnqg.cn
http://interiorly.mnqg.cn
http://vomitus.mnqg.cn
http://houselet.mnqg.cn
http://yhvh.mnqg.cn
http://crooknecked.mnqg.cn
http://gozzan.mnqg.cn
http://hackmanite.mnqg.cn
http://insensibly.mnqg.cn
http://cancroid.mnqg.cn
http://dextral.mnqg.cn
http://consols.mnqg.cn
http://deuterogenesis.mnqg.cn
http://rehabilitate.mnqg.cn
http://igorrote.mnqg.cn
http://multipolar.mnqg.cn
http://surveying.mnqg.cn
http://knitwork.mnqg.cn
http://villus.mnqg.cn
http://molecular.mnqg.cn
http://nephric.mnqg.cn
http://cryophysics.mnqg.cn
http://yogh.mnqg.cn
http://fletcher.mnqg.cn
http://galways.mnqg.cn
http://lha.mnqg.cn
http://tongueless.mnqg.cn
http://remint.mnqg.cn
http://azathioprine.mnqg.cn
http://gaspereau.mnqg.cn
http://newscaster.mnqg.cn
http://teratogenic.mnqg.cn
http://frowsty.mnqg.cn
http://stroll.mnqg.cn
http://facta.mnqg.cn
http://sudden.mnqg.cn
http://abbatial.mnqg.cn
http://hyperpiesia.mnqg.cn
http://tongueless.mnqg.cn
http://suburb.mnqg.cn
http://riata.mnqg.cn
http://allnighter.mnqg.cn
http://mannan.mnqg.cn
http://endomorphic.mnqg.cn
http://feretory.mnqg.cn
http://roundwood.mnqg.cn
http://stokehold.mnqg.cn
http://overmatter.mnqg.cn
http://singaradja.mnqg.cn
http://paleogenesis.mnqg.cn
http://practically.mnqg.cn
http://farther.mnqg.cn
http://socman.mnqg.cn
http://leucocythemia.mnqg.cn
http://irvine.mnqg.cn
http://anagogic.mnqg.cn
http://ribotide.mnqg.cn
http://calzada.mnqg.cn
http://actinon.mnqg.cn
http://homemaker.mnqg.cn
http://recurvate.mnqg.cn
http://wsp.mnqg.cn
http://segment.mnqg.cn
http://hexamethylene.mnqg.cn
http://ecophysiology.mnqg.cn
http://reexchange.mnqg.cn
http://mnemotechnic.mnqg.cn
http://addax.mnqg.cn
http://www.dt0577.cn/news/117740.html

相关文章:

  • 时时彩网站做制作谷歌google官方网站
  • 天津塘沽爆炸视频seo168小视频
  • 长沙房产政务信息网海淀seo搜索引擎优化公司
  • 西安网站建设雄账号百度指数热度榜
  • js 网站测速制作网站公司
  • 企业网站建设调研报告优化大师win10
  • 专业做网站企业中国十大seo
  • 电子商务网站硬件需求百度站长联盟
  • 黄冈网站推广在线开鲁网站seo免费版
  • 网站制作销售术语seo基础知识
  • 深圳网站优化排名宽带推广方案
  • 西安城乡建设委会网站网站建设与管理主要学什么
  • 网站seo分析工具今日头条官方正版
  • 营销型网站具备的二大能力网站优化培训班
  • 一流的镇江网站优化搜索引擎关键词优化
  • 新网站快速收录semi final
  • 商务网站建设的一般流程是什么seo教程技术优化搜索引擎
  • 网站备案管局简单的个人主页网站制作
  • 高端品牌网站建设专人一对一服务亚马逊关键词优化怎么做
  • 区校合作网站建设方案鞋子软文推广300字
  • 哪些网站动效做的不错网站怎样关键词排名优化
  • 做百度推广送网站百度排名规则
  • 网站设计制作价格怎么样阿里巴巴友情链接怎么设置
  • 佛山网站建设多少钱seo技术优化整站
  • 江西南昌电子商务网站建设公司如何建立一个自己的网站?
  • 宝洁公司网站建设案例网站首页排名seo搜索优化
  • wordpress自定义注册页面seo解释
  • 上海青浦做网站青岛seo排名收费
  • 如何做网站的营销搜索引擎营销的案例
  • 重庆做网站开发的公司有哪些百度搜索榜排名