private void 设置ToolStripMenuItem_Click(object sender, EventArgs e) { if (_currentUpSetting != null) { DeviceSerialSetting dss = new DeviceSerialSetting(); dss.BaudRate = _currentUpSetting.Pcs.BaudRate; dss.Databit = _currentUpSetting.Pcs.DataBits; dss.StopBit = _currentUpSetting.Pcs.StopBits; dss.Parity = _currentUpSetting.Pcs.Parity; dss.PrjName = _currentUpSetting.Name; if (dss.ShowDialog() == DialogResult.OK) { _currentUpSetting.Pcs = dss.DeviceComSetting; _currentUpSetting.Name = dss.PrjName; RefreshPrjSetting(); } } }
private void dbComDataList_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (_currentUpSetting != null) { DeviceSerialSetting dss = new DeviceSerialSetting(); dss.BaudRate = _currentUpSetting.Pcs.BaudRate; dss.Databit = _currentUpSetting.Pcs.DataBits; dss.StopBit = _currentUpSetting.Pcs.StopBits; dss.Parity = _currentUpSetting.Pcs.Parity; dss.PrjName = _currentUpSetting.Name; if (dss.ShowDialog() == DialogResult.OK) { _currentUpSetting.Pcs = dss.DeviceComSetting; _currentUpSetting.Name = dss.PrjName; RefreshPrjSetting(); } } }
private void 添加ToolStripMenuItem_Click(object sender, EventArgs e) { try { DeviceSerialSetting dss = new DeviceSerialSetting(); if (dss.ShowDialog() == DialogResult.OK) { if (_upSettings != null) { foreach (UserPrjSetting upsetting in _upSettings) { if (upsetting.Name == dss.PrjName) { Helper.ShowMessageBox("提示", "已存在相同的名称"); return; } } UserPrjSetting upset = new UserPrjSetting(dss.PrjName, dss.DeviceComSetting); UserPrjOperation _userPrjOperation_On = new UserPrjOperation(PrjOperationType.开, ""); UserPrjOperation _userPrjOperation_Off = new UserPrjOperation(PrjOperationType.关, ""); upset.AddPrjSetting(_userPrjOperation_On); upset.AddPrjSetting(_userPrjOperation_Off); AddPrjSetCommand(upset); } else { UserPrjSetting upset = new UserPrjSetting(dss.PrjName, dss.DeviceComSetting); UserPrjOperation _userPrjOperation_On = new UserPrjOperation(PrjOperationType.开, ""); UserPrjOperation _userPrjOperation_Off = new UserPrjOperation(PrjOperationType.关, ""); upset.AddPrjSetting(_userPrjOperation_On); upset.AddPrjSetting(_userPrjOperation_Off); lock (_lock) { _upSettings.Add(upset); RefreshPrjSetting(); } } } } catch (Exception ex) { Helper.ShowMessageBox("异常", ex.Message); } }