Click here to Skip to main content
14,847,125 members
Home / Discussions / C#
   

C#

 
AnswerRe: WinForm launching a console application Pin
TimWallace8-Feb-21 18:03
MemberTimWallace8-Feb-21 18:03 
QuestionHow to sum up values of duplicate keys in a dictionary? Pin
Alex Dunlop2-Feb-21 6:37
MemberAlex Dunlop2-Feb-21 6:37 
AnswerRe: How to sum up values of duplicate keys in a dictionary? Pin
Dave Kreskowiak2-Feb-21 12:35
mveDave Kreskowiak2-Feb-21 12:35 
GeneralRe: How to sum up values of duplicate keys in a dictionary? Pin
Alex Dunlop3-Feb-21 5:39
MemberAlex Dunlop3-Feb-21 5:39 
GeneralRe: How to sum up values of duplicate keys in a dictionary? Pin
Dave Kreskowiak3-Feb-21 6:36
mveDave Kreskowiak3-Feb-21 6:36 
GeneralRe: How to sum up values of duplicate keys in a dictionary? Pin
Alex Dunlop3-Feb-21 6:50
MemberAlex Dunlop3-Feb-21 6:50 
QuestionTrying to use and condition in Linq Query with join and on C# Pin
simpledeveloper1-Feb-21 21:04
Membersimpledeveloper1-Feb-21 21:04 
QuestionWhat queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
arnold_w29-Jan-21 22:58
Memberarnold_w29-Jan-21 22:58 
I have a number of devices with Com ports (UART:s running at MBaud speeds) that I need to monitor and make sense of. The devices send ASCII-strings with information about what's going on and I need to log this information on the screen row-by-row as the strings arrive (one row per port_DataReceived event). I would also like to get a timestamp when each string arrives and log the timestamp in the leftmost part of the row and the time elapsed since previous row just to the right of the timestamp. The following requirements apply:

a) The GUI must have a checkbox with the text "Auto-scroll". When unchecked, I should be able to scroll among the already written rows.
b) The GUI must have a "Clear Log Window" button, which clears the log the window when pressed, even if data logging is ongoing (of course, the very next microsecond after the button is pressed, new data has arrived and will be put in the first row again).
c) The bulk of the code must be written in C# (with no WPF). However, simple event handlers, such as button event and checkbox-changed handlers, with very little code inside them are ok in other langugages as well.
d) Must show the data in columns that can easily be read, either in a table or something supporting equal width characters (e.g. Courier New font).
e) If it's not Excel, then it should easy to copy-and-paste into Excel for further in-depth analysis.
f) The timestamp should be as accurate as possible, i.e. I want to exit the interrupt routines asap in order to not block interrupts from other Com port.
g) Must be able to show text in different colors.
h) Must be able to show more than 65535 characters.

My questions are:
A. What queuing technique should I use to ensure that I stay as little times as possible in the port_DataReceived(object sender, SerialDataReceivedEventArgs e) event handler? Can I use a simple backgroundWorker (Threading in C# - Part 3 - Using Threads[^], basically queuing addRowToLogWindow-tasks) or is there a faster/better approach?
B. What GUI component should I use to display the data in? I've considered the following:

1. Directly in the Visual Studio Output window: I don't know how to implement the "Auto-scroll" checkbox and "Clear Log Window" button. Also, there seems to come other unwanted data in this window as well (exceptions, threads are terminated, etc).
2. In a console window (cmd.exe): I don't know how to implement the "Auto-scroll" checkbox and "Clear Log Window" button.
3. A multiline TextBox: I don't know how to support equal character width and text in different color.
4. Self-containing Excel: I'm under heavy time constraints and don't have time to learn VBA.
5. Excel controlled from a C# application: I don't know how to make the VBA-event handlers for the "Auto-scroll" checkbox and "Clear Log Window" button to signal back those event to the C# application. Also, I foresee problems how to implement the addRowToLogWindow, how does the C# application know which row is the last row (I don't think I can just append a row in the end, like a multiline TextBox or a DataGridView support). If auto-scrolling is turned off, the user could possibly have deleted a few rows, so a lastAppendedRow-variable in the C# application wouldn't work.
6. DataGridView: My experience is that they are slow and I would need to implement my own copy-to-clipboard function (but it shouldn't be very difficult).
7. RichTextBox: This seems to be the winner, unless I've overlooked something.

Does anybody have any comments/suggestions?
AnswerRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
Richard MacCutchan29-Jan-21 23:19
mveRichard MacCutchan29-Jan-21 23:19 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
arnold_w30-Jan-21 0:31
Memberarnold_w30-Jan-21 0:31 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
Richard MacCutchan30-Jan-21 0:32
mveRichard MacCutchan30-Jan-21 0:32 
AnswerRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
OriginalGriff29-Jan-21 23:25
mveOriginalGriff29-Jan-21 23:25 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
arnold_w30-Jan-21 1:00
Memberarnold_w30-Jan-21 1:00 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
OriginalGriff30-Jan-21 1:17
mveOriginalGriff30-Jan-21 1:17 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
arnold_w30-Jan-21 1:27
Memberarnold_w30-Jan-21 1:27 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
OriginalGriff30-Jan-21 1:58
mveOriginalGriff30-Jan-21 1:58 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
arnold_w30-Jan-21 2:02
Memberarnold_w30-Jan-21 2:02 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
OriginalGriff30-Jan-21 2:39
mveOriginalGriff30-Jan-21 2:39 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
arnold_w30-Jan-21 2:50
Memberarnold_w30-Jan-21 2:50 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
OriginalGriff30-Jan-21 5:45
mveOriginalGriff30-Jan-21 5:45 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
Gerry Schmitz30-Jan-21 3:04
mveGerry Schmitz30-Jan-21 3:04 
JokeRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
Peter_in_278030-Jan-21 10:39
professionalPeter_in_278030-Jan-21 10:39 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
Gerry Schmitz30-Jan-21 12:29
mveGerry Schmitz30-Jan-21 12:29 
AnswerRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
Ralf Meier29-Jan-21 23:25
professionalRalf Meier29-Jan-21 23:25 
GeneralRe: What queuing technique and GUI component should I choose for my multi-comport, receive-only terminal software? Pin
OriginalGriff29-Jan-21 23:57
mveOriginalGriff29-Jan-21 23:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.