mirror of
https://github.com/cyanfish/naps2.git
synced 2024-10-04 19:37:15 +03:00
Fix a few more code issues
This commit is contained in:
parent
6c22e06f1e
commit
aea31028a4
@ -9,7 +9,7 @@ namespace NAPS2.Automation
|
||||
{
|
||||
public void DisplayError(string errorMessage)
|
||||
{
|
||||
System.Console.WriteLine(errorMessage);
|
||||
Console.WriteLine(errorMessage);
|
||||
}
|
||||
|
||||
public void DisplayError(string errorMessage, string details)
|
||||
|
@ -57,10 +57,7 @@ namespace NAPS2.Host
|
||||
throw;
|
||||
}
|
||||
|
||||
if (_hostProcess != null)
|
||||
{
|
||||
_hostProcess.StandardOutput.Read();
|
||||
}
|
||||
_hostProcess?.StandardOutput.Read();
|
||||
}
|
||||
|
||||
public static IX86HostService Connect()
|
||||
|
@ -106,9 +106,9 @@ namespace NAPS2.ImportExport
|
||||
{
|
||||
firstFileSaved = subPath;
|
||||
}
|
||||
if (op.Status.Success && notify != null)
|
||||
if (op.Status.Success)
|
||||
{
|
||||
notify.PdfSaved(subPath);
|
||||
notify?.PdfSaved(subPath);
|
||||
}
|
||||
return op.Status.Success;
|
||||
}
|
||||
@ -124,9 +124,9 @@ namespace NAPS2.ImportExport
|
||||
{
|
||||
firstFileSaved = op.FirstFileSaved;
|
||||
}
|
||||
if (op.Status.Success && notify != null)
|
||||
if (op.Status.Success)
|
||||
{
|
||||
notify.ImagesSaved(images.Count, op.FirstFileSaved);
|
||||
notify?.ImagesSaved(images.Count, op.FirstFileSaved);
|
||||
}
|
||||
return op.Status.Success;
|
||||
}
|
||||
|
@ -26,28 +26,19 @@ namespace NAPS2.Operation
|
||||
|
||||
protected void InvokeFinished()
|
||||
{
|
||||
if (Finished != null)
|
||||
{
|
||||
Finished.Invoke(this, new EventArgs());
|
||||
}
|
||||
Finished?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected void InvokeStatusChanged()
|
||||
{
|
||||
if (StatusChanged != null)
|
||||
{
|
||||
StatusChanged.Invoke(this, new EventArgs());
|
||||
}
|
||||
StatusChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected void InvokeError(string message, Exception exception)
|
||||
{
|
||||
var args = new OperationErrorEventArgs(message, exception);
|
||||
LastError = args;
|
||||
if (Error != null)
|
||||
{
|
||||
Error.Invoke(this, args);
|
||||
}
|
||||
Error?.Invoke(this, args);
|
||||
}
|
||||
}
|
||||
}
|
@ -128,10 +128,7 @@ namespace NAPS2.Scan.Images
|
||||
|
||||
public void SetThumbnail(Bitmap bitmap)
|
||||
{
|
||||
if (thumbnail != null)
|
||||
{
|
||||
thumbnail.Dispose();
|
||||
}
|
||||
thumbnail?.Dispose();
|
||||
thumbnail = bitmap;
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,7 @@ namespace NAPS2.Util
|
||||
Registry.LocalMachine.DeleteSubKey(REGKEY_AUTOPLAY_HANDLER_NAPS2, false);
|
||||
using (var key2 = Registry.LocalMachine.OpenSubKey(REGKEY_STI_APP, true))
|
||||
{
|
||||
if (key2 != null)
|
||||
{
|
||||
key2.DeleteValue("NAPS2", false);
|
||||
}
|
||||
key2?.DeleteValue("NAPS2", false);
|
||||
}
|
||||
Registry.LocalMachine.DeleteSubKey(REGKEY_STI_EVENT_NAPS2, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user