예제 #1
0
        public void PositionChanged_Event()
        {
            var hv = new HexView(LoadStream())
            {
                Width = Dim.Fill(), Height = Dim.Fill()
            };

            HexView.HexViewEventArgs hexViewEventArgs = null;
            hv.PositionChanged += (e) => hexViewEventArgs = e;
            Application.Top.Add(hv);
            Application.Begin(Application.Top);

            Assert.True(hv.ProcessKey(new KeyEvent(Key.CursorRight, new KeyModifiers())));                 // left side must press twice
            Assert.True(hv.ProcessKey(new KeyEvent(Key.CursorRight, new KeyModifiers())));
            Assert.True(hv.ProcessKey(new KeyEvent(Key.CursorDown, new KeyModifiers())));

            Assert.Equal(12, hexViewEventArgs.BytesPerLine);
            Assert.Equal(new Point(2, 2), hexViewEventArgs.CursorPosition);
            Assert.Equal(14, hexViewEventArgs.Position);
        }
예제 #2
0
 private void _hexView_PositionChanged(HexView.HexViewEventArgs obj)
 {
     siPositionChanged.Title = $"Position: {obj.Position} Line: {obj.CursorPosition.Y} Col: {obj.CursorPosition.X} Line length: {obj.BytesPerLine}";
     statusBar.SetNeedsDisplay();
 }