Change async void for async Task wherever possible.

This commit is contained in:
2022-03-26 16:52:00 +00:00
parent 1927868706
commit 1c99cb1d09
20 changed files with 172 additions and 153 deletions

View File

@@ -38,6 +38,7 @@ using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Interop;
using Aaru.Console; using Aaru.Console;
using Avalonia.Controls; using Avalonia.Controls;
@@ -64,7 +65,7 @@ public sealed class ConsoleViewModel : ViewModelBase
[NotNull] [NotNull]
public string Title => "Console"; public string Title => "Console";
public ReactiveCommand<Unit, Unit> ClearCommand { get; } public ReactiveCommand<Unit, Unit> ClearCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCommand { get; } public ReactiveCommand<Unit, Task> SaveCommand { get; }
public ObservableCollection<LogEntry> Entries => ConsoleHandler.Entries; public ObservableCollection<LogEntry> Entries => ConsoleHandler.Entries;
[NotNull] [NotNull]
public string DebugText => "Enable debug console"; public string DebugText => "Enable debug console";
@@ -83,7 +84,7 @@ public sealed class ConsoleViewModel : ViewModelBase
} }
} }
async void ExecuteSaveCommand() async Task ExecuteSaveCommand()
{ {
var dlgSave = new SaveFileDialog(); var dlgSave = new SaveFileDialog();

View File

@@ -36,6 +36,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.Decoders.SCSI.SSC; using Aaru.Decoders.SCSI.SSC;
using Aaru.Devices; using Aaru.Devices;
using Aaru.Gui.ViewModels.Tabs; using Aaru.Gui.ViewModels.Tabs;
@@ -375,7 +376,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
}; };
} }
public ReactiveCommand<Unit, Unit> SaveUsbDescriptorsCommand { get; } public ReactiveCommand<Unit, Task> SaveUsbDescriptorsCommand { get; }
public string DeviceType public string DeviceType
{ {
@@ -911,7 +912,7 @@ public sealed class DeviceInfoViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _sdMmcInfo, value); set => this.RaiseAndSetIfChanged(ref _sdMmcInfo, value);
} }
async void ExecuteSaveUsbDescriptorsCommand() async Task ExecuteSaveUsbDescriptorsCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();

View File

