diff --git a/NAPS2.Core/ImportExport/Images/SaveImagesOperation.cs b/NAPS2.Core/ImportExport/Images/SaveImagesOperation.cs
index ec949134b..038944ab4 100644
--- a/NAPS2.Core/ImportExport/Images/SaveImagesOperation.cs
+++ b/NAPS2.Core/ImportExport/Images/SaveImagesOperation.cs
@@ -146,6 +146,18 @@ namespace NAPS2.ImportExport.Images
}
return false;
});
+ Success.ContinueWith(task =>
+ {
+ if (task.Result)
+ {
+ Log.Event(EventType.SaveImages, new EventParams
+ {
+ Name = MiscResources.SaveImages,
+ Pages = snapshots.Count,
+ FileFormat = Path.GetExtension(fileName)
+ });
+ }
+ }, TaskContinuationOptions.OnlyOnRanToCompletion);
return true;
}
diff --git a/NAPS2.Core/ImportExport/Pdf/SavePdfOperation.cs b/NAPS2.Core/ImportExport/Pdf/SavePdfOperation.cs
index 7b3946920..72bee0dca 100644
--- a/NAPS2.Core/ImportExport/Pdf/SavePdfOperation.cs
+++ b/NAPS2.Core/ImportExport/Pdf/SavePdfOperation.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Threading.Tasks;
using System.Windows.Forms;
using NAPS2.ImportExport.Email;
using NAPS2.Lang.Resources;
@@ -113,6 +114,30 @@ namespace NAPS2.ImportExport.Pdf
return result;
});
+ Success.ContinueWith(task =>
+ {
+ if (task.Result)
+ {
+ if (email)
+ {
+ Log.Event(EventType.Email, new EventParams
+ {
+ Name = MiscResources.EmailPdf,
+ Pages = snapshots.Count,
+ FileFormat = ".pdf"
+ });
+ }
+ else
+ {
+ Log.Event(EventType.SavePdf, new EventParams
+ {
+ Name = MiscResources.SavePdf,
+ Pages = snapshots.Count,
+ FileFormat = ".pdf"
+ });
+ }
+ }
+ }, TaskContinuationOptions.OnlyOnRanToCompletion);
return true;
}
diff --git a/NAPS2.Core/ImportExport/PrintDocumentPrinter.cs b/NAPS2.Core/ImportExport/PrintDocumentPrinter.cs
index 295368bba..22a428967 100644
--- a/NAPS2.Core/ImportExport/PrintDocumentPrinter.cs
+++ b/NAPS2.Core/ImportExport/PrintDocumentPrinter.cs
@@ -5,6 +5,8 @@ using System.Drawing.Printing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
+using NAPS2.Lang.Resources;
+using NAPS2.Logging;
using NAPS2.Scan.Images;
using NAPS2.Scan.Images.Transforms;
using NAPS2.Util;
@@ -105,6 +107,14 @@ namespace NAPS2.ImportExport
};
printDocument.PrinterSettings = printerSettings;
printDocument.Print();
+
+ Log.Event(EventType.Print, new EventParams
+ {
+ Name = MiscResources.Print,
+ Pages = snapshots.Count,
+ DeviceName = printDocument.PrinterSettings.PrinterName
+ });
+
return true;
}
finally
diff --git a/NAPS2.Core/Lang/Resources/MiscResources.Designer.cs b/NAPS2.Core/Lang/Resources/MiscResources.Designer.cs
index 92ee41524..38f1567bc 100644
--- a/NAPS2.Core/Lang/Resources/MiscResources.Designer.cs
+++ b/NAPS2.Core/Lang/Resources/MiscResources.Designer.cs
@@ -474,6 +474,15 @@ namespace NAPS2.Lang.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Email PDF.
+ ///
+ internal static string EmailPdf {
+ get {
+ return ResourceManager.GetString("EmailPdf", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Email PDF Progress.
///
@@ -933,6 +942,15 @@ namespace NAPS2.Lang.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Print.
+ ///
+ internal static string Print {
+ get {
+ return ResourceManager.GetString("Print", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to {0} / {1}.
///
@@ -987,6 +1005,15 @@ namespace NAPS2.Lang.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Save Images.
+ ///
+ internal static string SaveImages {
+ get {
+ return ResourceManager.GetString("SaveImages", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Save Images Progress.
///
@@ -996,6 +1023,15 @@ namespace NAPS2.Lang.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Save PDF.
+ ///
+ internal static string SavePdf {
+ get {
+ return ResourceManager.GetString("SavePdf", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Save PDF Progress.
///
diff --git a/NAPS2.Core/Lang/Resources/MiscResources.resx b/NAPS2.Core/Lang/Resources/MiscResources.resx
index 742ae29af..dc34774ff 100644
--- a/NAPS2.Core/Lang/Resources/MiscResources.resx
+++ b/NAPS2.Core/Lang/Resources/MiscResources.resx
@@ -342,15 +342,24 @@
Recovery Progress
+
+ Save Images
+
Save Images Progress
+
+ Save PDF
+
Save PDF Progress
Saving {0}...
+
+ Print
+
Copying...
@@ -360,6 +369,9 @@
Importing...
+
+ Email PDF
+
Email PDF Progress
diff --git a/NAPS2.Core/Util/Lifecycle.cs b/NAPS2.Core/Util/Lifecycle.cs
index 654098b3c..425c09806 100644
--- a/NAPS2.Core/Util/Lifecycle.cs
+++ b/NAPS2.Core/Util/Lifecycle.cs
@@ -19,6 +19,7 @@ namespace NAPS2.Util
private readonly AppConfigManager appConfigManager;
private readonly WindowsEventLogger windowsEventLogger;
+ private bool shouldCreateEventSource;
private int returnCode;
public Lifecycle(StillImage sti, AppConfigManager appConfigManager, WindowsEventLogger windowsEventLogger)
@@ -102,7 +103,8 @@ namespace NAPS2.Util
}
}
- if (args.Any(x => x.Equals("/CreateEventSource", StringComparison.InvariantCultureIgnoreCase)))
+ shouldCreateEventSource = args.Any(x => x.Equals("/CreateEventSource", StringComparison.InvariantCultureIgnoreCase));
+ if (shouldCreateEventSource)
{
try
{
@@ -149,7 +151,7 @@ namespace NAPS2.Util
///
public void ExitIfRedundant()
{
- if (sti.ShouldRegister || sti.ShouldUnregister)
+ if (sti.ShouldRegister || sti.ShouldUnregister || shouldCreateEventSource)
{
// Was just started by the user to (un)register STI
Environment.Exit(returnCode);