[GUI] Refactor LongSectorChecked property logic in ViewSectorViewModel

This commit is contained in:
2025-10-27 02:44:40 +00:00
parent caa263199d
commit bf318b38c3

View File

@@ -50,8 +50,6 @@ public sealed partial class ViewSectorViewModel : ViewModelBase
string _printHexText; string _printHexText;
double _sectorNumber; double _sectorNumber;
[ObservableProperty] [ObservableProperty]
string _title;
[ObservableProperty]
string _totalSectorsText; string _totalSectorsText;
// TODO: Show message when sector was not dumped // TODO: Show message when sector was not dumped
@@ -61,13 +59,27 @@ public sealed partial class ViewSectorViewModel : ViewModelBase
ErrorNumber errno = inputFormat.ReadSectorLong(0, false, out _, out _); ErrorNumber errno = inputFormat.ReadSectorLong(0, false, out _, out _);
if(errno == ErrorNumber.NoError) LongSectorVisible = errno == ErrorNumber.NoError;
LongSectorChecked = true; TotalSectorsText = $"of {inputFormat.Info.Sectors}";
else SectorNumber = 0;
LongSectorVisible = false; }
TotalSectorsText = $"of {inputFormat.Info.Sectors}"; public bool LongSectorChecked
SectorNumber = 0; {
get => _longSectorChecked;
set
{
SetProperty(ref _longSectorChecked, value);
ErrorNumber errno = LongSectorChecked
? _inputFormat.ReadSectorLong((ulong)SectorNumber, false, out byte[] sector, out _)
: _inputFormat.ReadSector((ulong)SectorNumber, false, out sector, out _);
if(errno != ErrorNumber.NoError) return;
SectorData = sector;
ColorSector();
}
} }
public double SectorNumber public double SectorNumber