mirror of
https://github.com/cyanfish/naps2.git
synced 2024-10-26 09:01:36 +03:00
Add INotify interface and move types into Notifications namespace
This commit is contained in:
parent
7837a2e3fa
commit
3918dff04c
@ -1,5 +1,6 @@
|
||||
using Moq;
|
||||
using NAPS2.EtoForms;
|
||||
using NAPS2.EtoForms.Notifications;
|
||||
using NAPS2.ImportExport;
|
||||
using NAPS2.Pdf;
|
||||
using NAPS2.Scan;
|
||||
|
@ -2,7 +2,6 @@ using Moq;
|
||||
using NAPS2.EtoForms;
|
||||
using NAPS2.EtoForms.Desktop;
|
||||
using NAPS2.EtoForms.Notifications;
|
||||
using NAPS2.EtoForms.Widgets;
|
||||
using NAPS2.ImportExport;
|
||||
using NAPS2.ImportExport.Images;
|
||||
using NAPS2.Platform.Windows;
|
||||
@ -29,7 +28,7 @@ public class DesktopControllerTests : ContextualTests
|
||||
private readonly Mock<IOperationFactory> _operationFactory;
|
||||
private readonly StillImage _stillImage;
|
||||
private readonly Mock<IUpdateChecker> _updateChecker;
|
||||
private readonly Mock<Notify> _notify;
|
||||
private readonly Mock<INotify> _notify;
|
||||
private readonly ImageTransfer _imageTransfer;
|
||||
private readonly ImageClipboard _imageClipboard;
|
||||
private readonly Mock<IExportController> _exportHelper;
|
||||
@ -53,7 +52,7 @@ public class DesktopControllerTests : ContextualTests
|
||||
_operationFactory = new Mock<IOperationFactory>();
|
||||
_stillImage = new StillImage();
|
||||
_updateChecker = new Mock<IUpdateChecker>();
|
||||
_notify = new Mock<Notify>();
|
||||
_notify = new Mock<INotify>();
|
||||
_imageTransfer = new ImageTransfer();
|
||||
_imageClipboard = new ImageClipboard();
|
||||
_exportHelper = new Mock<IExportController>();
|
||||
|
@ -24,7 +24,7 @@ public class DesktopController
|
||||
private readonly IOperationFactory _operationFactory;
|
||||
private readonly StillImage _stillImage;
|
||||
private readonly IUpdateChecker _updateChecker;
|
||||
private readonly Notify _notify;
|
||||
private readonly INotify _notify;
|
||||
private readonly ImageTransfer _imageTransfer;
|
||||
private readonly ImageClipboard _imageClipboard;
|
||||
private readonly ImageListActions _imageListActions;
|
||||
@ -43,7 +43,7 @@ public class DesktopController
|
||||
RecoveryStorageManager recoveryStorageManager, ThumbnailController thumbnailController,
|
||||
OperationProgress operationProgress, Naps2Config config, IOperationFactory operationFactory,
|
||||
StillImage stillImage,
|
||||
IUpdateChecker updateChecker, Notify notify, ImageTransfer imageTransfer,
|
||||
IUpdateChecker updateChecker, INotify notify, ImageTransfer imageTransfer,
|
||||
ImageClipboard imageClipboard, ImageListActions imageListActions,
|
||||
DialogHelper dialogHelper,
|
||||
DesktopImagesController desktopImagesController, IDesktopScanController desktopScanController,
|
||||
|
@ -12,11 +12,11 @@ public class ImageListActions
|
||||
private readonly Naps2Config _config;
|
||||
private readonly ThumbnailController _thumbnailController;
|
||||
private readonly IExportController _exportController;
|
||||
private readonly Notify _notify;
|
||||
private readonly INotify _notify;
|
||||
|
||||
public ImageListActions(UiImageList imageList, IOperationFactory operationFactory,
|
||||
OperationProgress operationProgress, Naps2Config config, ThumbnailController thumbnailController,
|
||||
IExportController exportController, Notify notify)
|
||||
IExportController exportController, INotify notify)
|
||||
{
|
||||
_imageList = imageList;
|
||||
_operationFactory = operationFactory;
|
||||
|
@ -1,19 +1,18 @@
|
||||
using Eto.Forms;
|
||||
using NAPS2.EtoForms.Notifications;
|
||||
using NAPS2.EtoForms.Ui;
|
||||
using NAPS2.EtoForms.Widgets;
|
||||
|
||||
namespace NAPS2.EtoForms;
|
||||
|
||||
public class EtoOperationProgress : OperationProgress
|
||||
{
|
||||
private readonly IFormFactory _formFactory;
|
||||
private readonly Notify _notify;
|
||||
private readonly INotify _notify;
|
||||
private readonly Naps2Config _config;
|
||||
|
||||
private readonly HashSet<IOperation> _activeOperations = new();
|
||||
|
||||
public EtoOperationProgress(IFormFactory formFactory, Notify notify, Naps2Config config)
|
||||
public EtoOperationProgress(IFormFactory formFactory, INotify notify, Naps2Config config)
|
||||
{
|
||||
_formFactory = formFactory;
|
||||
_notify = notify;
|
||||
|
10
NAPS2.Lib/EtoForms/Notifications/INotify.cs
Normal file
10
NAPS2.Lib/EtoForms/Notifications/INotify.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using NAPS2.Update;
|
||||
|
||||
namespace NAPS2.EtoForms.Notifications;
|
||||
|
||||
public interface INotify : ISaveNotify
|
||||
{
|
||||
void DonatePrompt();
|
||||
void OperationProgress(OperationProgress progress, IOperation op);
|
||||
void UpdateAvailable(IUpdateChecker updateChecker, UpdateInfo update);
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
namespace NAPS2.Util;
|
||||
namespace NAPS2.EtoForms.Notifications;
|
||||
|
||||
/// <summary>
|
||||
/// A base interface for objects that can display information about saved files to the user.
|
||||
///
|
||||
/// Implementors: NotificationManager
|
||||
/// </summary>
|
||||
public interface ISaveNotify
|
||||
{
|
@ -2,7 +2,7 @@ using NAPS2.Update;
|
||||
|
||||
namespace NAPS2.EtoForms.Notifications;
|
||||
|
||||
public class Notify : ISaveNotify
|
||||
public class Notify : INotify
|
||||
{
|
||||
private readonly NotificationManager _notificationManager;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace NAPS2.Util;
|
||||
namespace NAPS2.EtoForms.Notifications;
|
||||
|
||||
public class SaveNotifyStub : ISaveNotify
|
||||
{
|
@ -1,4 +1,5 @@
|
||||
using NAPS2.EtoForms;
|
||||
using NAPS2.EtoForms.Notifications;
|
||||
using NAPS2.ImportExport.Images;
|
||||
using NAPS2.Pdf;
|
||||
using NAPS2.Scan;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using NAPS2.EtoForms;
|
||||
using NAPS2.EtoForms.Notifications;
|
||||
using NAPS2.EtoForms.Ui;
|
||||
using NAPS2.ImportExport.Email;
|
||||
using NAPS2.ImportExport.Images;
|
||||
|
@ -1,3 +1,5 @@
|
||||
using NAPS2.EtoForms.Notifications;
|
||||
|
||||
namespace NAPS2.ImportExport;
|
||||
|
||||
public interface IExportController
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Autofac;
|
||||
using NAPS2.Automation;
|
||||
using NAPS2.EtoForms;
|
||||
using NAPS2.EtoForms.Notifications;
|
||||
using NAPS2.Pdf;
|
||||
using NAPS2.Scan;
|
||||
|
||||
|
@ -23,7 +23,8 @@ public class GuiModule : Module
|
||||
builder.RegisterType<EtoDevicePrompt>().As<IDevicePrompt>();
|
||||
builder.RegisterType<EtoPdfPasswordProvider>().As<IPdfPasswordProvider>();
|
||||
builder.RegisterType<NotificationManager>().AsSelf().SingleInstance();
|
||||
builder.Register<ISaveNotify>(ctx => ctx.Resolve<Notify>());
|
||||
builder.RegisterType<Notify>().As<INotify>();
|
||||
builder.RegisterType<Notify>().As<ISaveNotify>();
|
||||
builder.RegisterType<DesktopController>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<UpdateChecker>().As<IUpdateChecker>();
|
||||
builder.RegisterType<ExportController>().As<IExportController>();
|
||||
|
Loading…
Reference in New Issue
Block a user