Skip to content

Commit

Permalink
Merge pull request #5 from svethi/master
Browse files Browse the repository at this point in the history
add check for free space to insert an entry
  • Loading branch information
mr-manuel authored Jun 22, 2024
2 parents fcb3a81 + 830944c commit 75a40ea
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions LoxStatFileForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,18 @@ private void mnuInsertEntry_Click(object sender, EventArgs e)
} else
{
beforeDP = _loxStatFile.DataPoints[atDP.Index - 2];
newDP = beforeDP.Clone();
newDP.Index = atInsert.Index;
newDP.Timestamp = beforeDP.Timestamp.AddHours(1);
_dataGridView.Rows.Insert(atInsert.Index-1, newRow);
_loxStatFile.DataPoints.Insert(atInsert.Index-1, newDP);
if (beforeDP.Timestamp < atDP.Timestamp.AddMinutes(-119))
{
newDP = beforeDP.Clone();
newDP.Index = atInsert.Index;
newDP.Timestamp = beforeDP.Timestamp.AddHours(1);
_dataGridView.Rows.Insert(atInsert.Index - 1, newRow);
_loxStatFile.DataPoints.Insert(atInsert.Index - 1, newDP);
} else
{
MessageBox.Show("There is not place to insert an entry! You should delete an entry first?!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

}
Cursor = Cursors.Default;
}
Expand Down

0 comments on commit 75a40ea

Please sign in to comment.