abbaye / WpfHexEditorControl

Wpf Hexeditor is a powerful and fully customisable user control for editing file or stream as hexadecimal, decimal and binary. Can be used in Wpf or WinForm application
https://www.nuget.org/packages/WPFHexaEditor/
Apache License 2.0
812 stars 135 forks source link

Delay when maximizing on .NET 5 #90

Closed binarycow closed 3 years ago

binarycow commented 3 years ago

Describe the bug Delay when maximizing on .NET 5

Edit: Also happens when zooming in/out with mouse wheel

To Reproduce Steps to reproduce the behavior:

  1. Load 16MB file
  2. Maximize window - Delay of about 3 seconds before window actually resizes

Expected behavior

  1. Window should resize instantly (or close to it)

Versions

<Window x:Class="HexEditor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HexEditor" 
        xmlns:control="clr-namespace:WpfHexaEditor;assembly=WPFHexaEditor"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <control:HexEditor FileName="{Binding Filename}" />
    </Grid>
</Window>
abbaye commented 3 years ago

Thank for reports,

I have a solution. I will implement today if I have the time :)

Thank for reporting

abbaye commented 3 years ago

Fixed :)

Get the last code and set the control property :

PreloadByteInEditorMode = PreloadByteInEditor.MaxScreenVisibleLine.

by default the property is set to PreloadByteInEditor.None

Please give me a feedback

binarycow commented 3 years ago

@abbaye - That's much faster.

Note: It's quite slow for the initial load. 16 MB file. Like, 5-10 seconds.

abbaye commented 3 years ago

The file is not long to load but the all ByteControl at first time.

You can select the preload mode via the property PreloadByteInEditor :)

binarycow commented 3 years ago

So,

PreloadByteInEditor.MaxScreenVisibleLine fixes the screen maximizing delay

What would be the best value to use to fix the screen maximizing delay, but also won't take too long for initial load?

abbaye commented 3 years ago

MaxScreenVisibleLine is the most appropriate but it's have a cost on the first load only.

I will add another value in PreLoadByteInEditor...I think I can make the load in two times like (Load max visible line first, after at first file load... Load maxScreen line. I will make some test

I will come back tomorrow with a solution

binarycow commented 3 years ago

👍 Thanks for the help!

abbaye commented 3 years ago

Thank to you ! It's with come back issues that I can optimize the control :)

abbaye commented 3 years ago

Give me a feedback when possible

please test the new MaxStreenVisibileLineAtDataLoad