//_________________________________________________________________________ public void Inv_OutMess(string asMess, bool bDateOut = true) { DateTime DT = DateTime.Now; string asDT = bDateOut ? $"{DT:ddMMyy HH:mm:ss}.{DT.Millisecond:000}" : ""; DOutMess OutMess = (m, DateOut) => TBOut.AppendText($"[{asDT}] {asMess}{Environment.NewLine}"); Invoke(OutMess, asMess /*, asDelimiter*/, bDateOut); }
public CTestExch(object TheControl) { InitializeComponent(); Parent = (Control)TheControl; CBIP.Items.AddRange(Properties.Settings.Default.asIPs.Split(';')); if (Properties.Settings.Default.asIP.Length > 7) { CBIP.SelectedIndex = CBIP.FindString(Properties.Settings.Default.asIP); } else { if (CBIP.Items.Count > 0) { CBIP.SelectedIndex = 0; } } TBPort.Text = Properties.Settings.Default.asPort; TBCommand.Text = Properties.Settings.Default.asCommand; OutMess = Inv_OutMess; CBBaudCOM.SelectedIndex = CBBaudCOM.FindString(Properties.Settings.Default.asBaudCom); if (CBBaudCOM.SelectedIndex == -1) { CBBaudCOM.SelectedIndex = 0; } NUDTimeout.Value = Properties.Settings.Default.dTimeoutBetwen; UDCOM.Value = Properties.Settings.Default.mComPort; CBParity.Items.AddRange(Enum.GetNames(typeof(System.IO.Ports.Parity))); CBParity.SelectedIndex = Properties.Settings.Default.iParity; CBStopBits.Items.AddRange(Enum.GetNames(typeof(System.IO.Ports.StopBits))); CBStopBits.SelectedIndex = Properties.Settings.Default.iStopBits; NUDDataBits.Value = Properties.Settings.Default.iDataBits; //ReSize (); BeginDopFunc = new SPDopFunc(PDopFunc.Top, PDopFunc.Width, PDopFunc.Height); NUDFontSize.Value = (decimal)TBListExchange.Font.Size; CBDev.Items.AddRange(Enum.GetNames(typeof(DEVICE))); CBDev.SelectedIndex = CBDev.FindString(Properties.Settings.Default.asDevExch); if (CBDev.SelectedIndex < 0) { CBDev.SelectedIndex = 0; } }
//_________________________________________________________________________ public void Inv_OutMess(string asMess, string asBeforeDT, bool bOutTime = true) { DateTime DT = DateTime.Now; if (bOutTime) { asMess = asBeforeDT + "[" + DT.ToString() + "." + DT.Millisecond.ToString() + "]\t" + asMess; } else { asMess = asBeforeDT + asMess; } DOutMess OutMess = (m, d, o) => TBListExchange.AppendText(Environment.NewLine + asMess); Invoke(OutMess, asMess, " ", bOutTime); //TBListExchange.AppendText (Environment.NewLine + asMess); }