Пример #1
0
        static void ExecuteInternal(DnHexBox dnHexBox)
        {
            if (dnHexBox == null)
            {
                return;
            }
            ulong start = dnHexBox.CaretPosition.Offset;
            ulong end   = start;

            if (dnHexBox.Selection != null)
            {
                start = dnHexBox.Selection.Value.StartOffset;
                end   = dnHexBox.Selection.Value.EndOffset;
            }
            var data = new SelectVM(dnHexBox.PhysicalToVisibleOffset(start), dnHexBox.PhysicalToVisibleOffset(end), dnHexBox.PhysicalToVisibleOffset(dnHexBox.StartOffset), dnHexBox.PhysicalToVisibleOffset(dnHexBox.EndOffset));
            var win  = new SelectDlg();

            win.DataContext = data;
            win.Owner       = MainWindow.Instance;
            if (win.ShowDialog() != true)
            {
                return;
            }

            dnHexBox.Selection     = new HexSelection(dnHexBox.VisibleToPhysicalOffset(data.EndVM.Value), dnHexBox.VisibleToPhysicalOffset(data.StartVM.Value));
            dnHexBox.CaretPosition = new HexBoxPosition(dnHexBox.VisibleToPhysicalOffset(data.StartVM.Value), dnHexBox.CaretPosition.Kind, 0);
        }
Пример #2
0
		static void ExecuteInternal(DnHexBox dnHexBox) {
			if (dnHexBox == null)
				return;
			ulong start = dnHexBox.CaretPosition.Offset;
			ulong end = start;
			if (dnHexBox.Selection != null) {
				start = dnHexBox.Selection.Value.StartOffset;
				end = dnHexBox.Selection.Value.EndOffset;
			}
			var data = new SelectVM(dnHexBox.PhysicalToVisibleOffset(start), dnHexBox.PhysicalToVisibleOffset(end), dnHexBox.PhysicalToVisibleOffset(dnHexBox.StartOffset), dnHexBox.PhysicalToVisibleOffset(dnHexBox.EndOffset));
			var win = new SelectDlg();
			win.DataContext = data;
			win.Owner = MainWindow.Instance;
			if (win.ShowDialog() != true)
				return;

			dnHexBox.Selection = new HexSelection(dnHexBox.VisibleToPhysicalOffset(data.EndVM.Value), dnHexBox.VisibleToPhysicalOffset(data.StartVM.Value));
			dnHexBox.CaretPosition = new HexBoxPosition(dnHexBox.VisibleToPhysicalOffset(data.StartVM.Value), dnHexBox.CaretPosition.Kind, 0);
		}