public bool Init(GameObject model) { m_DeviceController = new DeviceCtrl(); m_PlayController = new PlayController(model); return(true); }
bool Init(GameObject modelRef, GameObject model, string strFileNameRef) { m_PlayControllerRef = new PlayController(modelRef); m_RecordController = model.GetComponent <ModelCtrl>(); m_DeviceController = new DeviceCtrl(); m_TrailCurveAppraise = new TrailCurveAppraiseCtrl(); m_ReaderRef = new FileReader(strFileNameRef); return(true); }
private void btnFlash_Click(object sender, EventArgs e) { string str = ""; if (rdoCleanAll.IsChecked) { str = FlashType.CleanAll; } else if (rdoSaveUserData.IsChecked) { str = FlashType.SaveUserData; } else if (rdoCleanAllAndLock.IsChecked) { str = FlashType.CleanAllAndLock; } timer_updateStatus.Enabled = true; try { foreach (Device flashDevice in FlashingDevice.flashDeviceList) { if (!flashDevice.IsDone.HasValue || flashDevice.IsDone.Value) { flashDevice.StartTime = DateTime.Now; flashDevice.Status = "flashing"; flashDevice.Progress = 0.0f; flashDevice.IsDone = new bool?(false); flashDevice.IsUpdate = true; DeviceCtrl deviceCtrl = flashDevice.DeviceCtrl; deviceCtrl.deviceName = flashDevice.Name; deviceCtrl.swPath = txtPath.Text.Trim(); deviceCtrl.flashScript = str; new Thread(new ThreadStart(deviceCtrl.flash)) { IsBackground = true }.Start(); } } } catch (Exception ex) { int num = (int)MessageBox.Show(ex.Message); } }
public override bool InitDrive(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARA para, DEVICE_DRIVER driver) { //必须调用此方法 if (!base.InitDrive(server, communication, device, para, driver)) { return(false); } ///初始化驱动控件 if (IsCreateControl) { if (para != null) { this.ParaCtrl = new ModbusControl(); ParaCtrl.Dock = DockStyle.Fill; ParaCtrl.SetUIParameter(server, device, para); } if (device != null) { this.DeviceCtrl = new ModbusDeviceControl(); DeviceCtrl.Dock = DockStyle.Fill; DeviceCtrl.SetUIParameter(server, device); } } try { //设备参数格式 //Modbus类型:ASCII,字节存储:高位字节在前,起开地址:0,寄存器数量:200 string[] str = device.IO_DEVICE_PARASTRING.Split(new char[2] { ':', ',' }); if (str.Length == 4) { ModBusProtocol mbp = ModBusProtocol.RTU; switch (str[1].Trim().ToUpper()) { case "ASCII": mbp = ModBusProtocol.ASCII; break; case "RTU": mbp = ModBusProtocol.RTU; break; case "SERIAL": //串口模式下的 mbp = ModBusProtocol.Serial; break; } ModbusAnalysis = new ModbusAnalysis(mbp); } else { ModbusAnalysis = new ModbusAnalysis(ModBusProtocol.RTU); } } catch (Exception emx) { this.DeviceException(emx.Message); return(false); } return(true); }