Skip to content

Commit

Permalink
v0.5-beta
Browse files Browse the repository at this point in the history
Fixed empty rows, added column, added clear table button. More stability.
  • Loading branch information
Ryan Hall authored and Ryan Hall committed Oct 2, 2019
1 parent 0febb1e commit 6120f52
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 32 deletions.
49 changes: 36 additions & 13 deletions Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 29 additions & 19 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ private void ButtonUpdatePorts_Click(object sender, EventArgs e)
InitComboBoxPort();
}

/// <summary>
/// Button clear is used to clear the table so the user does not need to restart to the program
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonClear_Click(object sender, EventArgs e)
{
serialDataGridView.Rows.Clear();
serialDataGridView.Refresh();
currentRow = 0;

}

/// <summary>
/// Baud combo box allows the user to select from predefined baudrates to reduce any user error
/// </summary>
Expand Down Expand Up @@ -146,16 +159,14 @@ private void ComboBoxPort_SelectedIndexChanged(object sender, EventArgs e)
/// </summary>
private void SerialRead()
{
serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);

serialPort.Close();

Debug.WriteLine("Opening Serial Port...");

try //Check if COM port can be opened
{
serialPort.Open();
labelStatusMsg.Text = "Connected to Port : " + serialPort.PortName + " Port";
serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
}
catch (Exception ex) //throw excpetion for not found, alert user and reset butttons
{
Expand All @@ -164,6 +175,7 @@ private void SerialRead()
comboBoxBaud.Enabled = true;
comboBoxPort.Enabled = true;
buttonOptions.Enabled = true;
buttonUpdatePorts.Enabled = true;
serialPort.Close();
Debug.WriteLine(ex);
}
Expand Down Expand Up @@ -198,24 +210,22 @@ private void UpdateHexText(string rawData)
}
else
{
if (buttonPause.Enabled)
char[] charValues = rawData.ToCharArray();
string hexOutput = "";
foreach (char _eachChar in charValues)
{
char[] charValues = rawData.ToCharArray();
string hexOutput = "";
foreach (char _eachChar in charValues)
{
int value = Convert.ToInt32(_eachChar);
hexOutput += String.Format("{0:X} ", value);
}

DataGridViewRow row = (DataGridViewRow)serialDataGridView.Rows[0].Clone();
row.Cells[0].Value = currentRow;
row.Cells[1].Value = hexOutput;
row.Cells[2].Value = rawData;
serialDataGridView.Rows.Add(row);

currentRow++;
int value = Convert.ToInt32(_eachChar);
hexOutput += String.Format("{0:X} ", value);
}

DataGridViewRow row = (DataGridViewRow)serialDataGridView.Rows[0].Clone();
row.Cells[0].Value = currentRow;
row.Cells[1].Value = serialPort.PortName;
row.Cells[2].Value = hexOutput;
row.Cells[3].Value = rawData;
serialDataGridView.Rows.Add(row);

currentRow++;
}
}
catch(Exception ex)
Expand Down
3 changes: 3 additions & 0 deletions Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="ColumnID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnPort.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnHex.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand Down
Binary file modified bin/Debug/SerialSuite.exe
Binary file not shown.
Binary file modified bin/Debug/SerialSuite.pdb
Binary file not shown.
Binary file modified obj/Debug/SerialSuite.csproj.GenerateResource.cache
Binary file not shown.
Binary file modified obj/Debug/SerialSuite.exe
Binary file not shown.
Binary file modified obj/Debug/SerialSuite.pdb
Binary file not shown.

0 comments on commit 6120f52

Please sign in to comment.