private void toConsoleReceive(string s) { this.Dispatcher.Invoke((Action)(() => { if (ConsoleReceive.Text.Length > 5000) { ConsoleReceive.Text = ""; } ConsoleReceive.Text += s; ConsoleReceive.ScrollToEnd(); buffer.Append(s); if (buffer.ToString().IndexOf("\r") > -1) { if (buffer.ToString().IndexOf("$GPRMC") > -1) { string time = buffer.ToString().Split(',')[1].Split('.')[0]; Time.Content = time.Substring(0, 2) + ":" + time.Substring(2, 2) + ":" + time.Substring(4, 2); } else if (buffer.ToString().IndexOf("$GPGLL") > -1) { string latitude = buffer.ToString().Split(',')[1]; string longtitude = buffer.ToString().Split(',')[3]; Latitude.Content = latitude; Longtitude.Content = longtitude; } buffer.Clear(); } })); }
private void toConsoleReceive(string s) { this.Dispatcher.Invoke((Action)(() => { ConsoleReceive.Text += s; ConsoleReceive.ScrollToEnd(); })); }
private void toConsoleReceive(string s) { this.Dispatcher.Invoke((Action)(() => { if (ConsoleReceive.Text.Length > 5000) { ConsoleReceive.Text = ""; } ConsoleReceive.Text += s; ConsoleReceive.ScrollToEnd(); buffer.Append(s); })); }