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;
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user