@@ -37,6 +37,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Text; using System.Text;
using System.Threading.Tasks;
using Aaru.Gui.ViewModels.Tabs; using Aaru.Gui.ViewModels.Tabs;
using Aaru.Gui.ViewModels.Windows; using Aaru.Gui.ViewModels.Windows;
using Aaru.Gui.Views.Tabs; using Aaru.Gui.Views.Tabs;
@@ -202,16 +203,16 @@ public sealed class MediaInfoViewModel : ViewModelBase
}; };
} }
public ReactiveCommand<Unit, Unit> SaveReadMediaSerialCommand { get; } public ReactiveCommand<Unit, Task> SaveReadMediaSerialCommand { get; }
public ReactiveCommand<Unit, Unit> SaveReadCapacityCommand { get; } public ReactiveCommand<Unit, Task> SaveReadCapacityCommand { get; }
public ReactiveCommand<Unit, Unit> SaveReadCapacity16Command { get; } public ReactiveCommand<Unit, Task> SaveReadCapacity16Command { get; }
public ReactiveCommand<Unit, Unit> SaveGetConfigurationCommand { get; } public ReactiveCommand<Unit, Task> SaveGetConfigurationCommand { get; }
public ReactiveCommand<Unit, Unit> SaveRecognizedFormatLayersCommand { get; } public ReactiveCommand<Unit, Task> SaveRecognizedFormatLayersCommand { get; }
public ReactiveCommand<Unit, Unit> SaveWriteProtectionStatusCommand { get; } public ReactiveCommand<Unit, Task> SaveWriteProtectionStatusCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDensitySupportCommand { get; } public ReactiveCommand<Unit, Task> SaveDensitySupportCommand { get; }
public ReactiveCommand<Unit, Unit> SaveMediumSupportCommand { get; } public ReactiveCommand<Unit, Task> SaveMediumSupportCommand { get; }
public ReactiveCommand<Unit, Unit> DumpCommand { get; } public ReactiveCommand<Unit, Task> DumpCommand { get; }
public ReactiveCommand<Unit, Unit> ScanCommand { get; } public ReactiveCommand<Unit, Task> ScanCommand { get; }
public Bitmap MediaLogo public Bitmap MediaLogo
{ {
@@ -345,7 +346,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _blurayInfo, value); set => this.RaiseAndSetIfChanged(ref _blurayInfo, value);
} }
async void SaveElement(byte[] data) async Task SaveElement(byte[] data)
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -369,23 +370,23 @@ public sealed class MediaInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
void ExecuteSaveReadMediaSerialCommand() => SaveElement(_scsiInfo.MediaSerialNumber); async Task ExecuteSaveReadMediaSerialCommand() => await SaveElement(_scsiInfo.MediaSerialNumber);
void ExecuteSaveReadCapacityCommand() => SaveElement(_scsiInfo.ReadCapacity); async Task ExecuteSaveReadCapacityCommand() => await SaveElement(_scsiInfo.ReadCapacity);
void ExecuteSaveReadCapacity16Command() => SaveElement(_scsiInfo.ReadCapacity16); async Task ExecuteSaveReadCapacity16Command() => await SaveElement(_scsiInfo.ReadCapacity16);
void ExecuteSaveGetConfigurationCommand() => SaveElement(_scsiInfo.MmcConfiguration); async Task ExecuteSaveGetConfigurationCommand() => await SaveElement(_scsiInfo.MmcConfiguration);
void ExecuteSaveRecognizedFormatLayersCommand() => SaveElement(_scsiInfo.RecognizedFormatLayers); async Task ExecuteSaveRecognizedFormatLayersCommand() => await SaveElement(_scsiInfo.RecognizedFormatLayers);
void ExecuteSaveWriteProtectionStatusCommand() => SaveElement(_scsiInfo.WriteProtectionStatus); async Task ExecuteSaveWriteProtectionStatusCommand() => await SaveElement(_scsiInfo.WriteProtectionStatus);
void ExecuteSaveDensitySupportCommand() => SaveElement(_scsiInfo.DensitySupport); async Task ExecuteSaveDensitySupportCommand() => await SaveElement(_scsiInfo.DensitySupport);
void ExecuteSaveMediumSupportCommand() => SaveElement(_scsiInfo.MediaTypeSupport); async Task ExecuteSaveMediumSupportCommand() => await SaveElement(_scsiInfo.MediaTypeSupport);
async void ExecuteDumpCommand() async Task ExecuteDumpCommand()
{ {
if(_scsiInfo.MediaType is CommonTypes.MediaType.GDR or CommonTypes.MediaType.GDROM) if(_scsiInfo.MediaType is CommonTypes.MediaType.GDR or CommonTypes.MediaType.GDROM)
{ {
@@ -415,7 +416,7 @@ public sealed class MediaInfoViewModel : ViewModelBase
mediaDumpWindow.Show(); mediaDumpWindow.Show();
} }
async void ExecuteScanCommand() async Task ExecuteScanCommand()
{ {
switch(_scsiInfo.MediaType) switch(_scsiInfo.MediaType)
{ {

View File

@@ -38,6 +38,7 @@ using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interop; using Aaru.CommonTypes.Interop;
using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs;
@@ -111,9 +112,9 @@ public sealed class SubdirectoryViewModel
public ObservableCollection<FileModel> Entries { get; } public ObservableCollection<FileModel> Entries { get; }
public List<FileModel> SelectedEntries { get; } public List<FileModel> SelectedEntries { get; }
public ReactiveCommand<Unit, Unit> ExtractFilesCommand { get; } public ReactiveCommand<Unit, Task> ExtractFilesCommand { get; }
async void ExecuteExtractFilesCommand() async Task ExecuteExtractFilesCommand()
{ {
if(SelectedEntries.Count == 0) if(SelectedEntries.Count == 0)
return; return;

View File

@@ -35,6 +35,7 @@ namespace Aaru.Gui.ViewModels.Tabs;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.Decoders.ATA; using Aaru.Decoders.ATA;
using Avalonia.Controls; using Avalonia.Controls;
using JetBrains.Annotations; using JetBrains.Annotations;
@@ -118,12 +119,12 @@ public sealed class AtaInfoViewModel : ViewModelBase
public bool AtaMcptChecked { get; } public bool AtaMcptChecked { get; }
public bool AtaMcptWriteProtectionChecked { get; } public bool AtaMcptWriteProtectionChecked { get; }
public bool AtaMcptVisible { get; } public bool AtaMcptVisible { get; }
public ReactiveCommand<Unit, Unit> SaveAtaBinaryCommand { get; } public ReactiveCommand<Unit, Task> SaveAtaBinaryCommand { get; }
public ReactiveCommand<Unit, Unit> SaveAtaTextCommand { get; } public ReactiveCommand<Unit, Task> SaveAtaTextCommand { get; }
public string AtaOrAtapiText { get; } public string AtaOrAtapiText { get; }
async void ExecuteSaveAtaBinaryCommand() async Task ExecuteSaveAtaBinaryCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -151,7 +152,7 @@ public sealed class AtaInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveAtaTextCommand() async Task ExecuteSaveAtaTextCommand()
{ {
var dlgSaveText = new SaveFileDialog(); var dlgSaveText = new SaveFileDialog();

View File

@@ -35,6 +35,7 @@ namespace Aaru.Gui.ViewModels.Tabs;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.Decoders.Bluray; using Aaru.Decoders.Bluray;
using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.MMC;
using Avalonia.Controls; using Avalonia.Controls;
@@ -135,15 +136,15 @@ public sealed class BlurayInfoViewModel
public string BluraySpareAreaInformationText { get; } public string BluraySpareAreaInformationText { get; }
public string BlurayPowResourcesText { get; } public string BlurayPowResourcesText { get; }
public string BlurayTrackResourcesText { get; } public string BlurayTrackResourcesText { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayDiscInformationCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayDiscInformationCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayBurstCuttingAreaCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayBurstCuttingAreaCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayDdsCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayDdsCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayCartridgeStatusCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayCartridgeStatusCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBluraySpareAreaInformationCommand { get; } public ReactiveCommand<Unit, Task> SaveBluraySpareAreaInformationCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayPowResourcesCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayPowResourcesCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayTrackResourcesCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayTrackResourcesCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayRawDflCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayRawDflCommand { get; }
public ReactiveCommand<Unit, Unit> SaveBlurayPacCommand { get; } public ReactiveCommand<Unit, Task> SaveBlurayPacCommand { get; }
public bool SaveBlurayDiscInformationVisible { get; } public bool SaveBlurayDiscInformationVisible { get; }
public bool SaveBlurayBurstCuttingAreaVisible { get; } public bool SaveBlurayBurstCuttingAreaVisible { get; }
public bool SaveBlurayDdsVisible { get; } public bool SaveBlurayDdsVisible { get; }
@@ -154,7 +155,7 @@ public sealed class BlurayInfoViewModel
public bool SaveBlurayRawDflVisible { get; } public bool SaveBlurayRawDflVisible { get; }
public bool SaveBlurayPacVisible { get; } public bool SaveBlurayPacVisible { get; }
async void SaveElement(byte[] data) async Task SaveElement(byte[] data)
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -178,21 +179,21 @@ public sealed class BlurayInfoViewModel
saveFs.Close(); saveFs.Close();
} }
void ExecuteSaveBlurayDiscInformationCommand() => SaveElement(_discInformation); async Task ExecuteSaveBlurayDiscInformationCommand() => await SaveElement(_discInformation);
void ExecuteSaveBlurayBurstCuttingAreaCommand() => SaveElement(_burstCuttingArea); async Task ExecuteSaveBlurayBurstCuttingAreaCommand() => await SaveElement(_burstCuttingArea);
void ExecuteSaveBlurayDdsCommand() => SaveElement(_dds); async Task ExecuteSaveBlurayDdsCommand() => await SaveElement(_dds);
void ExecuteSaveBlurayCartridgeStatusCommand() => SaveElement(_cartridgeStatus); async Task ExecuteSaveBlurayCartridgeStatusCommand() => await SaveElement(_cartridgeStatus);
void ExecuteSaveBluraySpareAreaInformationCommand() => SaveElement(_spareAreaInformation); async Task ExecuteSaveBluraySpareAreaInformationCommand() => await SaveElement(_spareAreaInformation);
void ExecuteSaveBlurayPowResourcesCommand() => SaveElement(_powResources); async Task ExecuteSaveBlurayPowResourcesCommand() => await SaveElement(_powResources);
void ExecuteSaveBlurayTrackResourcesCommand() => SaveElement(_trackResources); async Task ExecuteSaveBlurayTrackResourcesCommand() => await SaveElement(_trackResources);
void ExecuteSaveBlurayRawDflCommand() => SaveElement(_rawDfl); async Task ExecuteSaveBlurayRawDflCommand() => await SaveElement(_rawDfl);
void ExecuteSaveBlurayPacCommand() => SaveElement(_pac); async Task ExecuteSaveBlurayPacCommand() => await SaveElement(_pac);
} }

View File

@@ -36,6 +36,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.Decoders.CD; using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.MMC;
using Aaru.Gui.Models; using Aaru.Gui.Models;
@@ -120,16 +121,16 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
public bool MiscellaneousVisible { get; } public bool MiscellaneousVisible { get; }
public string McnText { get; } public string McnText { get; }
public bool CdPmaVisible { get; } public bool CdPmaVisible { get; }
public ReactiveCommand<Unit, Unit> SaveCdInformationCommand { get; } public ReactiveCommand<Unit, Task> SaveCdInformationCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdTocCommand { get; } public ReactiveCommand<Unit, Task> SaveCdTocCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdFullTocCommand { get; } public ReactiveCommand<Unit, Task> SaveCdFullTocCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdSessionCommand { get; } public ReactiveCommand<Unit, Task> SaveCdSessionCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdTextCommand { get; } public ReactiveCommand<Unit, Task> SaveCdTextCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdAtipCommand { get; } public ReactiveCommand<Unit, Task> SaveCdAtipCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdPmaCommand { get; } public ReactiveCommand<Unit, Task> SaveCdPmaCommand { get; }
public ObservableCollection<IsrcModel> IsrcList { get; } public ObservableCollection<IsrcModel> IsrcList { get; }
async void ExecuteSaveCdInformationCommand() async Task ExecuteSaveCdInformationCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -153,7 +154,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveCdTocCommand() async Task ExecuteSaveCdTocCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -177,7 +178,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveCdFullTocCommand() async Task ExecuteSaveCdFullTocCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -201,7 +202,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveCdSessionCommand() async Task ExecuteSaveCdSessionCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -225,7 +226,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveCdTextCommand() async Task ExecuteSaveCdTextCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -249,7 +250,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveCdAtipCommand() async Task ExecuteSaveCdAtipCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -273,7 +274,7 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveCdPmaCommand() async Task ExecuteSaveCdPmaCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();

View File

@@ -35,6 +35,7 @@ namespace Aaru.Gui.ViewModels.Tabs;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.Decoders.DVD; using Aaru.Decoders.DVD;
using Avalonia.Controls; using Avalonia.Controls;
@@ -102,12 +103,12 @@ public sealed class DvdInfoViewModel
SaveDvdAacsVisible = aacs != null; SaveDvdAacsVisible = aacs != null;
} }
public ReactiveCommand<Unit, Unit> SaveDvdPfiCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdPfiCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdDmiCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdDmiCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdCmiCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdCmiCommand { get; }
public ReactiveCommand<Unit, Unit> SaveHdDvdCmiCommand { get; } public ReactiveCommand<Unit, Task> SaveHdDvdCmiCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdBcaCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdBcaCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdAacsCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdAacsCommand { get; }
public string DvdPfiText { get; } public string DvdPfiText { get; }
public string DvdCmiText { get; } public string DvdCmiText { get; }
public bool SaveDvdPfiVisible { get; } public bool SaveDvdPfiVisible { get; }
@@ -117,7 +118,7 @@ public sealed class DvdInfoViewModel
public bool SaveDvdBcaVisible { get; } public bool SaveDvdBcaVisible { get; }
public bool SaveDvdAacsVisible { get; } public bool SaveDvdAacsVisible { get; }
async void SaveElement(byte[] data) async Task SaveElement(byte[] data)
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -141,15 +142,15 @@ public sealed class DvdInfoViewModel
saveFs.Close(); saveFs.Close();
} }
void ExecuteSaveDvdPfiCommand() => SaveElement(_dvdPfi); async Task ExecuteSaveDvdPfiCommand() => await SaveElement(_dvdPfi);
void ExecuteSaveDvdDmiCommand() => SaveElement(_dvdDmi); async Task ExecuteSaveDvdDmiCommand() => await SaveElement(_dvdDmi);
void ExecuteSaveDvdCmiCommand() => SaveElement(_dvdCmi); async Task ExecuteSaveDvdCmiCommand() => await SaveElement(_dvdCmi);
void ExecuteSaveHdDvdCmiCommand() => SaveElement(_hddvdCopyrightInformation); async Task ExecuteSaveHdDvdCmiCommand() => await SaveElement(_hddvdCopyrightInformation);
void ExecuteSaveDvdBcaCommand() => SaveElement(_dvdBca); async Task ExecuteSaveDvdBcaCommand() => await SaveElement(_dvdBca);
void ExecuteSaveDvdAacsCommand() => SaveElement(_dvdAacs); async Task ExecuteSaveDvdAacsCommand() => await SaveElement(_dvdAacs);
} }

View File

@@ -35,6 +35,7 @@ namespace Aaru.Gui.ViewModels.Tabs;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.Decoders.DVD; using Aaru.Decoders.DVD;
using Avalonia.Controls; using Avalonia.Controls;
@@ -215,24 +216,24 @@ public sealed class DvdWritableInfoViewModel
public bool SaveDvdrDlRemapAnchorPointVisible { get; } public bool SaveDvdrDlRemapAnchorPointVisible { get; }
public bool SaveDvdPlusAdipVisible { get; } public bool SaveDvdPlusAdipVisible { get; }
public bool SaveDvdPlusDcbVisible { get; } public bool SaveDvdPlusDcbVisible { get; }
public ReactiveCommand<Unit, Unit> SaveDvdRamDdsCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdRamDdsCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdRamCartridgeStatusCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdRamCartridgeStatusCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdRamSpareAreaInformationCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdRamSpareAreaInformationCommand { get; }
public ReactiveCommand<Unit, Unit> SaveLastBorderOutRmdCommand { get; } public ReactiveCommand<Unit, Task> SaveLastBorderOutRmdCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdPreRecordedInfoCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdPreRecordedInfoCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdrMediaIdentifierCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdrMediaIdentifierCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdrPhysicalInformationCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdrPhysicalInformationCommand { get; }
public ReactiveCommand<Unit, Unit> SaveHddvdrMediumStatusCommand { get; } public ReactiveCommand<Unit, Task> SaveHddvdrMediumStatusCommand { get; }
public ReactiveCommand<Unit, Unit> SaveHddvdrLastRmdCommand { get; } public ReactiveCommand<Unit, Task> SaveHddvdrLastRmdCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdrLayerCapacityCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdrLayerCapacityCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdrDlMiddleZoneStartCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdrDlMiddleZoneStartCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdrDlJumpIntervalSizeCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdrDlJumpIntervalSizeCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdrDlManualLayerJumpStartLbaCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdrDlManualLayerJumpStartLbaCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdrDlRemapAnchorPointCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdrDlRemapAnchorPointCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdPlusAdipCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdPlusAdipCommand { get; }
public ReactiveCommand<Unit, Unit> SaveDvdPlusDcbCommand { get; } public ReactiveCommand<Unit, Task> SaveDvdPlusDcbCommand { get; }
async void SaveElement(byte[] data) async Task SaveElement(byte[] data)
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -256,35 +257,35 @@ public sealed class DvdWritableInfoViewModel
saveFs.Close(); saveFs.Close();
} }
void ExecuteSaveDvdRamDdsCommand() => SaveElement(_dvdRamDds); async Task ExecuteSaveDvdRamDdsCommand() => await SaveElement(_dvdRamDds);
void ExecuteSaveDvdRamCartridgeStatusCommand() => SaveElement(_dvdRamCartridgeStatus); async Task ExecuteSaveDvdRamCartridgeStatusCommand() => await SaveElement(_dvdRamCartridgeStatus);
void ExecuteSaveDvdRamSpareAreaInformationCommand() => SaveElement(_dvdRamSpareArea); async Task ExecuteSaveDvdRamSpareAreaInformationCommand() => await SaveElement(_dvdRamSpareArea);
void ExecuteSaveLastBorderOutRmdCommand() => SaveElement(_dvdLastBorderOutRmd); async Task ExecuteSaveLastBorderOutRmdCommand() => await SaveElement(_dvdLastBorderOutRmd);
void ExecuteSaveDvdPreRecordedInfoCommand() => SaveElement(_dvdPreRecordedInfo); async Task ExecuteSaveDvdPreRecordedInfoCommand() => await SaveElement(_dvdPreRecordedInfo);
void ExecuteSaveDvdrMediaIdentifierCommand() => SaveElement(_dvdrMediaIdentifier); async Task ExecuteSaveDvdrMediaIdentifierCommand() => await SaveElement(_dvdrMediaIdentifier);
void ExecuteSaveDvdrPhysicalInformationCommand() => SaveElement(_dvdrPhysicalInformation); async Task ExecuteSaveDvdrPhysicalInformationCommand() => await SaveElement(_dvdrPhysicalInformation);
void ExecuteSaveHddvdrMediumStatusCommand() => SaveElement(_hddvdrMediumStatus); async Task ExecuteSaveHddvdrMediumStatusCommand() => await SaveElement(_hddvdrMediumStatus);
void ExecuteSaveHddvdrLastRmdCommand() => SaveElement(_hddvdrLastRmd); async Task ExecuteSaveHddvdrLastRmdCommand() => await SaveElement(_hddvdrLastRmd);
void ExecuteSaveDvdrLayerCapacityCommand() => SaveElement(_dvdrLayerCapacity); async Task ExecuteSaveDvdrLayerCapacityCommand() => await SaveElement(_dvdrLayerCapacity);
void ExecuteSaveDvdrDlMiddleZoneStartCommand() => SaveElement(_dvdrDlMiddleZoneStart); async Task ExecuteSaveDvdrDlMiddleZoneStartCommand() => await SaveElement(_dvdrDlMiddleZoneStart);
void ExecuteSaveDvdrDlJumpIntervalSizeCommand() => SaveElement(_dvdrDlJumpIntervalSize); async Task ExecuteSaveDvdrDlJumpIntervalSizeCommand() => await SaveElement(_dvdrDlJumpIntervalSize);
void ExecuteSaveDvdrDlManualLayerJumpStartLbaCommand() => SaveElement(_dvdrDlManualLayerJumpStartLba); async Task ExecuteSaveDvdrDlManualLayerJumpStartLbaCommand() => await SaveElement(_dvdrDlManualLayerJumpStartLba);
void ExecuteSaveDvdrDlRemapAnchorPointCommand() => SaveElement(_dvdrDlRemapAnchorPoint); async Task ExecuteSaveDvdrDlRemapAnchorPointCommand() => await SaveElement(_dvdrDlRemapAnchorPoint);
void ExecuteSaveDvdPlusAdipCommand() => SaveElement(_dvdPlusAdip); async Task ExecuteSaveDvdPlusAdipCommand() => await SaveElement(_dvdPlusAdip);
void ExecuteSaveDvdPlusDcbCommand() => SaveElement(_dvdPlusDcb); async Task ExecuteSaveDvdPlusDcbCommand() => await SaveElement(_dvdPlusDcb);
} }

