mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[GUI] Refactor LongSectorChecked property logic in ViewSectorViewModel
This commit is contained in:
@@ -50,8 +50,6 @@ public sealed partial class ViewSectorViewModel : ViewModelBase
|
||||
string _printHexText;
|
||||
double _sectorNumber;
|
||||
[ObservableProperty]
|
||||
string _title;
|
||||
[ObservableProperty]
|
||||
string _totalSectorsText;
|
||||
|
||||
// TODO: Show message when sector was not dumped
|
||||
@@ -61,15 +59,29 @@ public sealed partial class ViewSectorViewModel : ViewModelBase
|
||||
|
||||
ErrorNumber errno = inputFormat.ReadSectorLong(0, false, out _, out _);
|
||||
|
||||
if(errno == ErrorNumber.NoError)
|
||||
LongSectorChecked = true;
|
||||
else
|
||||
LongSectorVisible = false;
|
||||
|
||||
LongSectorVisible = errno == ErrorNumber.NoError;
|
||||
TotalSectorsText = $"of {inputFormat.Info.Sectors}";
|
||||
SectorNumber = 0;
|
||||
}
|
||||
|
||||
public bool LongSectorChecked
|
||||
{
|
||||
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
|
||||
{
|
||||
get => _sectorNumber;
|
||||
|
||||
Reference in New Issue
Block a user