/// <summary> /// 有参构造函数 /// </summary> public CMcuFormAVR8BitsForm(CCommPort usedCComm, CMcuFuncAVR8BitsBase usedCMcuFunc) { InitializeComponent(); //---限定最小尺寸 this.MinimumSize = this.Size; //---修改自适应宽度的进度条 this.toolStripProgressBar_ChipBar.Width += 30; //28; this.toolStripProgressBar_ChipBar.Tag = this.toolStripProgressBar_ChipBar.Width.ToString(); this.toolStrip_ChipTool.Tag = this.toolStrip_ChipTool.Width.ToString(); //---检查通讯端口 if (this.defaultCComm == usedCComm) { this.defaultCComm = new CCommPort(); } //---通讯接口 this.defaultCComm = usedCComm; //---检查设备函数 if (this.defaultCMcuFunc == null) { this.defaultCMcuFunc = new CMcuFuncAVR8BitsBase(); } //---校验类型 if ((usedCMcuFunc != null) && (usedCMcuFunc.mMcuInfoParam.mTypeMcuInfo != MCU_INFO_TYPE.MCU_AVR8BITS)) { this.defaultCMcuFunc = usedCMcuFunc; } //---窗体事件处理 this.FormEventHandler(); }
/// <summary> /// 同步通讯端口,避免不同地方使用同一个端口,导致的通讯异常 /// </summary> private void CCOMMSynchronized() { //---控件中使用的通讯端口 this.defaultCComm = this.cCommBaseControl_ChipCOMM.mCCOMM; //---控件中使用的通讯端口 this.cMcuFormAVR8BitsFuseAndLockControl_ChipFuse.mCMcuFunc.mCCOMM = this.cCommBaseControl_ChipCOMM.mCCOMM; //---执行同步委托事件 this.EventHandlerCCommSynchronized?.Invoke(); }
/// <summary> /// 带参数的构造函数 /// </summary> /// <param name="usedComm">使用的通讯端口</param> public CMcuFuncAVR8BitsBase(CCommPort usedComm) { if (usedComm != null) { if (this.defaultCCOMM == null) { this.defaultCCOMM = new CCommPort(); } this.defaultCCOMM = usedComm; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { this.usedComm = new CSerialPort(); }