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

学院网站设计流程手机建设网站策划书

学院网站设计流程,手机建设网站策划书,什么是企业微信,手提电脑做网站服务器在大型项目的开发过程中#xff0c;需要多人协同工作#xff0c;来加速项目完成进度。 比如一个软件有100个form#xff0c;分给100个人来写#xff0c;每个人完成自己的Form.cs的编写之后#xff0c;要在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, FuncCusFormType, object, ActionType, BaseForm func){param par;Func func;}public object param;public FuncCusFormType, 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{FuncCusFormType, object, ActionType, BaseForm operFunc FormOper;//Lambda 表达式是与匿名方法类似的内联表达式但更加灵活public Mainform(){InitializeComponent();GetTableTypeDic();}public static DictionaryCusFormType, Type tableTypeDic new DictionaryCusFormType, 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, FuncCusFormType, 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, FuncCusFormType, 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.zqtcl.cn/news/351986/

相关文章:

  • 删除网站备案网站建设湖南岚鸿建设
  • 做vlogger的网站有哪些长沙网站排名技巧
  • 媒体营销平台商品seo关键词优化
  • 芜湖先锋网站两学一做wordpress菜单顶部
  • 网站策划怎么样一级域名网站如何申请
  • 烟台高端网站开发网站开发哪个公司好
  • 广州网站定制开发方案南宁网站 制作
  • php做网站需要后台吗郑州建网站十大
  • 网站跳出率是什么意思百度服务
  • 建站 discuz开发者导航
  • 有哪些网站可以做毕业设计外贸网站发外链
  • 如何使用网站模板计算机培训班有用吗
  • 本地宁波网站建设电子商务网站建设工具都有那些
  • 网站建设的基本目标免费 wordpress企业主题
  • 专业网站建设微信商城开发规划馆网站建设
  • 网站建设公司沈阳西安建设工程信息交易中心官网
  • 青海住房和城乡建设部网站wordpress php7.3
  • 网站后台重置密码怎么做360网站怎么做网址链接
  • 广告网站建设及推广网站建设怎样推广
  • 做网站使网页不居中滁州注册公司流程和费用
  • 做网站广告经营者个性定制网站
  • 网站开发 北京外包公司软件公司网站建设
  • 网络认证入口seo免费诊断
  • 十大知名博客网站郑州企业建站公司定制
  • 视频网站如何做引流网站首页 关键词
  • 建设机械网站精英大港做网站
  • 潜山网站建设公司哪里有wordpress相册投票插件
  • 网站建设制作过程网站添加支付功能
  • 网站制作字体即墨公司做网站
  • vue 做pc网站可以吗哪个网站买域名便宜