[GUI] Add specific error message for insufficient permissions on device opening in Windows.

This commit is contained in:
2026-04-04 12:08:14 +01:00
parent 7959ff367f
commit a8671cd278
4 changed files with 16210 additions and 10578 deletions

View File

@@ -362,19 +362,38 @@ public partial class DeviceViewModel : ViewModelBase
switch(dev)
{
case null:
AaruLogging.Error(string.Format(UI.Could_not_open_device_error_0, devErrno));
Dispatcher.UIThread.Invoke(() =>
if(OperatingSystem.IsWindows() && (int)devErrno == 5)
{
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
string.Format(UI.Could_not_open_device_error_0, devErrno),
ButtonEnum.Ok,
Icon.Error);
AaruLogging.Error(UI.Insufficient_permissions_trying_to_open_device);
_ = msbox.ShowAsync();
Dispatcher.UIThread.Invoke(() =>
{
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
UI.You_do_not_have_enough_privileges_to_access_the_device,
ButtonEnum.Ok,
Icon.Error);
_window.Close();
});
_ = msbox.ShowAsync();
_window.Close();
});
}
else
{
AaruLogging.Error(string.Format(UI.Could_not_open_device_error_0, devErrno));
Dispatcher.UIThread.Invoke(() =>
{
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
string.Format(UI.Could_not_open_device_error_0, devErrno),
ButtonEnum.Ok,
Icon.Error);
_ = msbox.ShowAsync();
_window.Close();
});
}
return;
case Devices.Remote.Device remoteDev:

File diff suppressed because it is too large Load Diff

View File

@@ -5554,4 +5554,10 @@ Probadores:
<data name="Image_Write_Metadata_Command_Description" xml:space="preserve">
<value>Escribe los metadatados a una imagen AaruFormat.</value>
</data>
<data name="Insufficient_permissions_trying_to_open_device" xml:space="preserve">
<value>Permisos insuficientes al intentar abrir el dispositivo.</value>
</data>
<data name="You_do_not_have_enough_privileges_to_access_the_device" xml:space="preserve">
<value>No tiene los privilegios suficientes para acceder al dispositivo.</value>
</data>
</root>

View File

@@ -5638,4 +5638,10 @@ Do you want to continue?</value>
<data name="Image_Write_Metadata_Command_Description" xml:space="preserve">
<value>Writes metadata to an AaruFormat image.</value>
</data>
<data name="Insufficient_permissions_trying_to_open_device" xml:space="preserve">
<value>Insufficient permissions trying to open device.</value>
</data>
<data name="You_do_not_have_enough_privileges_to_access_the_device" xml:space="preserve">
<value>You do not have enough privileges to access the device.</value>
</data>
</root>