public DebugViewModel(MainBoard mainBoard, SettingViewModel settings) { if (mainBoard == null) throw new ArgumentNullException("mainBoard"); if (settings == null) throw new ArgumentNullException("settings"); base.DisplayName = Resources.DebugViewModel_Displayname; _settings = settings; _mainBoard = mainBoard; commands = LoadCommands("Data/MainBoardCommand.xml"); ConnectButtonContent = "连接"; }
public void Set(SettingViewModel settings) { if (serialPort.IsOpen) serialPort.Close(); serialPort.PortName = settings.PortName; serialPort.BaudRate = settings.BaudRate; serialPort.DataBits = settings.DataBits; serialPort.Parity = settings.Parity; serialPort.StopBits = settings.StopBits; serialPort.RtsEnable = settings.RtsEnable; serialPort.ReadTimeout = settings.TimeOut; serialPort.WriteTimeout = settings.TimeOut; }