Skip to content

Commit

Permalink
Bugfix : event are now attached correctly when BuildDataLine called
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Tremblay committed Aug 27, 2017
1 parent a6dfbbe commit 9964af4
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions WPFHexaEditor.Control/HexaEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,27 @@ private void BuildDataLines(int maxline, bool rebuild = false)
if (reAttachEvents)
TraverseStringAndDataControls(ctrl =>
{
//Detach events
ctrl.ByteModified -= Control_ByteModified;
ctrl.MoveNext -= Control_MoveNext;
ctrl.MovePrevious -= Control_MovePrevious;
ctrl.MouseSelection -= Control_MouseSelection;
ctrl.Click -= Control_Click;
ctrl.RightClick -= Control_RightClick;
ctrl.MoveUp -= Control_MoveUp;
ctrl.MoveDown -= Control_MoveDown;
ctrl.MoveLeft -= Control_MoveLeft;
ctrl.MoveRight -= Control_MoveRight;
ctrl.MovePageDown -= Control_MovePageDown;
ctrl.MovePageUp -= Control_MovePageUp;
ctrl.ByteDeleted -= Control_ByteDeleted;
ctrl.EscapeKey -= Control_EscapeKey;
ctrl.CTRLAKey -= Control_CTRLAKey;
ctrl.CTRLZKey -= Control_CTRLZKey;
ctrl.CTRLCKey -= Control_CTRLCKey;
ctrl.CTRLVKey -= Control_CTRLVKey;
//Attach events
ctrl.ByteModified += Control_ByteModified;
ctrl.MoveNext += Control_MoveNext;
ctrl.MovePrevious += Control_MovePrevious;
Expand Down Expand Up @@ -2266,11 +2287,9 @@ private void UpdateDataViewers(bool ControlResize)
#endregion
}

if (LinesInfoStackPanel.Children.Count == 0)
{
if (LinesInfoStackPanel.Children.Count == 0)
return;
}


var firstInfoLabel = LinesInfoStackPanel.Children[0] as TextBlock;
var startPosition = ByteConverters.HexLiteralToLong(firstInfoLabel.Text);
var sizeReadyToRead = LinesInfoStackPanel.Children.Count * BytePerLine + 1;
Expand Down

0 comments on commit 9964af4

Please sign in to comment.