Skip to content

Commit

Permalink
Need to fix DeleteRow from annoRefView
Browse files Browse the repository at this point in the history
  • Loading branch information
tuandnvn committed Jul 10, 2018
1 parent 12a822d commit 2ed4c3a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions Annotator/LinkEventForm.Designer.cs

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

2 changes: 1 addition & 1 deletion Annotator/LinkEventForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private void linkToEventIdComboBox_SelectedIndexChanged(object sender, EventArgs

private void addLinkEventBtn_Click(object sender, EventArgs e)
{
Event selectedEvent = allEvents.Find(x => x.id == (string)linkToEventIdComboBox.SelectedItem);
Event selectedEvent = allEvents.Find(x => x.id == (string) linkToEventIdComboBox.SelectedItem);
var selectedLinkType = linkEventTypeComboBox.SelectedItem;
if (selectedEvent != null && linkEventTypeComboBox.SelectedItem != null)
{
Expand Down
23 changes: 14 additions & 9 deletions Annotator/Main.Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ internal void findObjectForEvent(Event ev)
ev.addTempoReference(o.Item1, o.Item2, o.Item3);
addRightBottomTableReference(o.Item1, o.Item2, annotationText.Substring(o.Item1, o.Item2 - o.Item1), o.Item3);
}

this.logSession($"{foundObjects.Count} event references are added.");
}

private void addEventToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -179,20 +181,18 @@ private void annotationText_MouseDown(object sender, MouseEventArgs e)
}
}

private void AnnoRefView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
{
if (selectedEvent != null && mapFromEventToEventAnnotations.ContainsKey(selectedEvent))
{
mapFromEventToEventAnnotations[selectedEvent].deleteTempoEventParticipantByRowIndex(e.Row.Index);
}
}

internal void linkSubEvent(Event ev)
{
LinkEventForm linkEventForm = new LinkEventForm();
linkEventForm.populate(ev, currentSession.events);
linkEventForm.StartPosition = FormStartPosition.CenterParent;
linkEventForm.ShowDialog(this);
DialogResult result = linkEventForm.ShowDialog(this);

// We bind DialogResult = OK to Add button
if (result == DialogResult.OK)
{
logSession($"Add a link for event {ev.id}");
}
}

private void annoRefView_CellClick(object sender, DataGridViewCellEventArgs e)
Expand All @@ -210,6 +210,11 @@ private void annoRefView_CellClick(object sender, DataGridViewCellEventArgs e)
private void annoRefView_UserDeletedRow(object sender, DataGridViewRowEventArgs e)
{
Console.WriteLine("annoRefView_UserDeletedRow");

if (selectedEvent != null && mapFromEventToEventAnnotations.ContainsKey(selectedEvent))
{
mapFromEventToEventAnnotations[selectedEvent].deleteTempoEventParticipantByRowIndex(e.Row.Index);
}
}
}
}

0 comments on commit 2ed4c3a

Please sign in to comment.