mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 07:15:31 +03:00
Don't show "no devices" message after cancellation
This commit is contained in:
parent
f17d3459a4
commit
89831537cb
@ -46,6 +46,7 @@ public class EtoDevicePrompt : IDevicePrompt
|
||||
{
|
||||
var deviceForm = _formFactory.Create<SelectDeviceForm>();
|
||||
deviceForm.AsyncDevices = devices;
|
||||
deviceForm.AsyncCancelToken = cts.Token;
|
||||
deviceForm.ShowModal();
|
||||
cts.Cancel();
|
||||
return deviceForm.SelectedDevice;
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System.Threading;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
using NAPS2.EtoForms.Layout;
|
||||
@ -85,7 +86,7 @@ public class SelectDeviceForm : EtoDialogBase
|
||||
Invoker.Current.Invoke(() =>
|
||||
{
|
||||
_spinner.Visible = false;
|
||||
if (_lazyDeviceList.Count == 0)
|
||||
if (_lazyDeviceList.Count == 0 && !AsyncCancelToken.IsCancellationRequested)
|
||||
{
|
||||
Close();
|
||||
_errorOutput.DisplayError(SdkResources.NoDevicesFound);
|
||||
@ -101,6 +102,8 @@ public class SelectDeviceForm : EtoDialogBase
|
||||
|
||||
public IAsyncEnumerable<ScanDevice>? AsyncDevices { get; set; }
|
||||
|
||||
public CancellationToken AsyncCancelToken { get; set; }
|
||||
|
||||
public List<ScanDevice>? DeviceList { get; set; }
|
||||
|
||||
public ScanDevice? SelectedDevice { get; private set; }
|
||||
|
Loading…
Reference in New Issue
Block a user