View File

@@ -36,6 +36,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.Console; using Aaru.Console;
using Aaru.Decoders.PCMCIA; using Aaru.Decoders.PCMCIA;
using Aaru.Gui.Models; using Aaru.Gui.Models;
@@ -165,9 +166,9 @@ public class PcmciaInfoViewModel : ViewModelBase
} }
} }
public ReactiveCommand<Unit, Unit> SavePcmciaCisCommand { get; } public ReactiveCommand<Unit, Task> SavePcmciaCisCommand { get; }
async void ExecuteSavePcmciaCisCommand() async Task ExecuteSavePcmciaCisCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();

View File

@@ -37,6 +37,7 @@ using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console; using Aaru.Console;
using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI;
@@ -898,12 +899,12 @@ public sealed class ScsiInfoViewModel : ViewModelBase
public ObservableCollection<ScsiPageModel> ModeSensePages { get; } public ObservableCollection<ScsiPageModel> ModeSensePages { get; }
public ObservableCollection<ScsiPageModel> EvpdPages { get; } public ObservableCollection<ScsiPageModel> EvpdPages { get; }
public ObservableCollection<ScsiPageModel> MmcFeatures { get; } public ObservableCollection<ScsiPageModel> MmcFeatures { get; }
public ReactiveCommand<Unit, Unit> SaveInquiryBinaryCommand { get; } public ReactiveCommand<Unit, Task> SaveInquiryBinaryCommand { get; }
public ReactiveCommand<Unit, Unit> SaveInquiryTextCommand { get; } public ReactiveCommand<Unit, Task> SaveInquiryTextCommand { get; }
public ReactiveCommand<Unit, Unit> SaveModeSense6Command { get; } public ReactiveCommand<Unit, Task> SaveModeSense6Command { get; }
public ReactiveCommand<Unit, Unit> SaveModeSense10Command { get; } public ReactiveCommand<Unit, Task> SaveModeSense10Command { get; }
public ReactiveCommand<Unit, Unit> SaveEvpdPageCommand { get; } public ReactiveCommand<Unit, Task> SaveEvpdPageCommand { get; }
public ReactiveCommand<Unit, Unit> SaveMmcFeaturesCommand { get; } public ReactiveCommand<Unit, Task> SaveMmcFeaturesCommand { get; }
public object SelectedModeSensePage public object SelectedModeSensePage
{ {
@@ -968,7 +969,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _mmcFeatureText, value); set => this.RaiseAndSetIfChanged(ref _mmcFeatureText, value);
} }
async void ExecuteSaveInquiryBinaryCommand() async Task ExecuteSaveInquiryBinaryCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -992,7 +993,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveInquiryTextCommand() async Task ExecuteSaveInquiryTextCommand()
{ {
var dlgSaveText = new SaveFileDialog(); var dlgSaveText = new SaveFileDialog();
@@ -1016,7 +1017,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveModeSense6Command() async Task ExecuteSaveModeSense6Command()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -1040,7 +1041,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveModeSense10Command() async Task ExecuteSaveModeSense10Command()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -1064,7 +1065,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveEvpdPageCommand() async Task ExecuteSaveEvpdPageCommand()
{ {
if(!(SelectedEvpdPage is ScsiPageModel pageModel)) if(!(SelectedEvpdPage is ScsiPageModel pageModel))
return; return;
@@ -1091,7 +1092,7 @@ public sealed class ScsiInfoViewModel : ViewModelBase
saveFs.Close(); saveFs.Close();
} }
async void ExecuteSaveMmcFeaturesCommand() async Task ExecuteSaveMmcFeaturesCommand()
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();

View File

@@ -35,6 +35,7 @@ namespace Aaru.Gui.ViewModels.Tabs;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.Core.Media.Info; using Aaru.Core.Media.Info;
using Aaru.Decoders.Xbox; using Aaru.Decoders.Xbox;
using Avalonia.Controls; using Avalonia.Controls;
@@ -78,7 +79,7 @@ public sealed class XboxInfoViewModel
SaveXboxSsVisible = securitySector != null; SaveXboxSsVisible = securitySector != null;
} }
public ReactiveCommand<Unit, Unit> SaveXboxSsCommand { get; } public ReactiveCommand<Unit, Task> SaveXboxSsCommand { get; }
public bool XboxInformationVisible { get; } public bool XboxInformationVisible { get; }
public bool SaveXboxSsVisible { get; } public bool SaveXboxSsVisible { get; }
public string XboxL0VideoText { get; } public string XboxL0VideoText { get; }
@@ -90,7 +91,7 @@ public sealed class XboxInfoViewModel
public string XboxDmiText { get; } public string XboxDmiText { get; }
public string XboxSsText { get; } public string XboxSsText { get; }
async void SaveElement(byte[] data) async Task SaveElement(byte[] data)
{ {
var dlgSaveBinary = new SaveFileDialog(); var dlgSaveBinary = new SaveFileDialog();
@@ -114,5 +115,5 @@ public sealed class XboxInfoViewModel
saveFs.Close(); saveFs.Close();
} }
public void ExecuteSaveXboxSsCommand() => SaveElement(_xboxSecuritySector); public async Task ExecuteSaveXboxSsCommand() => await SaveElement(_xboxSecuritySector);
} }

