/// <summary> /// this.PにDefault値を読み込みます /// </summary> private void SetParams() { #region{アプリケーション設定の読み込み} this.P = new Params(); P.AUTO_CONNECT = NanoTerm.Properties.Settings.Default.AUTO_CONNECT; P.AUTO_RECONNECT = NanoTerm.Properties.Settings.Default.AUTO_RECONNECT; P.AUTO_SAVE = NanoTerm.Properties.Settings.Default.AUTO_SAVE; P.RETURN_CODE = ParamToNewLine(NanoTerm.Properties.Settings.Default.RETURN_CODE.Trim(' ')); P.BAUD_RATE = NanoTerm.Properties.Settings.Default.BAUD_RATE; P.MAX_PORT_NUMBER = NanoTerm.Properties.Settings.Default.MAX_PORT_NUMBER; P.MAX_UPDATE_FREQ = NanoTerm.Properties.Settings.Default.MAX_UPDATE_FREQ; P.THREAD_RECONNECT_INTERVAL = NanoTerm.Properties.Settings.Default.THREAD_RECONNECT_INTERVAL; P.THREAD_SAVELOG_INTERVAL = NanoTerm.Properties.Settings.Default.THREAD_SAVELOG_INTERVAL; P.SEND_AT_ONCE = NanoTerm.Properties.Settings.Default.SEND_AT_ONCE; P.TX_TIMESTAMP = NanoTerm.Properties.Settings.Default.TX_TIMESTAMP; P.RX_TIMESTAMP = NanoTerm.Properties.Settings.Default.RX_TIMESTAMP; P.TIMESTAMP_FORMAT = NanoTerm.Properties.Settings.Default.TIMESTAMP_FORMAT; P.TIMESTAMP_SPAN = NanoTerm.Properties.Settings.Default.TIMESTAMP_SPAN; P.THREAD_DRAWGRAPH_INTERVAL = NanoTerm.Properties.Settings.Default.THREAD_DRAWGRAPH_INTERVAL; P.SAVE_PATH = NanoTerm.Properties.Settings.Default.SAVE_PATH; P.AUTO_SAVE_FORMOPENING = NanoTerm.Properties.Settings.Default.AUTO_CONNECT_FORMOPENING; P.SERIAL_DATABITS = NanoTerm.Properties.Settings.Default.SERIAL_DATABITS; P.SERIAL_DTR_ENABLE = NanoTerm.Properties.Settings.Default.SERIAL_DTR_ENABLE; P.SERIAL_HANDSHAKE = NanoTerm.Properties.Settings.Default.SERIAL_HANDSHAKE; P.SERIAL_PARITY = NanoTerm.Properties.Settings.Default.SERIAL_PARITY; P.SERIAL_STOPBITS = NanoTerm.Properties.Settings.Default.SERIAL_STOPBITS; P.SEND_FILE_PATH = NanoTerm.Properties.Settings.Default.SEND_FILE_PATH; P.REMOVE_EMPTY_LOG = NanoTerm.Properties.Settings.Default.REMOVE_EMPTY_LOG; P.TIMESTAMP_LINEHEAD = NanoTerm.Properties.Settings.Default.TIMESTAMP_LINEHEAD; P.TX_SHOW = NanoTerm.Properties.Settings.Default.TX_SHOW; P.RX_SHOW = NanoTerm.Properties.Settings.Default.RX_SHOW; P.BINARY_SHOW = NanoTerm.Properties.Settings.Default.BINARY_SHOW; #endregion }
private void 基本設定EToolStripMenuItem_Click(object sender, EventArgs e) { Setting s = new Setting(this.P); if (s.ShowDialog() == DialogResult.OK) { this.P = s.p; } }
public Setting(Params p) { InitializeComponent(); this.p = p; this.checkBox_AUTO_CONNECT.Checked = this.p.AUTO_CONNECT; this.checkBox_AUTO_RECONNECT.Checked = this.p.AUTO_RECONNECT; this.checkBox_AUTOSAVE.Checked = this.p.AUTO_SAVE; this.checkBox_TIMESTAMPRX.Checked = this.p.RX_TIMESTAMP; this.checkBox_TIMESTAMPTX.Checked = this.p.TX_TIMESTAMP; this.checkBox_SHOW_BINARY.Checked = this.p.BINARY_SHOW; this.checkBox_SHOW_RX.Checked = this.p.RX_SHOW; this.checkBox_SHOW_TX.Checked = this.p.TX_SHOW; this.checkBox_TIMESTAMP_LINEHEAD.Checked = this.p.TIMESTAMP_LINEHEAD; if (this.p.RETURN_CODE == "\r") { this.radioButton_CR.Checked = true; } else if (this.p.RETURN_CODE == "\n") { this.radioButton_LF.Checked = true; } else if (this.p.RETURN_CODE == "\r\n") { this.radioButton_CRLF.Checked = true; } if (this.p.SEND_AT_ONCE) { this.radioButton_SYNC.Checked = true; } else { this.radioButton_DELIMITER.Checked = true; } if (this.p.AUTO_SAVE_FORMOPENING) { this.panel_autoconnect.Enabled = true; this.checkBox_AUTO_CONNECT_FORMOPENING.Checked = true; } if (this.p.REMOVE_EMPTY_LOG) { this.checkBox_removeEmptyLog.Checked = true; } else { this.checkBox_AUTO_CONNECT_FORMOPENING.Checked = false; this.panel_autoconnect.Enabled = false; } if (this.checkBox_AUTO_CONNECT.Checked || this.checkBox_AUTO_CONNECT_FORMOPENING.Checked) { this.panel_autoconnect.Enabled = true; } else { this.panel_autoconnect.Enabled = false; } if (this.checkBox_TIMESTAMPRX.Checked) { this.checkBox_TIMESTAMP_LINEHEAD.Enabled = true; } else { this.checkBox_TIMESTAMP_LINEHEAD.Enabled = false; } this.comboBox_BAUDRATE.Text = this.p.BAUD_RATE.ToString(); this.comboBox_DataBits.Text = this.p.SERIAL_DATABITS.ToString(); string parity = ""; switch (this.p.SERIAL_PARITY) { case Parity.None: parity = "なし"; break; case Parity.Even: parity = "偶数"; break; case Parity.Odd: parity = "奇数"; break; case Parity.Space: parity = "スペース"; break; case Parity.Mark: parity = "マーク"; break; } this.comboBox_Parity.Text = parity; string stopbits = ""; switch (this.p.SERIAL_STOPBITS) { case StopBits.One: stopbits = "1"; break; case StopBits.OnePointFive: stopbits = "1.5"; break; case StopBits.Two: stopbits = "2"; break; } this.comboBox_StopBits.Text = stopbits; if (this.p.SERIAL_DTR_ENABLE) { this.comboBox_HandShake.Text = "DTR/DSR"; } else { string handshake = ""; switch (this.p.SERIAL_HANDSHAKE) { case Handshake.None: handshake = "なし"; break; case Handshake.XOnXOff: handshake = "Xon/Xoff"; break; case Handshake.RequestToSend: handshake = "RTS/CTS"; break; } this.comboBox_HandShake.Text = handshake; } this.comboBox_TIMESTAMP_FORMAT.Text = this.p.TIMESTAMP_FORMAT; this.textBox_TIMESTAMP_RATE.Text = this.p.TIMESTAMP_SPAN.TotalMilliseconds.ToString(); this.comboBox_BAUDRATE.Text = this.p.BAUD_RATE.ToString(); //this.textBox_RECONNECT_INTERVAL.Text = this.THREAD_RECONNECT_INTERVAL.ToString(); this.textBox1_SAVE_INTERVAL.Text = this.p.THREAD_SAVELOG_INTERVAL.ToString(); }