View File

@@ -36,6 +36,7 @@ using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Reactive; using System.Reactive;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs;

View File

@@ -40,6 +40,7 @@ using System.Linq;
using System.Reactive; using System.Reactive;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
@@ -520,7 +521,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _destinationEnabled, value); set => this.RaiseAndSetIfChanged(ref _destinationEnabled, value);
} }
public ReactiveCommand<Unit, Unit> DestinationCommand { get; } public ReactiveCommand<Unit, Task> DestinationCommand { get; }
public ReactiveCommand<Unit, Unit> CreatorCommand { get; } public ReactiveCommand<Unit, Unit> CreatorCommand { get; }
public ReactiveCommand<Unit, Unit> MediaTitleCommand { get; } public ReactiveCommand<Unit, Unit> MediaTitleCommand { get; }
public ReactiveCommand<Unit, Unit> MediaManufacturerCommand { get; } public ReactiveCommand<Unit, Unit> MediaManufacturerCommand { get; }
@@ -536,10 +537,10 @@ public sealed class ImageConvertViewModel : ViewModelBase
public ReactiveCommand<Unit, Unit> DriveFirmwareRevisionCommand { get; } public ReactiveCommand<Unit, Unit> DriveFirmwareRevisionCommand { get; }
public ReactiveCommand<Unit, Unit> CommentsCommand { get; } public ReactiveCommand<Unit, Unit> CommentsCommand { get; }
public ReactiveCommand<Unit, Unit> CicmXmlFromImageCommand { get; } public ReactiveCommand<Unit, Unit> CicmXmlFromImageCommand { get; }
public ReactiveCommand<Unit, Unit> CicmXmlCommand { get; } public ReactiveCommand<Unit, Task> CicmXmlCommand { get; }
public ReactiveCommand<Unit, Unit> ResumeFileFromImageCommand { get; } public ReactiveCommand<Unit, Unit> ResumeFileFromImageCommand { get; }
public ReactiveCommand<Unit, Unit> ResumeFileCommand { get; } public ReactiveCommand<Unit, Task> ResumeFileCommand { get; }
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ReactiveCommand<Unit, Task> StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ReactiveCommand<Unit, Unit> CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ReactiveCommand<Unit, Unit> StopCommand { get; }
@@ -555,7 +556,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _destinationVisible, value); set => this.RaiseAndSetIfChanged(ref _destinationVisible, value);
} }
async void ExecuteStartCommand() async Task ExecuteStartCommand()
{ {
if(SelectedPlugin is null) if(SelectedPlugin is null)
{ {
@@ -1855,7 +1856,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
grpOptions.Content = stkImageOptions; grpOptions.Content = stkImageOptions;
} }
*/ */
async void ExecuteDestinationCommand() async Task ExecuteDestinationCommand()
{ {
if(SelectedPlugin is null) if(SelectedPlugin is null)
return; return;
@@ -1921,7 +1922,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
_cicmMetadata = _inputFormat.CicmMetadata; _cicmMetadata = _inputFormat.CicmMetadata;
} }
async void ExecuteCicmXmlCommand() async Task ExecuteCicmXmlCommand()
{ {
_cicmMetadata = null; _cicmMetadata = null;
CicmXmlText = ""; CicmXmlText = "";
@@ -1968,7 +1969,7 @@ public sealed class ImageConvertViewModel : ViewModelBase
_dumpHardware = _inputFormat.DumpHardware; _dumpHardware = _inputFormat.DumpHardware;
} }
async void ExecuteResumeFileCommand() async Task ExecuteResumeFileCommand()
{ {
_dumpHardware = null; _dumpHardware = null;
ResumeFileText = ""; ResumeFileText = "";

View File

@@ -37,6 +37,7 @@ using System.Collections.ObjectModel;
using System.Globalization; using System.Globalization;
using System.Reactive; using System.Reactive;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.Console; using Aaru.Console;
using Aaru.Core; using Aaru.Core;

View File

@@ -38,6 +38,7 @@ using System.IO;
using System.Reactive; using System.Reactive;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
using Aaru.Console; using Aaru.Console;
@@ -97,7 +98,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase
} }
public string Title { get; } public string Title { get; }
public ReactiveCommand<Unit, Unit> DestinationCommand { get; } public ReactiveCommand<Unit, Task> DestinationCommand { get; }
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ReactiveCommand<Unit, Unit> StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ReactiveCommand<Unit, Unit> CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ReactiveCommand<Unit, Unit> StopCommand { get; }
@@ -313,7 +314,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase
_sidecarClass.Abort(); _sidecarClass.Abort();
} }
async void ExecuteDestinationCommand() async Task ExecuteDestinationCommand()
{ {
var dlgDestination = new SaveFileDialog var dlgDestination = new SaveFileDialog
{ {

View File

@@ -39,6 +39,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive; using System.Reactive;
using System.Threading.Tasks;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interfaces;
@@ -186,8 +187,8 @@ public sealed class MainWindowViewModel : ViewModelBase
public ReactiveCommand<Unit, Unit> PluginsCommand { get; } public ReactiveCommand<Unit, Unit> PluginsCommand { get; }
public ReactiveCommand<Unit, Unit> StatisticsCommand { get; } public ReactiveCommand<Unit, Unit> StatisticsCommand { get; }
public ReactiveCommand<Unit, Unit> ExitCommand { get; } public ReactiveCommand<Unit, Unit> ExitCommand { get; }
public ReactiveCommand<Unit, Unit> SettingsCommand { get; } public ReactiveCommand<Unit, Task> SettingsCommand { get; }
public ReactiveCommand<Unit, Unit> OpenCommand { get; } public ReactiveCommand<Unit, Task> OpenCommand { get; }
public ReactiveCommand<Unit, Unit> CalculateEntropyCommand { get; } public ReactiveCommand<Unit, Unit> CalculateEntropyCommand { get; }
public ReactiveCommand<Unit, Unit> VerifyImageCommand { get; } public ReactiveCommand<Unit, Unit> VerifyImageCommand { get; }
public ReactiveCommand<Unit, Unit> ChecksumImageCommand { get; } public ReactiveCommand<Unit, Unit> ChecksumImageCommand { get; }
@@ -478,7 +479,7 @@ public sealed class MainWindowViewModel : ViewModelBase
dialog.ShowDialog(_view); dialog.ShowDialog(_view);
} }
internal async void ExecuteSettingsCommand() internal async Task ExecuteSettingsCommand()
{ {
var dialog = new SettingsDialog(); var dialog = new SettingsDialog();
dialog.DataContext = new SettingsViewModel(dialog, false); dialog.DataContext = new SettingsViewModel(dialog, false);
@@ -499,7 +500,7 @@ public sealed class MainWindowViewModel : ViewModelBase
_console.Show(); _console.Show();
} }
async void ExecuteOpenCommand() async Task ExecuteOpenCommand()
{ {
// TODO: Extensions // TODO: Extensions
var dlgOpenImage = new OpenFileDialog var dlgOpenImage = new OpenFileDialog

View File

@@ -40,6 +40,7 @@ using System.Linq;
using System.Reactive; using System.Reactive;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Enums;
@@ -241,7 +242,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
public ReactiveCommand<Unit, Unit> StartCommand { get; } public ReactiveCommand<Unit, Unit> StartCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; } public ReactiveCommand<Unit, Unit> CloseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ReactiveCommand<Unit, Unit> StopCommand { get; }
public ReactiveCommand<Unit, Unit> DestinationCommand { get; } public ReactiveCommand<Unit, Task> DestinationCommand { get; }
public ObservableCollection<ImagePluginModel> PluginsList { get; } public ObservableCollection<ImagePluginModel> PluginsList { get; }
public ObservableCollection<EncodingModel> Encodings { get; } public ObservableCollection<EncodingModel> Encodings { get; }
@@ -631,7 +632,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _stopEnabled, value); set => this.RaiseAndSetIfChanged(ref _stopEnabled, value);
} }
async void ExecuteDestinationCommand() async Task ExecuteDestinationCommand()
{ {
if(SelectedPlugin is null) if(SelectedPlugin is null)
return; return;
@@ -667,7 +668,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
Resume = true; Resume = true;
} }
async void CheckResumeFile() async Task CheckResumeFile()
{ {
_resume = null; _resume = null;
var xs = new XmlSerializer(typeof(Resume)); var xs = new XmlSerializer(typeof(Resume));
@@ -815,7 +816,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
new Thread(DoWork).Start(); new Thread(DoWork).Start();
} }
void DoWork() async void DoWork()
{ {
_dumper.UpdateStatus += UpdateStatus; _dumper.UpdateStatus += UpdateStatus;
_dumper.ErrorMessage += ErrorMessage; _dumper.ErrorMessage += ErrorMessage;
@@ -832,10 +833,10 @@ public sealed class MediaDumpViewModel : ViewModelBase
_dev.Close(); _dev.Close();
WorkFinished(); await WorkFinished();
} }
async void WorkFinished() => await Dispatcher.UIThread.InvokeAsync(() => async Task WorkFinished() => await Dispatcher.UIThread.InvokeAsync(() =>
{ {
CloseVisible = true; CloseVisible = true;
StopVisible = false; StopVisible = false;
@@ -894,7 +895,7 @@ public sealed class MediaDumpViewModel : ViewModelBase
await MessageBoxManager.GetMessageBoxStandardWindow("Error", $"{text}", ButtonEnum.Ok, Icon.Error). await MessageBoxManager.GetMessageBoxStandardWindow("Error", $"{text}", ButtonEnum.Ok, Icon.Error).
ShowDialog(_view); ShowDialog(_view);
WorkFinished(); await WorkFinished();
}); });
async void ErrorMessage(string text) => await Dispatcher.UIThread.InvokeAsync(() => async void ErrorMessage(string text) => await Dispatcher.UIThread.InvokeAsync(() =>

View File

@@ -35,6 +35,7 @@ namespace Aaru.Gui.ViewModels.Windows;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Reactive; using System.Reactive;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using Aaru.Core; using Aaru.Core;
using Aaru.Core.Devices.Scanning; using Aaru.Core.Devices.Scanning;
using Aaru.Devices; using Aaru.Devices;
@@ -399,7 +400,7 @@ public sealed class MediaScanViewModel : ViewModelBase
Statistics.AddCommand("media-scan"); Statistics.AddCommand("media-scan");
dev.Close(); dev.Close();
WorkFinished(); await WorkFinished();
} }
async void ScanSpeed(ulong sector, double currentSpeed) => await Dispatcher.UIThread.InvokeAsync(() => async void ScanSpeed(ulong sector, double currentSpeed) => await Dispatcher.UIThread.InvokeAsync(() =>
@@ -518,7 +519,7 @@ public sealed class MediaScanViewModel : ViewModelBase
} }
}); });
async void WorkFinished() => await Dispatcher.UIThread.InvokeAsync(() => async Task WorkFinished() => await Dispatcher.UIThread.InvokeAsync(() =>
{ {
StopVisible = false; StopVisible = false;
StartVisible = true; StartVisible = true;

View File

@@ -155,19 +155,19 @@ public sealed class SplashWindowViewModel : ViewModelBase
} }
// Remove duplicates // Remove duplicates
foreach(var duplicate in ctx.SeenDevices.AsEnumerable()!.GroupBy(a => new foreach(var duplicate in ctx.SeenDevices.AsEnumerable().GroupBy(a => new
{ {
a.Manufacturer, a.Manufacturer,
a.Model, a.Model,
a.Revision, a.Revision,
a.Bus a.Bus
}).Where(a => a.Count() > 1).Distinct().Select(a => a.Key)) }).Where(a => a.Count() > 1).Distinct().Select(a => a.Key))
ctx.RemoveRange(ctx.SeenDevices!. ctx.RemoveRange(ctx.SeenDevices.
Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model && Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model &&
d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1)); d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1));
// Remove nulls // Remove nulls
ctx.RemoveRange(ctx.SeenDevices!.Where(d => d.Manufacturer == null && d.Model == null && ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && d.Model == null &&
d.Revision == null)); d.Revision == null));
ctx.SaveChanges(); ctx.SaveChanges();