mirror of
https://github.com/cyanfish/naps2.git
synced 2024-11-13 06:27:11 +03:00
Put UserConfig and AppConfig managers in static properties
This commit is contained in:
parent
b53f8ad513
commit
2b1dc944f3
@ -58,8 +58,6 @@ namespace NAPS2.DI.Modules
|
||||
|
||||
// Config
|
||||
Bind<IProfileManager>().To<ProfileManager>().InSingletonScope();
|
||||
Bind<AppConfigManager>().ToSelf().InSingletonScope();
|
||||
Bind<IUserConfigManager>().To<UserConfigManager>().InSingletonScope();
|
||||
Bind<PdfSettingsContainer>().ToSelf().InSingletonScope();
|
||||
Bind<ImageSettingsContainer>().ToSelf().InSingletonScope();
|
||||
Bind<EmailSettingsContainer>().ToSelf().InSingletonScope();
|
||||
|
@ -12,12 +12,10 @@ namespace NAPS2.DI
|
||||
public class NinjectEmailProviderFactory : IEmailProviderFactory
|
||||
{
|
||||
private readonly IKernel kernel;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
public NinjectEmailProviderFactory(IKernel kernel, IUserConfigManager userConfigManager)
|
||||
public NinjectEmailProviderFactory(IKernel kernel)
|
||||
{
|
||||
this.kernel = kernel;
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
public IEmailProvider Create(EmailProviderType type)
|
||||
@ -37,7 +35,7 @@ namespace NAPS2.DI
|
||||
{
|
||||
get
|
||||
{
|
||||
var config = userConfigManager.Config;
|
||||
var config = UserConfig.Current;
|
||||
var providerType = config.EmailSetup?.ProviderType ?? EmailProviderType.System;
|
||||
return Create(providerType);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NAPS2.Config;
|
||||
using NAPS2.WinForms;
|
||||
using Ninject;
|
||||
|
||||
@ -20,7 +19,6 @@ namespace NAPS2.DI
|
||||
{
|
||||
var form = kernel.Get<T>();
|
||||
form.FormFactory = kernel.Get<IFormFactory>();
|
||||
form.UserConfigManager = kernel.Get<IUserConfigManager>();
|
||||
return form;
|
||||
}
|
||||
}
|
||||
|
@ -30,12 +30,10 @@ namespace NAPS2.Automation
|
||||
private readonly IScanPerformer scanPerformer;
|
||||
private readonly IErrorOutput errorOutput;
|
||||
private readonly IScannedImageImporter scannedImageImporter;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly PdfSettingsContainer pdfSettingsContainer;
|
||||
private readonly FileNamePlaceholders fileNamePlaceholders;
|
||||
private readonly ImageSettingsContainer imageSettingsContainer;
|
||||
private readonly IOperationFactory operationFactory;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly OcrManager ocrManager;
|
||||
private readonly IFormFactory formFactory;
|
||||
private readonly GhostscriptManager ghostscriptManager;
|
||||
@ -48,7 +46,7 @@ namespace NAPS2.Automation
|
||||
private List<string> actualOutputPaths;
|
||||
private OcrParams ocrParams;
|
||||
|
||||
public AutomatedScanning(AutomatedScanningOptions options, IProfileManager profileManager, IScanPerformer scanPerformer, IErrorOutput errorOutput, IEmailProviderFactory emailProviderFactory, IScannedImageImporter scannedImageImporter, IUserConfigManager userConfigManager, PdfSettingsContainer pdfSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, IOperationFactory operationFactory, AppConfigManager appConfigManager, OcrManager ocrManager, IFormFactory formFactory, GhostscriptManager ghostscriptManager)
|
||||
public AutomatedScanning(AutomatedScanningOptions options, IProfileManager profileManager, IScanPerformer scanPerformer, IErrorOutput errorOutput, IEmailProviderFactory emailProviderFactory, IScannedImageImporter scannedImageImporter, PdfSettingsContainer pdfSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, IOperationFactory operationFactory, OcrManager ocrManager, IFormFactory formFactory, GhostscriptManager ghostscriptManager)
|
||||
{
|
||||
this.options = options;
|
||||
this.profileManager = profileManager;
|
||||
@ -56,12 +54,10 @@ namespace NAPS2.Automation
|
||||
this.errorOutput = errorOutput;
|
||||
this.emailProviderFactory = emailProviderFactory;
|
||||
this.scannedImageImporter = scannedImageImporter;
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.pdfSettingsContainer = pdfSettingsContainer;
|
||||
this.fileNamePlaceholders = fileNamePlaceholders;
|
||||
this.imageSettingsContainer = imageSettingsContainer;
|
||||
this.operationFactory = operationFactory;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.ocrManager = ocrManager;
|
||||
this.formFactory = formFactory;
|
||||
this.ghostscriptManager = ghostscriptManager;
|
||||
@ -156,7 +152,7 @@ namespace NAPS2.Automation
|
||||
private void ConfigureOcr()
|
||||
{
|
||||
bool canUseOcr = IsPdfFile(options.OutputPath) || IsPdfFile(options.EmailFileName);
|
||||
bool useOcr = canUseOcr && !options.DisableOcr && (options.EnableOcr || options.OcrLang != null || userConfigManager.Config.EnableOcr || appConfigManager.Config.OcrState == OcrState.Enabled);
|
||||
bool useOcr = canUseOcr && !options.DisableOcr && (options.EnableOcr || options.OcrLang != null || UserConfig.Current.EnableOcr || AppConfig.Current.OcrState == OcrState.Enabled);
|
||||
string ocrLanguageCode = useOcr ? (options.OcrLang ?? ocrManager.DefaultParams?.LanguageCode) : null;
|
||||
ocrParams = new OcrParams(ocrLanguageCode, ocrManager.DefaultParams?.Mode ?? OcrMode.Default);
|
||||
}
|
||||
@ -571,7 +567,7 @@ namespace NAPS2.Automation
|
||||
{
|
||||
OutputVerbose(ConsoleResources.BeginningScan);
|
||||
|
||||
bool autoSaveEnabled = !appConfigManager.Config.DisableAutoSave && profile.EnableAutoSave && profile.AutoSaveSettings != null;
|
||||
bool autoSaveEnabled = !AppConfig.Current.DisableAutoSave && profile.EnableAutoSave && profile.AutoSaveSettings != null;
|
||||
if (options.AutoSave && !autoSaveEnabled)
|
||||
{
|
||||
errorOutput.DisplayError(ConsoleResources.AutoSaveNotEnabled);
|
||||
|
@ -13,6 +13,16 @@ namespace NAPS2.Config
|
||||
{
|
||||
public const int CURRENT_VERSION = 2;
|
||||
|
||||
private static IConfigManager<AppConfig> _manager = new ConfigManager<AppConfig>("appsettings.xml", Paths.Executable, null, () => new AppConfig { Version = CURRENT_VERSION });
|
||||
|
||||
public static IConfigManager<AppConfig> Manager
|
||||
{
|
||||
get => _manager;
|
||||
set => _manager = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
public static AppConfig Current => Manager.Config;
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
public string DefaultCulture { get; set; }
|
||||
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NAPS2.Config
|
||||
{
|
||||
public class AppConfigManager : ConfigManager<AppConfig>
|
||||
{
|
||||
public AppConfigManager()
|
||||
: base("appsettings.xml", Paths.Executable, null, () => new AppConfig { Version = AppConfig.CURRENT_VERSION })
|
||||
{
|
||||
}
|
||||
|
||||
public new AppConfig Config => base.Config;
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ using NAPS2.Util;
|
||||
|
||||
namespace NAPS2.Config
|
||||
{
|
||||
public abstract class ConfigManager<T> where T : class
|
||||
public class ConfigManager<T> : IConfigManager<T> where T : class
|
||||
{
|
||||
protected readonly string primaryConfigPath;
|
||||
protected readonly string secondaryConfigPath;
|
||||
@ -17,7 +17,7 @@ namespace NAPS2.Config
|
||||
|
||||
private T config;
|
||||
|
||||
protected ConfigManager(string indexFileName, string recoveryFolderPath, string secondaryFolder, Func<T> factory)
|
||||
public ConfigManager(string indexFileName, string recoveryFolderPath, string secondaryFolder, Func<T> factory)
|
||||
{
|
||||
primaryConfigPath = Path.Combine(recoveryFolderPath, indexFileName);
|
||||
if (secondaryFolder != null)
|
||||
@ -27,7 +27,7 @@ namespace NAPS2.Config
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
protected T Config
|
||||
public T Config
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -4,9 +4,9 @@ using System.Linq;
|
||||
|
||||
namespace NAPS2.Config
|
||||
{
|
||||
public interface IUserConfigManager
|
||||
public interface IConfigManager<out T>
|
||||
{
|
||||
UserConfig Config { get; }
|
||||
T Config { get; }
|
||||
void Load();
|
||||
void Save();
|
||||
}
|
@ -11,12 +11,9 @@ namespace NAPS2.Config
|
||||
{
|
||||
public class ProfileManager : ConfigManager<List<ScanProfile>>, IProfileManager
|
||||
{
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
public ProfileManager(AppConfigManager appConfigManager)
|
||||
public ProfileManager()
|
||||
: base("profiles.xml", Paths.AppData, Paths.Executable, () => new List<ScanProfile>())
|
||||
{
|
||||
this.appConfigManager = appConfigManager;
|
||||
}
|
||||
|
||||
public List<ScanProfile> Profiles => Config;
|
||||
@ -44,7 +41,7 @@ namespace NAPS2.Config
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
if (appConfigManager.Config.LockSystemProfiles)
|
||||
if (AppConfig.Current.LockSystemProfiles)
|
||||
{
|
||||
var systemProfiles = TryLoadConfig(secondaryConfigPath);
|
||||
if (systemProfiles != null)
|
||||
@ -52,7 +49,7 @@ namespace NAPS2.Config
|
||||
foreach (var systemProfile in systemProfiles)
|
||||
{
|
||||
systemProfile.IsLocked = true;
|
||||
systemProfile.IsDeviceLocked = (systemProfile.Device != null || appConfigManager.Config.LockUnspecifiedDevices);
|
||||
systemProfile.IsDeviceLocked = (systemProfile.Device != null || AppConfig.Current.LockUnspecifiedDevices);
|
||||
}
|
||||
var systemProfileNames = new HashSet<string>(systemProfiles.Select(x => x.DisplayName));
|
||||
foreach (var profile in Config.ToList())
|
||||
@ -73,7 +70,7 @@ namespace NAPS2.Config
|
||||
systemProfileNames.Remove(profile.DisplayName);
|
||||
}
|
||||
}
|
||||
if (systemProfiles.Count > 0 && appConfigManager.Config.NoUserProfiles)
|
||||
if (systemProfiles.Count > 0 && AppConfig.Current.NoUserProfiles)
|
||||
{
|
||||
Config.Clear();
|
||||
}
|
||||
|
@ -16,6 +16,16 @@ namespace NAPS2.Config
|
||||
{
|
||||
public const int CURRENT_VERSION = 2;
|
||||
|
||||
private static IConfigManager<UserConfig> _manager = new ConfigManager<UserConfig>("config.xml", Paths.AppData, Paths.Executable, () => new UserConfig { Version = CURRENT_VERSION });
|
||||
|
||||
public static IConfigManager<UserConfig> Manager
|
||||
{
|
||||
get => _manager;
|
||||
set => _manager = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
public static UserConfig Current => Manager.Config;
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
public string Culture { get; set; }
|
||||
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NAPS2.Config
|
||||
{
|
||||
public class UserConfigManager : ConfigManager<UserConfig>, IUserConfigManager
|
||||
{
|
||||
public UserConfigManager()
|
||||
: base("config.xml", Paths.AppData, Paths.Executable, () => new UserConfig { Version = UserConfig.CURRENT_VERSION })
|
||||
{
|
||||
}
|
||||
|
||||
public new UserConfig Config => base.Config;
|
||||
}
|
||||
}
|
@ -7,22 +7,15 @@ namespace NAPS2.Dependencies
|
||||
{
|
||||
public class ComponentManager
|
||||
{
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
private string basePath;
|
||||
|
||||
public ComponentManager(AppConfigManager appConfigManager)
|
||||
{
|
||||
this.appConfigManager = appConfigManager;
|
||||
}
|
||||
|
||||
|
||||
public string BasePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (basePath == null)
|
||||
{
|
||||
var customPath = appConfigManager.Config.ComponentsPath;
|
||||
var customPath = AppConfig.Current.ComponentsPath;
|
||||
basePath = string.IsNullOrWhiteSpace(customPath)
|
||||
? Paths.Components
|
||||
: Environment.ExpandEnvironmentVariables(customPath);
|
||||
|
@ -20,23 +20,19 @@ namespace NAPS2.ImportExport
|
||||
public class AutoSave : IAutoSave
|
||||
{
|
||||
private readonly IOperationFactory operationFactory;
|
||||
private readonly IFormFactory formFactory;
|
||||
private readonly PdfSettingsContainer pdfSettingsContainer;
|
||||
private readonly OcrManager ocrManager;
|
||||
private readonly IErrorOutput errorOutput;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly FileNamePlaceholders fileNamePlaceholders;
|
||||
private readonly DialogHelper dialogHelper;
|
||||
private readonly IOperationProgress operationProgress;
|
||||
|
||||
public AutoSave(IOperationFactory operationFactory, IFormFactory formFactory, PdfSettingsContainer pdfSettingsContainer, OcrManager ocrManager, IErrorOutput errorOutput, AppConfigManager appConfigManager, FileNamePlaceholders fileNamePlaceholders, DialogHelper dialogHelper, IOperationProgress operationProgress)
|
||||
public AutoSave(IOperationFactory operationFactory, PdfSettingsContainer pdfSettingsContainer, OcrManager ocrManager, IErrorOutput errorOutput, FileNamePlaceholders fileNamePlaceholders, DialogHelper dialogHelper, IOperationProgress operationProgress)
|
||||
{
|
||||
this.operationFactory = operationFactory;
|
||||
this.formFactory = formFactory;
|
||||
this.pdfSettingsContainer = pdfSettingsContainer;
|
||||
this.ocrManager = ocrManager;
|
||||
this.errorOutput = errorOutput;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.fileNamePlaceholders = fileNamePlaceholders;
|
||||
this.dialogHelper = dialogHelper;
|
||||
this.operationProgress = operationProgress;
|
||||
@ -44,7 +40,7 @@ namespace NAPS2.ImportExport
|
||||
|
||||
public async Task<bool> Save(AutoSaveSettings settings, List<ScannedImage> images, ISaveNotify notify)
|
||||
{
|
||||
if (appConfigManager.Config.DisableAutoSave)
|
||||
if (AppConfig.Current.DisableAutoSave)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -6,18 +6,11 @@ namespace NAPS2.ImportExport.Email
|
||||
{
|
||||
public class EmailSettingsContainer
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
private EmailSettings localEmailSettings;
|
||||
|
||||
public EmailSettingsContainer(IUserConfigManager userConfigManager)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
|
||||
public EmailSettings EmailSettings
|
||||
{
|
||||
get => localEmailSettings ?? userConfigManager.Config.EmailSettings ?? new EmailSettings();
|
||||
get => localEmailSettings ?? UserConfig.Current.EmailSettings ?? new EmailSettings();
|
||||
set => localEmailSettings = value;
|
||||
}
|
||||
}
|
||||
|
@ -10,17 +10,15 @@ namespace NAPS2.ImportExport.Email.Mapi
|
||||
public class MapiWrapper
|
||||
{
|
||||
private readonly SystemEmailClients systemEmailClients;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
public MapiWrapper(SystemEmailClients systemEmailClients, IUserConfigManager userConfigManager)
|
||||
public MapiWrapper(SystemEmailClients systemEmailClients)
|
||||
{
|
||||
this.systemEmailClients = systemEmailClients;
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
public MapiSendMailReturnCode SendEmail(EmailMessage message)
|
||||
{
|
||||
var clientName = userConfigManager.Config.EmailSetup?.SystemProviderName;
|
||||
var clientName = UserConfig.Current.EmailSetup?.SystemProviderName;
|
||||
var (mapiSendMail, mapiSendMailW) = systemEmailClients.GetDelegate(clientName, out bool unicode);
|
||||
|
||||
// Determine the flags used to send the message
|
||||
|
@ -12,19 +12,17 @@ namespace NAPS2.ImportExport.Email.Oauth
|
||||
{
|
||||
public class GmailEmailProvider : MimeEmailProvider
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly GmailOauthProvider gmailOauthProvider;
|
||||
|
||||
public GmailEmailProvider(IUserConfigManager userConfigManager, GmailOauthProvider gmailOauthProvider)
|
||||
public GmailEmailProvider(GmailOauthProvider gmailOauthProvider)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.gmailOauthProvider = gmailOauthProvider;
|
||||
}
|
||||
|
||||
protected override async Task SendMimeMessage(MimeMessage message, ProgressHandler progressCallback, CancellationToken cancelToken)
|
||||
{
|
||||
var messageId = await gmailOauthProvider.UploadDraft(message.ToString(), progressCallback, cancelToken);
|
||||
var userEmail = userConfigManager.Config.EmailSetup?.GmailUser;
|
||||
var userEmail = UserConfig.Current.EmailSetup?.GmailUser;
|
||||
// Open the draft in the user's browser
|
||||
// Note: As of this writing, the direct url is bugged in the new gmail UI, and there is no workaround
|
||||
// https://issuetracker.google.com/issues/113127519
|
||||
|
@ -12,20 +12,13 @@ namespace NAPS2.ImportExport.Email.Oauth
|
||||
{
|
||||
public class GmailOauthProvider : OauthProvider
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
private OauthClientCreds creds;
|
||||
|
||||
public GmailOauthProvider(IUserConfigManager userConfigManager)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
#region Authorization
|
||||
|
||||
public override OauthToken Token => userConfigManager.Config.EmailSetup?.GmailToken;
|
||||
public override OauthToken Token => UserConfig.Current.EmailSetup?.GmailToken;
|
||||
|
||||
public override string User => userConfigManager.Config.EmailSetup?.GmailUser;
|
||||
public override string User => UserConfig.Current.EmailSetup?.GmailUser;
|
||||
|
||||
protected override OauthClientCreds ClientCreds
|
||||
{
|
||||
@ -49,14 +42,14 @@ namespace NAPS2.ImportExport.Email.Oauth
|
||||
|
||||
protected override void SaveToken(OauthToken token, bool refresh)
|
||||
{
|
||||
userConfigManager.Config.EmailSetup = userConfigManager.Config.EmailSetup ?? new EmailSetup();
|
||||
userConfigManager.Config.EmailSetup.GmailToken = token;
|
||||
UserConfig.Current.EmailSetup = UserConfig.Current.EmailSetup ?? new EmailSetup();
|
||||
UserConfig.Current.EmailSetup.GmailToken = token;
|
||||
if (!refresh)
|
||||
{
|
||||
userConfigManager.Config.EmailSetup.GmailUser = GetEmailAddress();
|
||||
userConfigManager.Config.EmailSetup.ProviderType = EmailProviderType.Gmail;
|
||||
UserConfig.Current.EmailSetup.GmailUser = GetEmailAddress();
|
||||
UserConfig.Current.EmailSetup.ProviderType = EmailProviderType.Gmail;
|
||||
}
|
||||
userConfigManager.Save();
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -13,12 +13,10 @@ namespace NAPS2.ImportExport.Email.Oauth
|
||||
{
|
||||
public class OutlookWebEmailProvider : IEmailProvider
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly OutlookWebOauthProvider outlookWebOauthProvider;
|
||||
|
||||
public OutlookWebEmailProvider(IUserConfigManager userConfigManager, OutlookWebOauthProvider outlookWebOauthProvider)
|
||||
public OutlookWebEmailProvider(OutlookWebOauthProvider outlookWebOauthProvider)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.outlookWebOauthProvider = outlookWebOauthProvider;
|
||||
}
|
||||
|
||||
|
@ -12,20 +12,13 @@ namespace NAPS2.ImportExport.Email.Oauth
|
||||
{
|
||||
public class OutlookWebOauthProvider : OauthProvider
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
private OauthClientCreds creds;
|
||||
|
||||
public OutlookWebOauthProvider(IUserConfigManager userConfigManager)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
#region Authorization
|
||||
|
||||
public override OauthToken Token => userConfigManager.Config.EmailSetup?.OutlookWebToken;
|
||||
public override OauthToken Token => UserConfig.Current.EmailSetup?.OutlookWebToken;
|
||||
|
||||
public override string User => userConfigManager.Config.EmailSetup?.OutlookWebUser;
|
||||
public override string User => UserConfig.Current.EmailSetup?.OutlookWebUser;
|
||||
|
||||
protected override OauthClientCreds ClientCreds
|
||||
{
|
||||
@ -48,14 +41,14 @@ namespace NAPS2.ImportExport.Email.Oauth
|
||||
|
||||
protected override void SaveToken(OauthToken token, bool refresh)
|
||||
{
|
||||
userConfigManager.Config.EmailSetup = userConfigManager.Config.EmailSetup ?? new EmailSetup();
|
||||
userConfigManager.Config.EmailSetup.OutlookWebToken = token;
|
||||
UserConfig.Current.EmailSetup = UserConfig.Current.EmailSetup ?? new EmailSetup();
|
||||
UserConfig.Current.EmailSetup.OutlookWebToken = token;
|
||||
if (!refresh)
|
||||
{
|
||||
userConfigManager.Config.EmailSetup.OutlookWebUser = GetEmailAddress();
|
||||
userConfigManager.Config.EmailSetup.ProviderType = EmailProviderType.OutlookWeb;
|
||||
UserConfig.Current.EmailSetup.OutlookWebUser = GetEmailAddress();
|
||||
UserConfig.Current.EmailSetup.ProviderType = EmailProviderType.OutlookWeb;
|
||||
}
|
||||
userConfigManager.Save();
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -7,18 +7,11 @@ namespace NAPS2.ImportExport.Images
|
||||
{
|
||||
public class ImageSettingsContainer
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
private ImageSettings localImageSettings;
|
||||
|
||||
public ImageSettingsContainer(IUserConfigManager userConfigManager)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
public ImageSettings ImageSettings
|
||||
{
|
||||
get => localImageSettings ?? userConfigManager.Config.ImageSettings ?? new ImageSettings();
|
||||
get => localImageSettings ?? UserConfig.Current.ImageSettings ?? new ImageSettings();
|
||||
set => localImageSettings = value;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ using NAPS2.Dependencies;
|
||||
using NAPS2.Lang.Resources;
|
||||
using NAPS2.Scan;
|
||||
using NAPS2.Util;
|
||||
using PdfSharp.Pdf;
|
||||
using PdfSharp.Pdf.IO;
|
||||
|
||||
namespace NAPS2.ImportExport.Pdf
|
||||
@ -17,17 +16,13 @@ namespace NAPS2.ImportExport.Pdf
|
||||
public class GhostscriptPdfRenderer : IPdfRenderer
|
||||
{
|
||||
private readonly IComponentInstallPrompt componentInstallPrompt;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly IErrorOutput errorOutput;
|
||||
private readonly GhostscriptManager ghostscriptManager;
|
||||
|
||||
private readonly Lazy<byte[]> gsLibBytes;
|
||||
|
||||
public GhostscriptPdfRenderer(IComponentInstallPrompt componentInstallPrompt, AppConfigManager appConfigManager, IErrorOutput errorOutput, GhostscriptManager ghostscriptManager)
|
||||
public GhostscriptPdfRenderer(IComponentInstallPrompt componentInstallPrompt, GhostscriptManager ghostscriptManager)
|
||||
{
|
||||
this.componentInstallPrompt = componentInstallPrompt;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.errorOutput = errorOutput;
|
||||
this.ghostscriptManager = ghostscriptManager;
|
||||
|
||||
gsLibBytes = new Lazy<byte[]>(() => File.ReadAllBytes(ghostscriptManager.GhostscriptComponent.Path));
|
||||
@ -35,7 +30,7 @@ namespace NAPS2.ImportExport.Pdf
|
||||
|
||||
public void ThrowIfCantRender()
|
||||
{
|
||||
if (appConfigManager.Config.DisableGenericPdfImport || !VerifyDependencies())
|
||||
if (AppConfig.Current.DisableGenericPdfImport || !VerifyDependencies())
|
||||
{
|
||||
throw new ImageRenderException();
|
||||
}
|
||||
@ -75,7 +70,7 @@ namespace NAPS2.ImportExport.Pdf
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (appConfigManager.Config.NoUpdatePrompt)
|
||||
if (AppConfig.Current.NoUpdatePrompt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -7,18 +7,11 @@ namespace NAPS2.ImportExport.Pdf
|
||||
{
|
||||
public class PdfSettingsContainer
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
private PdfSettings localPdfSettings;
|
||||
|
||||
public PdfSettingsContainer(IUserConfigManager userConfigManager)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
public PdfSettings PdfSettings
|
||||
{
|
||||
get => localPdfSettings ?? userConfigManager.Config.PdfSettings ?? new PdfSettings();
|
||||
get => localPdfSettings ?? UserConfig.Current.PdfSettings ?? new PdfSettings();
|
||||
set => localPdfSettings = value;
|
||||
}
|
||||
}
|
||||
|
@ -34,14 +34,12 @@ namespace NAPS2.ImportExport.Pdf
|
||||
|
||||
private readonly OcrManager ocrManager;
|
||||
private readonly ScannedImageRenderer scannedImageRenderer;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly OcrRequestQueue ocrRequestQueue;
|
||||
|
||||
public PdfSharpExporter(OcrManager ocrManager, ScannedImageRenderer scannedImageRenderer, AppConfigManager appConfigManager, OcrRequestQueue ocrRequestQueue)
|
||||
public PdfSharpExporter(OcrManager ocrManager, ScannedImageRenderer scannedImageRenderer, OcrRequestQueue ocrRequestQueue)
|
||||
{
|
||||
this.ocrManager = ocrManager;
|
||||
this.scannedImageRenderer = scannedImageRenderer;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.ocrRequestQueue = ocrRequestQueue;
|
||||
}
|
||||
|
||||
@ -49,7 +47,7 @@ namespace NAPS2.ImportExport.Pdf
|
||||
{
|
||||
return await Task.Factory.StartNew(() =>
|
||||
{
|
||||
var forced = appConfigManager.Config.ForcePdfCompat;
|
||||
var forced = AppConfig.Current.ForcePdfCompat;
|
||||
var compat = forced == PdfCompat.Default ? settings.Compat : forced;
|
||||
|
||||
var document = new PdfDocument();
|
||||
|
@ -10,14 +10,7 @@ namespace NAPS2.Logging
|
||||
{
|
||||
private const string SOURCE_NAME = "NAPS2";
|
||||
private const string LOG_NAME = "Application";
|
||||
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
public WindowsEventLogger(AppConfigManager appConfigManager)
|
||||
{
|
||||
this.appConfigManager = appConfigManager;
|
||||
}
|
||||
|
||||
|
||||
public void CreateEventSource()
|
||||
{
|
||||
if (!EventLog.SourceExists(SOURCE_NAME))
|
||||
@ -28,7 +21,7 @@ namespace NAPS2.Logging
|
||||
|
||||
public void LogEvent(EventType eventType, EventParams eventParams)
|
||||
{
|
||||
if ((eventType & appConfigManager.Config.EventLogging) != eventType) return;
|
||||
if ((eventType & AppConfig.Current.EventLogging) != eventType) return;
|
||||
try
|
||||
{
|
||||
EventLog.WriteEntry(SOURCE_NAME, eventParams.ToString(), EventLogEntryType.Information);
|
||||
|
@ -353,14 +353,12 @@
|
||||
<Compile Include="Util\ChaosMonkey.cs" />
|
||||
<Compile Include="Util\CollectionExtensions.cs" />
|
||||
<Compile Include="Config\AppConfig.cs" />
|
||||
<Compile Include="Config\AppConfigManager.cs" />
|
||||
<Compile Include="Config\ConfigManager.cs" />
|
||||
<Compile Include="Config\FormState.cs" />
|
||||
<Compile Include="Config\IProfileManager.cs" />
|
||||
<Compile Include="Config\IUserConfigManager.cs" />
|
||||
<Compile Include="Config\IConfigManager.cs" />
|
||||
<Compile Include="Config\ProfileManager.cs" />
|
||||
<Compile Include="Config\UserConfig.cs" />
|
||||
<Compile Include="Config\UserConfigManager.cs" />
|
||||
<Compile Include="ImportExport\FileNamePlaceholders.cs" />
|
||||
<Compile Include="ImportExport\Email\EmailSettings.cs" />
|
||||
<Compile Include="ImportExport\Email\EmailSettingsContainer.cs" />
|
||||
|
@ -9,16 +9,10 @@ namespace NAPS2.Ocr
|
||||
{
|
||||
public class OcrManager
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
private readonly List<IOcrEngine> engines;
|
||||
|
||||
public OcrManager(Tesseract302Engine t302, Tesseract304Engine t304, Tesseract304XpEngine t304Xp, Tesseract400Beta4Engine t400B4, TesseractSystemEngine tsys, IUserConfigManager userConfigManager, AppConfigManager appConfigManager)
|
||||
public OcrManager(Tesseract302Engine t302, Tesseract304Engine t304, Tesseract304XpEngine t304Xp, Tesseract400Beta4Engine t400B4, TesseractSystemEngine tsys)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.appConfigManager = appConfigManager;
|
||||
|
||||
// Order is important here. Newer/preferred first
|
||||
engines = new List<IOcrEngine>
|
||||
{
|
||||
@ -62,18 +56,18 @@ namespace NAPS2.Ocr
|
||||
{
|
||||
OcrParams AppLevelParams()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(appConfigManager.Config.OcrDefaultLanguage))
|
||||
if (!string.IsNullOrWhiteSpace(AppConfig.Current.OcrDefaultLanguage))
|
||||
{
|
||||
return new OcrParams(appConfigManager.Config.OcrDefaultLanguage, appConfigManager.Config.OcrDefaultMode);
|
||||
return new OcrParams(AppConfig.Current.OcrDefaultLanguage, AppConfig.Current.OcrDefaultMode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
OcrParams UserLevelParams()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(userConfigManager.Config.OcrLanguageCode))
|
||||
if (!string.IsNullOrWhiteSpace(UserConfig.Current.OcrLanguageCode))
|
||||
{
|
||||
return new OcrParams(userConfigManager.Config.OcrLanguageCode, userConfigManager.Config.OcrMode);
|
||||
return new OcrParams(UserConfig.Current.OcrLanguageCode, UserConfig.Current.OcrMode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -81,16 +75,16 @@ namespace NAPS2.Ocr
|
||||
OcrParams ArbitraryParams() => new OcrParams(ActiveEngine?.InstalledLanguages.OrderBy(x => x.Name).Select(x => x.Code).FirstOrDefault(), OcrMode.Default);
|
||||
|
||||
// Prioritize app-level overrides
|
||||
if (appConfigManager.Config.OcrState == OcrState.Disabled)
|
||||
if (AppConfig.Current.OcrState == OcrState.Disabled)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (appConfigManager.Config.OcrState == OcrState.Enabled)
|
||||
if (AppConfig.Current.OcrState == OcrState.Enabled)
|
||||
{
|
||||
return AppLevelParams() ?? UserLevelParams() ?? ArbitraryParams();
|
||||
}
|
||||
// No overrides, so prioritize the user settings
|
||||
if (userConfigManager.Config.EnableOcr)
|
||||
if (UserConfig.Current.EnableOcr)
|
||||
{
|
||||
return UserLevelParams() ?? AppLevelParams() ?? ArbitraryParams();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace NAPS2.Ocr
|
||||
{
|
||||
public class Tesseract302Engine : TesseractBaseEngine
|
||||
{
|
||||
public Tesseract302Engine(AppConfigManager appConfigManager, ComponentManager componentManager) : base(appConfigManager)
|
||||
public Tesseract302Engine(ComponentManager componentManager)
|
||||
{
|
||||
// Using the newer data since we just need the 302 engine for backwards compatibility
|
||||
LanguageData = TesseractLanguageData.V304;
|
||||
|
@ -16,7 +16,7 @@ namespace NAPS2.Ocr
|
||||
new DownloadMirror(PlatformSupport.WindowsXp, @"http://xp-mirror.naps2.com/tesseract-3.04/{0}")
|
||||
};
|
||||
|
||||
public Tesseract304Engine(AppConfigManager appConfigManager, ComponentManager componentManager) : base(appConfigManager)
|
||||
public Tesseract304Engine(ComponentManager componentManager)
|
||||
{
|
||||
LanguageData = TesseractLanguageData.V304;
|
||||
TesseractBasePath = Path.Combine(componentManager.BasePath, "tesseract-3.0.4");
|
||||
|
@ -9,7 +9,7 @@ namespace NAPS2.Ocr
|
||||
{
|
||||
public class Tesseract304XpEngine : Tesseract304Engine
|
||||
{
|
||||
public Tesseract304XpEngine(AppConfigManager appConfigManager, ComponentManager componentManager) : base(appConfigManager, componentManager)
|
||||
public Tesseract304XpEngine(ComponentManager componentManager) : base(componentManager)
|
||||
{
|
||||
TesseractExePath = "tesseract_xp.exe";
|
||||
PlatformSupport = PlatformSupport.Windows;
|
||||
|
@ -15,7 +15,7 @@ namespace NAPS2.Ocr
|
||||
new DownloadMirror(PlatformSupport.ModernWindows.Or(PlatformSupport.Linux), @"https://sourceforge.net/projects/naps2/files/components/tesseract-4.0.0b4/{0}/download")
|
||||
};
|
||||
|
||||
public Tesseract400Beta4Engine(AppConfigManager appConfigManager, ComponentManager componentManager) : base(appConfigManager)
|
||||
public Tesseract400Beta4Engine(ComponentManager componentManager)
|
||||
{
|
||||
string exeFolder = Environment.Is64BitProcess ? "w64" : "w32";
|
||||
LanguageData = TesseractLanguageData.V400B4;
|
||||
|
@ -18,13 +18,6 @@ namespace NAPS2.Ocr
|
||||
private const int DEFAULT_TIMEOUT = 600 * 1000;
|
||||
private const int CHECK_INTERVAL = 500;
|
||||
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
protected TesseractBaseEngine(AppConfigManager appConfigManager)
|
||||
{
|
||||
this.appConfigManager = appConfigManager;
|
||||
}
|
||||
|
||||
public bool CanProcess(string langCode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(langCode) || !IsInstalled || !IsSupported)
|
||||
@ -67,7 +60,7 @@ namespace NAPS2.Ocr
|
||||
Log.Error("Couldn't start OCR process.");
|
||||
return null;
|
||||
}
|
||||
var timeout = (int)(appConfigManager.Config.OcrTimeoutInSeconds * 1000);
|
||||
var timeout = (int)(AppConfig.Current.OcrTimeoutInSeconds * 1000);
|
||||
if (timeout == 0)
|
||||
{
|
||||
timeout = DEFAULT_TIMEOUT;
|
||||
|
@ -15,7 +15,7 @@ namespace NAPS2.Ocr
|
||||
private DateTime? installCheckTime;
|
||||
private List<Language> installedLanguages;
|
||||
|
||||
public TesseractSystemEngine(AppConfigManager appConfigManager) : base(appConfigManager)
|
||||
public TesseractSystemEngine()
|
||||
{
|
||||
// Use the most complete set of language mappings
|
||||
LanguageData = TesseractLanguageData.V400B4;
|
||||
|
@ -9,8 +9,8 @@ namespace NAPS2.Scan.Images
|
||||
{
|
||||
public class NullThumbnailRenderer : ThumbnailRenderer
|
||||
{
|
||||
public NullThumbnailRenderer(IUserConfigManager userConfigManager, ScannedImageRenderer scannedImageRenderer)
|
||||
: base(userConfigManager, scannedImageRenderer)
|
||||
public NullThumbnailRenderer(ScannedImageRenderer scannedImageRenderer)
|
||||
: base(scannedImageRenderer)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -104,18 +104,14 @@ namespace NAPS2.Scan.Images
|
||||
private readonly ThumbnailRenderer thumbnailRenderer;
|
||||
private readonly IOperationFactory operationFactory;
|
||||
private readonly IOperationProgress operationProgress;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly OcrRequestQueue ocrRequestQueue;
|
||||
private readonly OcrManager ocrManager;
|
||||
|
||||
public ScannedImageHelper(ThumbnailRenderer thumbnailRenderer, IOperationFactory operationFactory, IOperationProgress operationProgress, AppConfigManager appConfigManager, IUserConfigManager userConfigManager, OcrRequestQueue ocrRequestQueue, OcrManager ocrManager)
|
||||
public ScannedImageHelper(ThumbnailRenderer thumbnailRenderer, IOperationFactory operationFactory, IOperationProgress operationProgress, OcrRequestQueue ocrRequestQueue, OcrManager ocrManager)
|
||||
{
|
||||
this.thumbnailRenderer = thumbnailRenderer;
|
||||
this.operationFactory = operationFactory;
|
||||
this.operationProgress = operationProgress;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.ocrRequestQueue = ocrRequestQueue;
|
||||
this.ocrManager = ocrManager;
|
||||
}
|
||||
@ -218,9 +214,9 @@ namespace NAPS2.Scan.Images
|
||||
public bool ShouldDoBackgroundOcr(ScanParams scanParams)
|
||||
{
|
||||
bool ocrEnabled = ocrManager.DefaultParams != null;
|
||||
bool afterScanning = appConfigManager.Config.OcrState == OcrState.Enabled && appConfigManager.Config.OcrDefaultAfterScanning
|
||||
|| appConfigManager.Config.OcrState == OcrState.UserConfig &&
|
||||
(userConfigManager.Config.OcrAfterScanning ?? appConfigManager.Config.OcrDefaultAfterScanning);
|
||||
bool afterScanning = AppConfig.Current.OcrState == OcrState.Enabled && AppConfig.Current.OcrDefaultAfterScanning
|
||||
|| AppConfig.Current.OcrState == OcrState.UserConfig &&
|
||||
(UserConfig.Current.OcrAfterScanning ?? AppConfig.Current.OcrDefaultAfterScanning);
|
||||
return scanParams.DoOcr ?? (ocrEnabled && afterScanning);
|
||||
}
|
||||
|
||||
|
@ -51,19 +51,17 @@ namespace NAPS2.Scan.Images
|
||||
}
|
||||
return (size - 832) / 96 + 16;
|
||||
}
|
||||
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
private readonly ScannedImageRenderer scannedImageRenderer;
|
||||
|
||||
public ThumbnailRenderer(IUserConfigManager userConfigManager, ScannedImageRenderer scannedImageRenderer)
|
||||
public ThumbnailRenderer(ScannedImageRenderer scannedImageRenderer)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.scannedImageRenderer = scannedImageRenderer;
|
||||
}
|
||||
|
||||
public Task<Bitmap> RenderThumbnail(ScannedImage scannedImage)
|
||||
{
|
||||
return RenderThumbnail(scannedImage, userConfigManager.Config.ThumbnailSize);
|
||||
return RenderThumbnail(scannedImage, UserConfig.Current.ThumbnailSize);
|
||||
}
|
||||
|
||||
public Task<Bitmap> RenderThumbnail(ScannedImage scannedImage, int size)
|
||||
@ -84,7 +82,7 @@ namespace NAPS2.Scan.Images
|
||||
|
||||
public Bitmap RenderThumbnail(Bitmap b)
|
||||
{
|
||||
return RenderThumbnail(b, userConfigManager.Config.ThumbnailSize);
|
||||
return RenderThumbnail(b, UserConfig.Current.ThumbnailSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -12,25 +12,18 @@ namespace NAPS2.Scan
|
||||
/// </summary>
|
||||
public class ProfileNameTracker
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
public ProfileNameTracker(IUserConfigManager userConfigManager)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
public void RenamingProfile(string oldName, string newName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(oldName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (userConfigManager.Config.LastBatchSettings != null)
|
||||
if (UserConfig.Current.LastBatchSettings != null)
|
||||
{
|
||||
if (userConfigManager.Config.LastBatchSettings.ProfileDisplayName == oldName)
|
||||
if (UserConfig.Current.LastBatchSettings.ProfileDisplayName == oldName)
|
||||
{
|
||||
userConfigManager.Config.LastBatchSettings.ProfileDisplayName = newName;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.LastBatchSettings.ProfileDisplayName = newName;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,12 +34,12 @@ namespace NAPS2.Scan
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (userConfigManager.Config.LastBatchSettings != null)
|
||||
if (UserConfig.Current.LastBatchSettings != null)
|
||||
{
|
||||
if (userConfigManager.Config.LastBatchSettings.ProfileDisplayName == name)
|
||||
if (UserConfig.Current.LastBatchSettings.ProfileDisplayName == name)
|
||||
{
|
||||
userConfigManager.Config.LastBatchSettings.ProfileDisplayName = null;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.LastBatchSettings.ProfileDisplayName = null;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,18 +23,14 @@ namespace NAPS2.Scan
|
||||
private readonly IScanDriverFactory driverFactory;
|
||||
private readonly IErrorOutput errorOutput;
|
||||
private readonly IAutoSave autoSave;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly IProfileManager profileManager;
|
||||
private readonly ScannedImageHelper scannedImageHelper;
|
||||
|
||||
public ScanPerformer(IScanDriverFactory driverFactory, IErrorOutput errorOutput, IAutoSave autoSave, AppConfigManager appConfigManager, IProfileManager profileManager, ScannedImageHelper scannedImageHelper)
|
||||
public ScanPerformer(IScanDriverFactory driverFactory, IErrorOutput errorOutput, IAutoSave autoSave, IProfileManager profileManager)
|
||||
{
|
||||
this.driverFactory = driverFactory;
|
||||
this.errorOutput = errorOutput;
|
||||
this.autoSave = autoSave;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.profileManager = profileManager;
|
||||
this.scannedImageHelper = scannedImageHelper;
|
||||
}
|
||||
|
||||
public async Task PerformScan(ScanProfile scanProfile, ScanParams scanParams, IWin32Window dialogParent, ISaveNotify notify,
|
||||
@ -56,7 +52,7 @@ namespace NAPS2.Scan
|
||||
// User cancelled
|
||||
return;
|
||||
}
|
||||
if (appConfigManager.Config.AlwaysRememberDevice)
|
||||
if (AppConfig.Current.AlwaysRememberDevice)
|
||||
{
|
||||
scanProfile.Device = device;
|
||||
profileManager.Save();
|
||||
@ -73,7 +69,7 @@ namespace NAPS2.Scan
|
||||
int imageCount = 0;
|
||||
var source = driver.Scan().Then(img => imageCount++);
|
||||
|
||||
bool doAutoSave = !scanParams.NoAutoSave && !appConfigManager.Config.DisableAutoSave && scanProfile.EnableAutoSave && scanProfile.AutoSaveSettings != null;
|
||||
bool doAutoSave = !scanParams.NoAutoSave && !AppConfig.Current.DisableAutoSave && scanProfile.EnableAutoSave && scanProfile.AutoSaveSettings != null;
|
||||
if (doAutoSave)
|
||||
{
|
||||
if (scanProfile.AutoSaveSettings.ClearImagesAfterSaving)
|
||||
|
@ -14,18 +14,9 @@ namespace NAPS2.Util
|
||||
/// </summary>
|
||||
public class CultureInitializer
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
public CultureInitializer(IUserConfigManager userConfigManager, AppConfigManager appConfigManager)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.appConfigManager = appConfigManager;
|
||||
}
|
||||
|
||||
public void InitCulture(Thread thread)
|
||||
{
|
||||
var cultureId = userConfigManager.Config.Culture ?? appConfigManager.Config.DefaultCulture;
|
||||
var cultureId = UserConfig.Current.Culture ?? AppConfig.Current.DefaultCulture;
|
||||
if (!string.IsNullOrWhiteSpace(cultureId))
|
||||
{
|
||||
try
|
||||
|
@ -16,16 +16,14 @@ namespace NAPS2.Util
|
||||
public class Lifecycle
|
||||
{
|
||||
private readonly StillImage sti;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly WindowsEventLogger windowsEventLogger;
|
||||
|
||||
private bool shouldCreateEventSource;
|
||||
private int returnCode;
|
||||
|
||||
public Lifecycle(StillImage sti, AppConfigManager appConfigManager, WindowsEventLogger windowsEventLogger)
|
||||
public Lifecycle(StillImage sti, WindowsEventLogger windowsEventLogger)
|
||||
{
|
||||
this.sti = sti;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.windowsEventLogger = windowsEventLogger;
|
||||
}
|
||||
|
||||
@ -174,7 +172,7 @@ namespace NAPS2.Util
|
||||
}
|
||||
|
||||
// Only start one instance if configured for SingleInstance
|
||||
if (appConfigManager.Config.SingleInstance)
|
||||
if (AppConfig.Current.SingleInstance)
|
||||
{
|
||||
// See if there's another NAPS2 process running
|
||||
foreach (var process in GetOtherNaps2Processes())
|
||||
|
@ -10,12 +10,10 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
public class DialogHelper
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly IFormFactory formFactory;
|
||||
|
||||
public DialogHelper(IUserConfigManager userConfigManager, IFormFactory formFactory)
|
||||
public DialogHelper(IFormFactory formFactory)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.formFactory = formFactory;
|
||||
}
|
||||
|
||||
@ -80,7 +78,7 @@ namespace NAPS2.WinForms
|
||||
FileName = Path.GetFileName(defaultPath),
|
||||
InitialDirectory = GetDir(defaultPath)
|
||||
};
|
||||
switch ((userConfigManager.Config.LastImageExt ?? "").ToLowerInvariant())
|
||||
switch ((UserConfig.Current.LastImageExt ?? "").ToLowerInvariant())
|
||||
{
|
||||
case "bmp":
|
||||
sd.FilterIndex = 1;
|
||||
@ -108,8 +106,8 @@ namespace NAPS2.WinForms
|
||||
if (sd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
savePath = sd.FileName;
|
||||
userConfigManager.Config.LastImageExt = (Path.GetExtension(savePath) ?? "").Replace(".", "");
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.LastImageExt = (Path.GetExtension(savePath) ?? "").Replace(".", "");
|
||||
UserConfig.Manager.Save();
|
||||
return true;
|
||||
}
|
||||
savePath = null;
|
||||
|
@ -15,15 +15,13 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
partial class FAbout : FormBase
|
||||
{
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly UpdateChecker updateChecker;
|
||||
|
||||
private bool hasCheckedForUpdates;
|
||||
private UpdateInfo update;
|
||||
|
||||
public FAbout(AppConfigManager appConfigManager, IUserConfigManager userConfigManager, UpdateChecker updateChecker)
|
||||
public FAbout(UpdateChecker updateChecker)
|
||||
{
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.updateChecker = updateChecker;
|
||||
|
||||
RestoreFormState = false;
|
||||
@ -37,7 +35,7 @@ namespace NAPS2.WinForms
|
||||
// Grow the form to fit the copyright text if necessary
|
||||
Width = Math.Max(Width, labelCopyright.Right + 25);
|
||||
|
||||
if (appConfigManager.Config.HideDonateButton)
|
||||
if (AppConfig.Current.HideDonateButton)
|
||||
{
|
||||
btnDonate.Visible = false;
|
||||
}
|
||||
@ -54,7 +52,7 @@ namespace NAPS2.WinForms
|
||||
ConditionalControls.Hide(cbCheckForUpdates, 15);
|
||||
ConditionalControls.Hide(lblUpdateStatus, 5);
|
||||
#else
|
||||
cbCheckForUpdates.Checked = userConfigManager.Config.CheckForUpdates;
|
||||
cbCheckForUpdates.Checked = UserConfig.Current.CheckForUpdates;
|
||||
UpdateControls();
|
||||
DoUpdateCheck();
|
||||
#endif
|
||||
@ -72,8 +70,8 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
else
|
||||
{
|
||||
userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.LastUpdateCheckDate = DateTime.Now;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
update = task.Result;
|
||||
hasCheckedForUpdates = true;
|
||||
@ -122,8 +120,8 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void cbCheckForUpdates_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
userConfigManager.Config.CheckForUpdates = cbCheckForUpdates.Checked;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.CheckForUpdates = cbCheckForUpdates.Checked;
|
||||
UserConfig.Manager.Save();
|
||||
UpdateControls();
|
||||
DoUpdateCheck();
|
||||
}
|
||||
|
@ -11,11 +11,8 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
public partial class FAdvancedScanSettings : FormBase
|
||||
{
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
public FAdvancedScanSettings(AppConfigManager appConfigManager)
|
||||
public FAdvancedScanSettings()
|
||||
{
|
||||
this.appConfigManager = appConfigManager;
|
||||
InitializeComponent();
|
||||
|
||||
AddEnumItems<WiaVersion>(cmbWiaVersion);
|
||||
@ -168,7 +165,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void btnRestoreDefaults_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateValues(appConfigManager.Config.DefaultProfileSettings ?? new ScanProfile { Version = ScanProfile.CURRENT_VERSION });
|
||||
UpdateValues(AppConfig.Current.DefaultProfileSettings ?? new ScanProfile { Version = ScanProfile.CURRENT_VERSION });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ namespace NAPS2.WinForms
|
||||
public const string PATCH_CODE_INFO_URL = "http://www.naps2.com/doc-batch-scan.html#patch-t";
|
||||
|
||||
private readonly IProfileManager profileManager;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly BatchScanPerformer batchScanPerformer;
|
||||
private readonly IErrorOutput errorOutput;
|
||||
private readonly DialogHelper dialogHelper;
|
||||
@ -32,11 +30,9 @@ namespace NAPS2.WinForms
|
||||
private bool batchRunning;
|
||||
private CancellationTokenSource cts = new CancellationTokenSource();
|
||||
|
||||
public FBatchScan(IProfileManager profileManager, AppConfigManager appConfigManager, IUserConfigManager userConfigManager, BatchScanPerformer batchScanPerformer, IErrorOutput errorOutput, DialogHelper dialogHelper)
|
||||
public FBatchScan(IProfileManager profileManager, BatchScanPerformer batchScanPerformer, IErrorOutput errorOutput, DialogHelper dialogHelper)
|
||||
{
|
||||
this.profileManager = profileManager;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.batchScanPerformer = batchScanPerformer;
|
||||
this.errorOutput = errorOutput;
|
||||
this.dialogHelper = dialogHelper;
|
||||
@ -60,11 +56,11 @@ namespace NAPS2.WinForms
|
||||
.RightToForm()
|
||||
.Activate();
|
||||
|
||||
btnAddProfile.Enabled = !(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
|
||||
btnAddProfile.Enabled = !(AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
|
||||
|
||||
ConditionalControls.LockHeight(this);
|
||||
|
||||
BatchSettings = userConfigManager.Config.LastBatchSettings ?? new BatchSettings();
|
||||
BatchSettings = UserConfig.Current.LastBatchSettings ?? new BatchSettings();
|
||||
UpdateUIFromSettings();
|
||||
}
|
||||
|
||||
@ -228,10 +224,10 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void btnAddProfile_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked)))
|
||||
if (!(AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked)))
|
||||
{
|
||||
var fedit = FormFactory.Create<FEditProfile>();
|
||||
fedit.ScanProfile = appConfigManager.Config.DefaultProfileSettings ?? new ScanProfile {Version = ScanProfile.CURRENT_VERSION};
|
||||
fedit.ScanProfile = AppConfig.Current.DefaultProfileSettings ?? new ScanProfile {Version = ScanProfile.CURRENT_VERSION};
|
||||
fedit.ShowDialog();
|
||||
if (fedit.Result)
|
||||
{
|
||||
@ -268,8 +264,8 @@ namespace NAPS2.WinForms
|
||||
DoBatchScan().AssertNoAwait();
|
||||
|
||||
// Save settings for next time (could also do on form close)
|
||||
userConfigManager.Config.LastBatchSettings = BatchSettings;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.LastBatchSettings = BatchSettings;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
|
||||
private void EnableDisableSettings(bool enabled)
|
||||
|
@ -41,7 +41,6 @@ namespace NAPS2.WinForms
|
||||
#region Dependencies
|
||||
|
||||
private readonly StringWrapper stringWrapper;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly RecoveryManager recoveryManager;
|
||||
private readonly OcrManager ocrManager;
|
||||
private readonly IProfileManager profileManager;
|
||||
@ -50,7 +49,6 @@ namespace NAPS2.WinForms
|
||||
private readonly ChangeTracker changeTracker;
|
||||
private readonly StillImage stillImage;
|
||||
private readonly IOperationFactory operationFactory;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly KeyboardShortcutManager ksm;
|
||||
private readonly ThumbnailRenderer thumbnailRenderer;
|
||||
private readonly WinFormsExportHelper exportHelper;
|
||||
@ -75,10 +73,9 @@ namespace NAPS2.WinForms
|
||||
|
||||
#region Initialization and Culture
|
||||
|
||||
public FDesktop(StringWrapper stringWrapper, AppConfigManager appConfigManager, RecoveryManager recoveryManager, OcrManager ocrManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, StillImage stillImage, IOperationFactory operationFactory, IUserConfigManager userConfigManager, KeyboardShortcutManager ksm, ThumbnailRenderer thumbnailRenderer, WinFormsExportHelper exportHelper, ScannedImageRenderer scannedImageRenderer, NotificationManager notify, CultureInitializer cultureInitializer, IWorkerServiceFactory workerServiceFactory, IOperationProgress operationProgress, UpdateChecker updateChecker)
|
||||
public FDesktop(StringWrapper stringWrapper, RecoveryManager recoveryManager, OcrManager ocrManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, StillImage stillImage, IOperationFactory operationFactory, KeyboardShortcutManager ksm, ThumbnailRenderer thumbnailRenderer, WinFormsExportHelper exportHelper, ScannedImageRenderer scannedImageRenderer, NotificationManager notify, CultureInitializer cultureInitializer, IWorkerServiceFactory workerServiceFactory, IOperationProgress operationProgress, UpdateChecker updateChecker)
|
||||
{
|
||||
this.stringWrapper = stringWrapper;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.recoveryManager = recoveryManager;
|
||||
this.ocrManager = ocrManager;
|
||||
this.profileManager = profileManager;
|
||||
@ -87,7 +84,6 @@ namespace NAPS2.WinForms
|
||||
this.changeTracker = changeTracker;
|
||||
this.stillImage = stillImage;
|
||||
this.operationFactory = operationFactory;
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.ksm = ksm;
|
||||
this.thumbnailRenderer = thumbnailRenderer;
|
||||
this.exportHelper = exportHelper;
|
||||
@ -117,31 +113,31 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
imageList.ThumbnailRenderer = thumbnailRenderer;
|
||||
thumbnailList1.ThumbnailRenderer = thumbnailRenderer;
|
||||
int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
|
||||
int thumbnailSize = UserConfig.Current.ThumbnailSize;
|
||||
thumbnailList1.ThumbnailSize = new Size(thumbnailSize, thumbnailSize);
|
||||
SetThumbnailSpacing(thumbnailSize);
|
||||
|
||||
if (appConfigManager.Config.HideOcrButton)
|
||||
if (AppConfig.Current.HideOcrButton)
|
||||
{
|
||||
tStrip.Items.Remove(tsOcr);
|
||||
}
|
||||
if (appConfigManager.Config.HideImportButton)
|
||||
if (AppConfig.Current.HideImportButton)
|
||||
{
|
||||
tStrip.Items.Remove(tsImport);
|
||||
}
|
||||
if (appConfigManager.Config.HideSavePdfButton)
|
||||
if (AppConfig.Current.HideSavePdfButton)
|
||||
{
|
||||
tStrip.Items.Remove(tsdSavePDF);
|
||||
}
|
||||
if (appConfigManager.Config.HideSaveImagesButton)
|
||||
if (AppConfig.Current.HideSaveImagesButton)
|
||||
{
|
||||
tStrip.Items.Remove(tsdSaveImages);
|
||||
}
|
||||
if (appConfigManager.Config.HideEmailButton)
|
||||
if (AppConfig.Current.HideEmailButton)
|
||||
{
|
||||
tStrip.Items.Remove(tsdEmailPDF);
|
||||
}
|
||||
if (appConfigManager.Config.HidePrintButton)
|
||||
if (AppConfig.Current.HidePrintButton)
|
||||
{
|
||||
tStrip.Items.Remove(tsPrint);
|
||||
}
|
||||
@ -264,8 +260,8 @@ namespace NAPS2.WinForms
|
||||
private void SetCulture(string cultureId)
|
||||
{
|
||||
SaveToolStripLocation();
|
||||
UserConfigManager.Config.Culture = cultureId;
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Current.Culture = cultureId;
|
||||
UserConfig.Manager.Save();
|
||||
cultureInitializer.InitCulture(Thread.CurrentThread);
|
||||
|
||||
// Update localized values
|
||||
@ -309,7 +305,7 @@ namespace NAPS2.WinForms
|
||||
});
|
||||
|
||||
// If configured (e.g. by a business), show a customizable message box on application startup.
|
||||
var appConfig = appConfigManager.Config;
|
||||
var appConfig = AppConfig.Current;
|
||||
if (!string.IsNullOrWhiteSpace(appConfig.StartupMessageText))
|
||||
{
|
||||
MessageBox.Show(appConfig.StartupMessageText, appConfig.StartupMessageTitle, MessageBoxButtons.OK,
|
||||
@ -325,24 +321,24 @@ namespace NAPS2.WinForms
|
||||
await RunStillImageEvents();
|
||||
|
||||
// Show a donation prompt after a month of use
|
||||
if (userConfigManager.Config.FirstRunDate == null)
|
||||
if (UserConfig.Current.FirstRunDate == null)
|
||||
{
|
||||
userConfigManager.Config.FirstRunDate = DateTime.Now;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.FirstRunDate = DateTime.Now;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
#if !INSTALLER_MSI
|
||||
else if (!appConfigManager.Config.HideDonateButton &&
|
||||
userConfigManager.Config.LastDonatePromptDate == null &&
|
||||
DateTime.Now - userConfigManager.Config.FirstRunDate > TimeSpan.FromDays(30))
|
||||
else if (!AppConfig.Current.HideDonateButton &&
|
||||
UserConfig.Current.LastDonatePromptDate == null &&
|
||||
DateTime.Now - UserConfig.Current.FirstRunDate > TimeSpan.FromDays(30))
|
||||
{
|
||||
userConfigManager.Config.LastDonatePromptDate = DateTime.Now;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.LastDonatePromptDate = DateTime.Now;
|
||||
UserConfig.Manager.Save();
|
||||
notify.DonatePrompt();
|
||||
}
|
||||
|
||||
if (userConfigManager.Config.CheckForUpdates &&
|
||||
(userConfigManager.Config.LastUpdateCheckDate == null ||
|
||||
userConfigManager.Config.LastUpdateCheckDate < DateTime.Now - updateChecker.CheckInterval))
|
||||
if (UserConfig.Current.CheckForUpdates &&
|
||||
(UserConfig.Current.LastUpdateCheckDate == null ||
|
||||
UserConfig.Current.LastUpdateCheckDate < DateTime.Now - updateChecker.CheckInterval))
|
||||
{
|
||||
updateChecker.CheckForUpdates().ContinueWith(task =>
|
||||
{
|
||||
@ -352,8 +348,8 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
else
|
||||
{
|
||||
userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.LastUpdateCheckDate = DateTime.Now;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
var update = task.Result;
|
||||
if (update != null)
|
||||
@ -474,14 +470,14 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
if (profile == null)
|
||||
{
|
||||
if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
if (AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// No profile for the device we're scanning with, so prompt to create one
|
||||
var editSettingsForm = FormFactory.Create<FEditProfile>();
|
||||
editSettingsForm.ScanProfile = appConfigManager.Config.DefaultProfileSettings ??
|
||||
editSettingsForm.ScanProfile = AppConfig.Current.DefaultProfileSettings ??
|
||||
new ScanProfile { Version = ScanProfile.CURRENT_VERSION };
|
||||
try
|
||||
{
|
||||
@ -535,7 +531,7 @@ namespace NAPS2.WinForms
|
||||
private async Task ScanWithNewProfile()
|
||||
{
|
||||
var editSettingsForm = FormFactory.Create<FEditProfile>();
|
||||
editSettingsForm.ScanProfile = appConfigManager.Config.DefaultProfileSettings ?? new ScanProfile { Version = ScanProfile.CURRENT_VERSION };
|
||||
editSettingsForm.ScanProfile = AppConfig.Current.DefaultProfileSettings ?? new ScanProfile { Version = ScanProfile.CURRENT_VERSION };
|
||||
editSettingsForm.ShowDialog();
|
||||
if (!editSettingsForm.Result)
|
||||
{
|
||||
@ -705,9 +701,9 @@ namespace NAPS2.WinForms
|
||||
ctxSelectAll.Enabled = imageList.Images.Any();
|
||||
|
||||
// Other
|
||||
btnZoomIn.Enabled = imageList.Images.Any() && UserConfigManager.Config.ThumbnailSize < ThumbnailRenderer.MAX_SIZE;
|
||||
btnZoomOut.Enabled = imageList.Images.Any() && UserConfigManager.Config.ThumbnailSize > ThumbnailRenderer.MIN_SIZE;
|
||||
tsNewProfile.Enabled = !(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
|
||||
btnZoomIn.Enabled = imageList.Images.Any() && UserConfig.Current.ThumbnailSize < ThumbnailRenderer.MAX_SIZE;
|
||||
btnZoomOut.Enabled = imageList.Images.Any() && UserConfig.Current.ThumbnailSize > ThumbnailRenderer.MIN_SIZE;
|
||||
tsNewProfile.Enabled = !(AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
|
||||
|
||||
if (PlatformCompat.Runtime.RefreshListViewAfterChange)
|
||||
{
|
||||
@ -761,13 +757,13 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void SaveToolStripLocation()
|
||||
{
|
||||
UserConfigManager.Config.DesktopToolStripDock = tStrip.Parent.Dock;
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Current.DesktopToolStripDock = tStrip.Parent.Dock;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
|
||||
private void LoadToolStripLocation()
|
||||
{
|
||||
var dock = UserConfigManager.Config.DesktopToolStripDock;
|
||||
var dock = UserConfig.Current.DesktopToolStripDock;
|
||||
if (dock != DockStyle.None)
|
||||
{
|
||||
var panel = toolStripContainer1.Controls.OfType<ToolStripPanel>().FirstOrDefault(x => x.Dock == dock);
|
||||
@ -938,7 +934,7 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
if (await exportHelper.SavePDF(images, notify))
|
||||
{
|
||||
if (appConfigManager.Config.DeleteAfterSaving)
|
||||
if (AppConfig.Current.DeleteAfterSaving)
|
||||
{
|
||||
SafeInvoke(() =>
|
||||
{
|
||||
@ -953,7 +949,7 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
if (await exportHelper.SaveImages(images, notify))
|
||||
{
|
||||
if (appConfigManager.Config.DeleteAfterSaving)
|
||||
if (AppConfig.Current.DeleteAfterSaving)
|
||||
{
|
||||
imageList.Delete(imageList.Images.IndiciesOf(images));
|
||||
DeleteThumbnails();
|
||||
@ -1043,7 +1039,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
// Configured
|
||||
|
||||
var ks = userConfigManager.Config.KeyboardShortcuts ?? appConfigManager.Config.KeyboardShortcuts ?? new KeyboardShortcuts();
|
||||
var ks = UserConfig.Current.KeyboardShortcuts ?? AppConfig.Current.KeyboardShortcuts ?? new KeyboardShortcuts();
|
||||
|
||||
ksm.Assign(ks.About, tsAbout);
|
||||
ksm.Assign(ks.BatchScan, tsBatchScan);
|
||||
@ -1103,7 +1099,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private string GetProfileShortcut(int i)
|
||||
{
|
||||
var ks = userConfigManager.Config.KeyboardShortcuts ?? appConfigManager.Config.KeyboardShortcuts ?? new KeyboardShortcuts();
|
||||
var ks = UserConfig.Current.KeyboardShortcuts ?? AppConfig.Current.KeyboardShortcuts ?? new KeyboardShortcuts();
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
@ -1208,12 +1204,12 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsOcr_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideOcrButton)
|
||||
if (AppConfig.Current.HideOcrButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ocrManager.MustUpgrade && !appConfigManager.Config.NoUpdatePrompt)
|
||||
if (ocrManager.MustUpgrade && !AppConfig.Current.NoUpdatePrompt)
|
||||
{
|
||||
// Re-download a fixed version on Windows XP if needed
|
||||
MessageBox.Show(MiscResources.OcrUpdateAvailable, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
@ -1229,7 +1225,7 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
else if (ocrManager.IsReady)
|
||||
{
|
||||
if (ocrManager.CanUpgrade && !appConfigManager.Config.NoUpdatePrompt)
|
||||
if (ocrManager.CanUpgrade && !AppConfig.Current.NoUpdatePrompt)
|
||||
{
|
||||
MessageBox.Show(MiscResources.OcrUpdateAvailable, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
FormFactory.Create<FOcrLanguageDownload>().ShowDialog();
|
||||
@ -1248,7 +1244,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideImportButton)
|
||||
if (AppConfig.Current.HideImportButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1258,12 +1254,12 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsdSavePDF_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideSavePdfButton)
|
||||
if (AppConfig.Current.HideSavePdfButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var action = appConfigManager.Config.SaveButtonDefaultAction;
|
||||
var action = AppConfig.Current.SaveButtonDefaultAction;
|
||||
|
||||
if (action == SaveButtonDefaultAction.AlwaysPrompt
|
||||
|| action == SaveButtonDefaultAction.PromptIfSelected && SelectedIndices.Any())
|
||||
@ -1282,12 +1278,12 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsdSaveImages_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideSaveImagesButton)
|
||||
if (AppConfig.Current.HideSaveImagesButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var action = appConfigManager.Config.SaveButtonDefaultAction;
|
||||
var action = AppConfig.Current.SaveButtonDefaultAction;
|
||||
|
||||
if (action == SaveButtonDefaultAction.AlwaysPrompt
|
||||
|| action == SaveButtonDefaultAction.PromptIfSelected && SelectedIndices.Any())
|
||||
@ -1306,12 +1302,12 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsdEmailPDF_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideEmailButton)
|
||||
if (AppConfig.Current.HideEmailButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var action = appConfigManager.Config.SaveButtonDefaultAction;
|
||||
var action = AppConfig.Current.SaveButtonDefaultAction;
|
||||
|
||||
if (action == SaveButtonDefaultAction.AlwaysPrompt
|
||||
|| action == SaveButtonDefaultAction.PromptIfSelected && SelectedIndices.Any())
|
||||
@ -1330,7 +1326,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private async void tsPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HidePrintButton)
|
||||
if (AppConfig.Current.HidePrintButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1373,7 +1369,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsSavePDFAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideSavePdfButton)
|
||||
if (AppConfig.Current.HideSavePdfButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1383,7 +1379,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsSavePDFSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideSavePdfButton)
|
||||
if (AppConfig.Current.HideSavePdfButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1398,7 +1394,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsSaveImagesAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideSaveImagesButton)
|
||||
if (AppConfig.Current.HideSaveImagesButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1408,7 +1404,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsSaveImagesSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideSaveImagesButton)
|
||||
if (AppConfig.Current.HideSaveImagesButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1423,7 +1419,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsEmailPDFAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideEmailButton)
|
||||
if (AppConfig.Current.HideEmailButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1433,7 +1429,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void tsEmailPDFSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.HideEmailButton)
|
||||
if (AppConfig.Current.HideEmailButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1786,7 +1782,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void StepThumbnailSize(double step)
|
||||
{
|
||||
int thumbnailSize = UserConfigManager.Config.ThumbnailSize;
|
||||
int thumbnailSize = UserConfig.Current.ThumbnailSize;
|
||||
thumbnailSize = (int)ThumbnailRenderer.StepNumberToSize(ThumbnailRenderer.SizeToStepNumber(thumbnailSize) + step);
|
||||
thumbnailSize = Math.Max(Math.Min(thumbnailSize, ThumbnailRenderer.MAX_SIZE), ThumbnailRenderer.MIN_SIZE);
|
||||
ResizeThumbnails(thumbnailSize);
|
||||
@ -1806,8 +1802,8 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
|
||||
// Save the new size to config
|
||||
UserConfigManager.Config.ThumbnailSize = thumbnailSize;
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Current.ThumbnailSize = thumbnailSize;
|
||||
UserConfig.Manager.Save();
|
||||
// Adjust the visible thumbnail display with the new size
|
||||
lock (thumbnailList1)
|
||||
{
|
||||
|
@ -22,7 +22,6 @@ namespace NAPS2.WinForms
|
||||
private readonly IScanDriverFactory driverFactory;
|
||||
private readonly IErrorOutput errorOutput;
|
||||
private readonly ProfileNameTracker profileNameTracker;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
private ScanProfile scanProfile;
|
||||
private ScanDevice currentDevice;
|
||||
@ -34,12 +33,11 @@ namespace NAPS2.WinForms
|
||||
|
||||
private bool suppressChangeEvent;
|
||||
|
||||
public FEditProfile(IScanDriverFactory driverFactory, IErrorOutput errorOutput, ProfileNameTracker profileNameTracker, AppConfigManager appConfigManager)
|
||||
public FEditProfile(IScanDriverFactory driverFactory, IErrorOutput errorOutput, ProfileNameTracker profileNameTracker)
|
||||
{
|
||||
this.driverFactory = driverFactory;
|
||||
this.errorOutput = errorOutput;
|
||||
this.profileNameTracker = profileNameTracker;
|
||||
this.appConfigManager = appConfigManager;
|
||||
InitializeComponent();
|
||||
btnNetwork.Left = btnChooseDevice.Right + 6;
|
||||
// TODO: Remove this to reenable
|
||||
@ -131,7 +129,7 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
|
||||
// Custom Presets
|
||||
foreach (var preset in UserConfigManager.Config.CustomPageSizePresets.OrderBy(x => x.Name))
|
||||
foreach (var preset in UserConfig.Current.CustomPageSizePresets.OrderBy(x => x.Name))
|
||||
{
|
||||
cmbPage.Items.Insert(cmbPage.Items.Count - 1, new PageSizeListItem
|
||||
{
|
||||
@ -381,8 +379,8 @@ namespace NAPS2.WinForms
|
||||
txtBrightness.Enabled = settingsEnabled;
|
||||
txtContrast.Enabled = settingsEnabled;
|
||||
|
||||
cbAutoSave.Enabled = !locked && !appConfigManager.Config.DisableAutoSave;
|
||||
linkAutoSaveSettings.Visible = !locked && !appConfigManager.Config.DisableAutoSave;
|
||||
cbAutoSave.Enabled = !locked && !AppConfig.Current.DisableAutoSave;
|
||||
linkAutoSaveSettings.Visible = !locked && !AppConfig.Current.DisableAutoSave;
|
||||
|
||||
btnAdvanced.Enabled = !locked;
|
||||
|
||||
@ -464,7 +462,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void linkAutoSaveSettings_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.DisableAutoSave)
|
||||
if (AppConfig.Current.DisableAutoSave)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using NAPS2.Config;
|
||||
using NAPS2.ImportExport.Email;
|
||||
using NAPS2.ImportExport.Email.Mapi;
|
||||
using NAPS2.ImportExport.Email.Oauth;
|
||||
@ -89,10 +90,10 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void ChooseSystem(string clientName)
|
||||
{
|
||||
UserConfigManager.Config.EmailSetup = UserConfigManager.Config.EmailSetup ?? new EmailSetup();
|
||||
UserConfigManager.Config.EmailSetup.SystemProviderName = clientName == defaultSystemClientName ? null : clientName;
|
||||
UserConfigManager.Config.EmailSetup.ProviderType = EmailProviderType.System;
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Current.EmailSetup = UserConfig.Current.EmailSetup ?? new EmailSetup();
|
||||
UserConfig.Current.EmailSetup.SystemProviderName = clientName == defaultSystemClientName ? null : clientName;
|
||||
UserConfig.Current.EmailSetup.ProviderType = EmailProviderType.System;
|
||||
UserConfig.Manager.Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
@ -128,7 +129,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private EmailProviderWidget GetDefaultWidget()
|
||||
{
|
||||
var setup = UserConfigManager.Config.EmailSetup;
|
||||
var setup = UserConfig.Current.EmailSetup;
|
||||
foreach (var widget in providerWidgets)
|
||||
{
|
||||
if (widget.ProviderType == (setup?.ProviderType ?? EmailProviderType.System))
|
||||
|
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using NAPS2.Config;
|
||||
using NAPS2.ImportExport.Email;
|
||||
using NAPS2.ImportExport.Email.Mapi;
|
||||
using NAPS2.Lang.Resources;
|
||||
@ -33,7 +34,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
UpdateProvider();
|
||||
UpdateValues(emailSettingsContainer.EmailSettings);
|
||||
cbRememberSettings.Checked = UserConfigManager.Config.EmailSettings != null;
|
||||
cbRememberSettings.Checked = UserConfig.Current.EmailSettings != null;
|
||||
}
|
||||
|
||||
private void UpdateValues(EmailSettings emailSettings)
|
||||
@ -43,7 +44,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void UpdateProvider()
|
||||
{
|
||||
var setup = UserConfigManager.Config.EmailSetup;
|
||||
var setup = UserConfig.Current.EmailSetup;
|
||||
switch (setup?.ProviderType)
|
||||
{
|
||||
case EmailProviderType.Gmail:
|
||||
@ -72,8 +73,8 @@ namespace NAPS2.WinForms
|
||||
};
|
||||
|
||||
emailSettingsContainer.EmailSettings = emailSettings;
|
||||
UserConfigManager.Config.EmailSettings = cbRememberSettings.Checked ? emailSettings : null;
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Current.EmailSettings = cbRememberSettings.Checked ? emailSettings : null;
|
||||
UserConfig.Manager.Save();
|
||||
|
||||
Close();
|
||||
}
|
||||
|
@ -12,13 +12,11 @@ namespace NAPS2.WinForms
|
||||
public partial class FImageSettings : FormBase
|
||||
{
|
||||
private readonly ImageSettingsContainer imageSettingsContainer;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly DialogHelper dialogHelper;
|
||||
|
||||
public FImageSettings(ImageSettingsContainer imageSettingsContainer, IUserConfigManager userConfigManager, DialogHelper dialogHelper)
|
||||
public FImageSettings(ImageSettingsContainer imageSettingsContainer, DialogHelper dialogHelper)
|
||||
{
|
||||
this.imageSettingsContainer = imageSettingsContainer;
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.dialogHelper = dialogHelper;
|
||||
InitializeComponent();
|
||||
AddEnumItems<TiffCompression>(cmbTiffCompr);
|
||||
@ -37,7 +35,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
UpdateValues(imageSettingsContainer.ImageSettings);
|
||||
UpdateEnabled();
|
||||
cbRememberSettings.Checked = userConfigManager.Config.ImageSettings != null;
|
||||
cbRememberSettings.Checked = UserConfig.Current.ImageSettings != null;
|
||||
}
|
||||
|
||||
private void UpdateValues(ImageSettings imageSettings)
|
||||
@ -71,8 +69,8 @@ namespace NAPS2.WinForms
|
||||
};
|
||||
|
||||
imageSettingsContainer.ImageSettings = imageSettings;
|
||||
userConfigManager.Config.ImageSettings = cbRememberSettings.Checked ? imageSettings : null;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.ImageSettings = cbRememberSettings.Checked ? imageSettings : null;
|
||||
UserConfig.Manager.Save();
|
||||
|
||||
Close();
|
||||
}
|
||||
|
@ -12,13 +12,11 @@ namespace NAPS2.WinForms
|
||||
public partial class FOcrSetup : FormBase
|
||||
{
|
||||
private readonly OcrManager ocrManager;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly List<OcrMode> availableModes;
|
||||
|
||||
public FOcrSetup(OcrManager ocrManager, AppConfigManager appConfigManager)
|
||||
public FOcrSetup(OcrManager ocrManager)
|
||||
{
|
||||
this.ocrManager = ocrManager;
|
||||
this.appConfigManager = appConfigManager;
|
||||
InitializeComponent();
|
||||
|
||||
comboOcrMode.Format += (sender, e) => e.Value = ((Enum)e.ListItem).Description();
|
||||
@ -50,14 +48,14 @@ namespace NAPS2.WinForms
|
||||
labelOcrMode.Visible = availableModes != null;
|
||||
ConditionalControls.LockHeight(this);
|
||||
|
||||
if (appConfigManager.Config.OcrState == OcrState.Enabled)
|
||||
if (AppConfig.Current.OcrState == OcrState.Enabled)
|
||||
{
|
||||
checkBoxEnableOcr.Checked = true;
|
||||
SetSelectedValue(comboLanguages, appConfigManager.Config.OcrDefaultLanguage ?? "");
|
||||
SetSelectedItem(comboOcrMode, appConfigManager.Config.OcrDefaultMode);
|
||||
checkBoxRunInBG.Checked = appConfigManager.Config.OcrDefaultAfterScanning;
|
||||
SetSelectedValue(comboLanguages, AppConfig.Current.OcrDefaultLanguage ?? "");
|
||||
SetSelectedItem(comboOcrMode, AppConfig.Current.OcrDefaultMode);
|
||||
checkBoxRunInBG.Checked = AppConfig.Current.OcrDefaultAfterScanning;
|
||||
}
|
||||
else if (appConfigManager.Config.OcrState == OcrState.Disabled)
|
||||
else if (AppConfig.Current.OcrState == OcrState.Disabled)
|
||||
{
|
||||
checkBoxEnableOcr.Checked = false;
|
||||
comboLanguages.SelectedValue = "";
|
||||
@ -66,10 +64,10 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBoxEnableOcr.Checked = UserConfigManager.Config.EnableOcr;
|
||||
SetSelectedValue(comboLanguages, UserConfigManager.Config.OcrLanguageCode ?? appConfigManager.Config.OcrDefaultLanguage ?? "");
|
||||
SetSelectedItem(comboOcrMode, UserConfigManager.Config.OcrMode == OcrMode.Default ? appConfigManager.Config.OcrDefaultMode : UserConfigManager.Config.OcrMode);
|
||||
checkBoxRunInBG.Checked = UserConfigManager.Config.OcrAfterScanning ?? appConfigManager.Config.OcrDefaultAfterScanning;
|
||||
checkBoxEnableOcr.Checked = UserConfig.Current.EnableOcr;
|
||||
SetSelectedValue(comboLanguages, UserConfig.Current.OcrLanguageCode ?? AppConfig.Current.OcrDefaultLanguage ?? "");
|
||||
SetSelectedItem(comboOcrMode, UserConfig.Current.OcrMode == OcrMode.Default ? AppConfig.Current.OcrDefaultMode : UserConfig.Current.OcrMode);
|
||||
checkBoxRunInBG.Checked = UserConfig.Current.OcrAfterScanning ?? AppConfig.Current.OcrDefaultAfterScanning;
|
||||
}
|
||||
|
||||
UpdateView();
|
||||
@ -107,10 +105,10 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void UpdateView()
|
||||
{
|
||||
bool canChangeEnabled = appConfigManager.Config.OcrState == OcrState.UserConfig;
|
||||
bool canChangeLanguage = appConfigManager.Config.OcrState == OcrState.UserConfig
|
||||
|| appConfigManager.Config.OcrState == OcrState.Enabled
|
||||
&& string.IsNullOrWhiteSpace(appConfigManager.Config.OcrDefaultLanguage);
|
||||
bool canChangeEnabled = AppConfig.Current.OcrState == OcrState.UserConfig;
|
||||
bool canChangeLanguage = AppConfig.Current.OcrState == OcrState.UserConfig
|
||||
|| AppConfig.Current.OcrState == OcrState.Enabled
|
||||
&& string.IsNullOrWhiteSpace(AppConfig.Current.OcrDefaultLanguage);
|
||||
checkBoxEnableOcr.Enabled = canChangeEnabled;
|
||||
comboLanguages.Enabled = checkBoxEnableOcr.Checked && canChangeLanguage;
|
||||
linkGetLanguages.Enabled = canChangeLanguage;
|
||||
@ -140,13 +138,13 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.OcrState == OcrState.UserConfig)
|
||||
if (AppConfig.Current.OcrState == OcrState.UserConfig)
|
||||
{
|
||||
UserConfigManager.Config.EnableOcr = checkBoxEnableOcr.Checked;
|
||||
UserConfigManager.Config.OcrLanguageCode = (string) comboLanguages.SelectedValue;
|
||||
UserConfigManager.Config.OcrMode = availableModes != null ? (OcrMode) comboOcrMode.SelectedItem : OcrMode.Default;
|
||||
UserConfigManager.Config.OcrAfterScanning = checkBoxRunInBG.Checked;
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Current.EnableOcr = checkBoxEnableOcr.Checked;
|
||||
UserConfig.Current.OcrLanguageCode = (string) comboLanguages.SelectedValue;
|
||||
UserConfig.Current.OcrMode = availableModes != null ? (OcrMode) comboOcrMode.SelectedItem : OcrMode.Default;
|
||||
UserConfig.Current.OcrAfterScanning = checkBoxRunInBG.Checked;
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
Close();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using NAPS2.Config;
|
||||
using NAPS2.Lang.Resources;
|
||||
using NAPS2.Scan;
|
||||
|
||||
@ -52,7 +53,7 @@ namespace NAPS2.WinForms
|
||||
private void UpdateDropdown()
|
||||
{
|
||||
comboName.Items.Clear();
|
||||
foreach (var preset in UserConfigManager.Config.CustomPageSizePresets.OrderBy(x => x.Name))
|
||||
foreach (var preset in UserConfig.Current.CustomPageSizePresets.OrderBy(x => x.Name))
|
||||
{
|
||||
comboName.Items.Add(preset.Name);
|
||||
}
|
||||
@ -67,7 +68,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void comboName_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
var presets = UserConfigManager.Config.CustomPageSizePresets;
|
||||
var presets = UserConfig.Current.CustomPageSizePresets;
|
||||
var dimens = presets.Where(x => x.Name == (string)comboName.SelectedItem).Select(x => x.Dimens).FirstOrDefault();
|
||||
if (dimens != null)
|
||||
{
|
||||
@ -77,7 +78,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void comboName_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var presets = UserConfigManager.Config.CustomPageSizePresets;
|
||||
var presets = UserConfig.Current.CustomPageSizePresets;
|
||||
btnDelete.Enabled = presets.Any(x => x.Name == comboName.Text);
|
||||
}
|
||||
|
||||
@ -109,14 +110,14 @@ namespace NAPS2.WinForms
|
||||
if (!string.IsNullOrWhiteSpace(comboName.Text))
|
||||
{
|
||||
PageSizeName = comboName.Text;
|
||||
var presets = UserConfigManager.Config.CustomPageSizePresets;
|
||||
var presets = UserConfig.Current.CustomPageSizePresets;
|
||||
presets.RemoveAll(x => x.Name == PageSizeName);
|
||||
presets.Add(new NamedPageSize
|
||||
{
|
||||
Name = PageSizeName,
|
||||
Dimens = PageSizeDimens
|
||||
});
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
@ -126,9 +127,9 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
if (MessageBox.Show(string.Format(MiscResources.ConfirmDelete, comboName.Text), MiscResources.Delete, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
||||
{
|
||||
var presets = UserConfigManager.Config.CustomPageSizePresets;
|
||||
var presets = UserConfig.Current.CustomPageSizePresets;
|
||||
presets.RemoveAll(x => x.Name == comboName.Text);
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Manager.Save();
|
||||
|
||||
UpdateDropdown();
|
||||
comboName.Text = "";
|
||||
|
@ -11,16 +11,12 @@ namespace NAPS2.WinForms
|
||||
public partial class FPdfSettings : FormBase
|
||||
{
|
||||
private readonly PdfSettingsContainer pdfSettingsContainer;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly DialogHelper dialogHelper;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
public FPdfSettings(PdfSettingsContainer pdfSettingsContainer, IUserConfigManager userConfigManager, DialogHelper dialogHelper, AppConfigManager appConfigManager)
|
||||
public FPdfSettings(PdfSettingsContainer pdfSettingsContainer, DialogHelper dialogHelper)
|
||||
{
|
||||
this.pdfSettingsContainer = pdfSettingsContainer;
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.dialogHelper = dialogHelper;
|
||||
this.appConfigManager = appConfigManager;
|
||||
InitializeComponent();
|
||||
AddEnumItems<PdfCompat>(cmbCompat);
|
||||
}
|
||||
@ -38,7 +34,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
UpdateValues(pdfSettingsContainer.PdfSettings);
|
||||
UpdateEnabled();
|
||||
cbRememberSettings.Checked = userConfigManager.Config.PdfSettings != null;
|
||||
cbRememberSettings.Checked = UserConfig.Current.PdfSettings != null;
|
||||
}
|
||||
|
||||
private void UpdateValues(PdfSettings pdfSettings)
|
||||
@ -60,7 +56,7 @@ namespace NAPS2.WinForms
|
||||
clbPerms.SetItemChecked(5, pdfSettings.Encryption.AllowContentCopyingForAccessibility);
|
||||
clbPerms.SetItemChecked(6, pdfSettings.Encryption.AllowAnnotations);
|
||||
clbPerms.SetItemChecked(7, pdfSettings.Encryption.AllowFormFilling);
|
||||
var forced = appConfigManager.Config.ForcePdfCompat;
|
||||
var forced = AppConfig.Current.ForcePdfCompat;
|
||||
cmbCompat.SelectedIndex = (int)(forced == PdfCompat.Default ? pdfSettings.Compat : forced);
|
||||
}
|
||||
|
||||
@ -73,7 +69,7 @@ namespace NAPS2.WinForms
|
||||
lblUserPassword.Enabled = lblOwnerPassword.Enabled = encrypt;
|
||||
clbPerms.Enabled = encrypt;
|
||||
|
||||
cmbCompat.Enabled = appConfigManager.Config.ForcePdfCompat == PdfCompat.Default;
|
||||
cmbCompat.Enabled = AppConfig.Current.ForcePdfCompat == PdfCompat.Default;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
@ -107,8 +103,8 @@ namespace NAPS2.WinForms
|
||||
};
|
||||
|
||||
pdfSettingsContainer.PdfSettings = pdfSettings;
|
||||
userConfigManager.Config.PdfSettings = cbRememberSettings.Checked ? pdfSettings : null;
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.PdfSettings = cbRememberSettings.Checked ? pdfSettings : null;
|
||||
UserConfig.Manager.Save();
|
||||
|
||||
Close();
|
||||
}
|
||||
|
@ -22,15 +22,13 @@ namespace NAPS2.WinForms
|
||||
private const int DEFAULT_LOCK_PROFILE_ICON_ID = 5;
|
||||
|
||||
private readonly IProfileManager profileManager;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private readonly IconButtonSizer iconButtonSizer;
|
||||
private readonly IScanPerformer scanPerformer;
|
||||
private readonly ProfileNameTracker profileNameTracker;
|
||||
|
||||
public FProfiles(IProfileManager profileManager, AppConfigManager appConfigManager, IconButtonSizer iconButtonSizer, IScanPerformer scanPerformer, ProfileNameTracker profileNameTracker)
|
||||
public FProfiles(IProfileManager profileManager, IconButtonSizer iconButtonSizer, IScanPerformer scanPerformer, ProfileNameTracker profileNameTracker)
|
||||
{
|
||||
this.profileManager = profileManager;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.iconButtonSizer = iconButtonSizer;
|
||||
this.scanPerformer = scanPerformer;
|
||||
this.profileNameTracker = profileNameTracker;
|
||||
@ -62,13 +60,13 @@ namespace NAPS2.WinForms
|
||||
protected override void OnLoad(object sender, EventArgs e)
|
||||
{
|
||||
lvProfiles.LargeImageList = ilProfileIcons.IconsList;
|
||||
btnAdd.Enabled = !(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
|
||||
btnAdd.Enabled = !(AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked));
|
||||
btnEdit.Enabled = false;
|
||||
btnDelete.Enabled = false;
|
||||
UpdateProfiles();
|
||||
SelectProfile(x => x.IsDefault);
|
||||
|
||||
if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
if (AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
{
|
||||
contextMenuStrip.Items.Remove(ctxCopy);
|
||||
contextMenuStrip.Items.Remove(ctxPaste);
|
||||
@ -134,7 +132,7 @@ namespace NAPS2.WinForms
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var fedit = FormFactory.Create<FEditProfile>();
|
||||
fedit.ScanProfile = appConfigManager.Config.DefaultProfileSettings ?? new ScanProfile { Version = ScanProfile.CURRENT_VERSION };
|
||||
fedit.ScanProfile = AppConfig.Current.DefaultProfileSettings ?? new ScanProfile { Version = ScanProfile.CURRENT_VERSION };
|
||||
fedit.ShowDialog();
|
||||
if (fedit.Result)
|
||||
{
|
||||
@ -352,7 +350,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void ctxPaste_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
if (AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -383,7 +381,7 @@ namespace NAPS2.WinForms
|
||||
private void lvProfiles_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
// Determine if drop data is compatible
|
||||
if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
if (AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -417,7 +415,7 @@ namespace NAPS2.WinForms
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked)))
|
||||
if (!(AppConfig.Current.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked)))
|
||||
{
|
||||
AddProfile(data.ScanProfile);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using NAPS2.ClientServer;
|
||||
using NAPS2.Config;
|
||||
using NAPS2.Lang.Resources;
|
||||
using NAPS2.Scan;
|
||||
|
||||
@ -63,7 +64,7 @@ namespace NAPS2.WinForms
|
||||
private void UpdateDropdown()
|
||||
{
|
||||
comboName.Items.Clear();
|
||||
foreach (var proxyConfig in UserConfigManager.Config.SavedProxies.OrderBy(x => x.Name))
|
||||
foreach (var proxyConfig in UserConfig.Current.SavedProxies.OrderBy(x => x.Name))
|
||||
{
|
||||
comboName.Items.Add(proxyConfig.Name);
|
||||
}
|
||||
@ -80,7 +81,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void comboName_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
var savedProxies = UserConfigManager.Config.SavedProxies;
|
||||
var savedProxies = UserConfig.Current.SavedProxies;
|
||||
var proxyConfig = savedProxies.FirstOrDefault(x => x.Name == (string)comboName.SelectedItem);
|
||||
if (proxyConfig != null)
|
||||
{
|
||||
@ -91,7 +92,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void comboName_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var savedProxies = UserConfigManager.Config.SavedProxies;
|
||||
var savedProxies = UserConfig.Current.SavedProxies;
|
||||
btnDelete.Enabled = savedProxies.Any(x => x.Name == comboName.Text);
|
||||
}
|
||||
|
||||
@ -129,10 +130,10 @@ namespace NAPS2.WinForms
|
||||
};
|
||||
if (!string.IsNullOrWhiteSpace(comboName.Text))
|
||||
{
|
||||
var savedProxies = UserConfigManager.Config.SavedProxies;
|
||||
var savedProxies = UserConfig.Current.SavedProxies;
|
||||
savedProxies.RemoveAll(x => x.Name == ProxyConfig.Name);
|
||||
savedProxies.Add(ProxyConfig);
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Manager.Save();
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
@ -142,9 +143,9 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
if (MessageBox.Show(string.Format(MiscResources.ConfirmDelete, comboName.Text), MiscResources.Delete, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
||||
{
|
||||
var savedProxies = UserConfigManager.Config.SavedProxies;
|
||||
var savedProxies = UserConfig.Current.SavedProxies;
|
||||
savedProxies.RemoveAll(x => x.Name == comboName.Text);
|
||||
UserConfigManager.Save();
|
||||
UserConfig.Manager.Save();
|
||||
|
||||
ProxyConfig = new ScanProxyConfig();
|
||||
UpdateDropdown();
|
||||
|
@ -42,24 +42,20 @@ namespace NAPS2.WinForms
|
||||
private ToolStripButton tsSaveImage;
|
||||
private readonly IOperationFactory operationFactory;
|
||||
private readonly WinFormsExportHelper exportHelper;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
private ToolStripButton tsHueSaturation;
|
||||
private ToolStripButton tsBlackWhite;
|
||||
private ToolStripButton tsSharpen;
|
||||
private readonly ScannedImageRenderer scannedImageRenderer;
|
||||
private readonly KeyboardShortcutManager ksm;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
private readonly IOperationProgress operationProgress;
|
||||
|
||||
public FViewer(ChangeTracker changeTracker, IOperationFactory operationFactory, WinFormsExportHelper exportHelper, AppConfigManager appConfigManager, ScannedImageRenderer scannedImageRenderer, KeyboardShortcutManager ksm, IUserConfigManager userConfigManager, IOperationProgress operationProgress)
|
||||
public FViewer(ChangeTracker changeTracker, IOperationFactory operationFactory, WinFormsExportHelper exportHelper, ScannedImageRenderer scannedImageRenderer, KeyboardShortcutManager ksm, IOperationProgress operationProgress)
|
||||
{
|
||||
this.changeTracker = changeTracker;
|
||||
this.operationFactory = operationFactory;
|
||||
this.exportHelper = exportHelper;
|
||||
this.appConfigManager = appConfigManager;
|
||||
this.scannedImageRenderer = scannedImageRenderer;
|
||||
this.ksm = ksm;
|
||||
this.userConfigManager = userConfigManager;
|
||||
this.operationProgress = operationProgress;
|
||||
InitializeComponent();
|
||||
}
|
||||
@ -72,11 +68,11 @@ namespace NAPS2.WinForms
|
||||
protected override async void OnLoad(object sender, EventArgs e)
|
||||
{
|
||||
tbPageCurrent.Visible = PlatformCompat.Runtime.IsToolbarTextboxSupported;
|
||||
if (appConfigManager.Config.HideSavePdfButton)
|
||||
if (AppConfig.Current.HideSavePdfButton)
|
||||
{
|
||||
toolStrip1.Items.Remove(tsSavePDF);
|
||||
}
|
||||
if (appConfigManager.Config.HideSaveImagesButton)
|
||||
if (AppConfig.Current.HideSaveImagesButton)
|
||||
{
|
||||
toolStrip1.Items.Remove(tsSaveImage);
|
||||
}
|
||||
@ -517,7 +513,7 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
if (await exportHelper.SavePDF(new List<ScannedImage> { ImageList.Images[ImageIndex] }, null))
|
||||
{
|
||||
if (appConfigManager.Config.DeleteAfterSaving)
|
||||
if (AppConfig.Current.DeleteAfterSaving)
|
||||
{
|
||||
await DeleteCurrentImage();
|
||||
}
|
||||
@ -528,7 +524,7 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
if (await exportHelper.SaveImages(new List<ScannedImage> { ImageList.Images[ImageIndex] }, null))
|
||||
{
|
||||
if (appConfigManager.Config.DeleteAfterSaving)
|
||||
if (AppConfig.Current.DeleteAfterSaving)
|
||||
{
|
||||
await DeleteCurrentImage();
|
||||
}
|
||||
@ -590,7 +586,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
// Configured
|
||||
|
||||
var ks = userConfigManager.Config.KeyboardShortcuts ?? appConfigManager.Config.KeyboardShortcuts ?? new KeyboardShortcuts();
|
||||
var ks = UserConfig.Current.KeyboardShortcuts ?? AppConfig.Current.KeyboardShortcuts ?? new KeyboardShortcuts();
|
||||
|
||||
ksm.Assign(ks.Delete, tsDelete);
|
||||
ksm.Assign(ks.ImageBlackWhite, tsBlackWhite);
|
||||
|
@ -28,8 +28,6 @@ namespace NAPS2.WinForms
|
||||
|
||||
public IFormFactory FormFactory { get; set; }
|
||||
|
||||
public IUserConfigManager UserConfigManager { get; set; }
|
||||
|
||||
protected bool RestoreFormState { get; set; }
|
||||
|
||||
protected bool SaveFormState { get; set; }
|
||||
@ -40,12 +38,12 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
get
|
||||
{
|
||||
if (UserConfigManager == null)
|
||||
if (UserConfig.Manager == null)
|
||||
{
|
||||
// Should only occur with the designer
|
||||
return new List<FormState>();
|
||||
}
|
||||
return UserConfigManager.Config.FormStates;
|
||||
return UserConfig.Current.FormStates;
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +205,7 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
if (SaveFormState)
|
||||
{
|
||||
UserConfigManager?.Save();
|
||||
UserConfig.Manager?.Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,16 +15,9 @@ namespace NAPS2.WinForms
|
||||
private const int PADDING_X = 25, PADDING_Y = 25;
|
||||
private const int SPACING_Y = 20;
|
||||
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
private readonly List<NotifyWidgetBase> slots = new List<NotifyWidgetBase>();
|
||||
private FormBase parentForm;
|
||||
|
||||
public NotificationManager(AppConfigManager appConfigManager)
|
||||
{
|
||||
this.appConfigManager = appConfigManager;
|
||||
}
|
||||
|
||||
public FormBase ParentForm
|
||||
{
|
||||
get => parentForm;
|
||||
@ -82,7 +75,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void Show(NotifyWidgetBase n)
|
||||
{
|
||||
if (appConfigManager.Config.DisableSaveNotifications && n is NotifyWidget)
|
||||
if (AppConfig.Current.DisableSaveNotifications && n is NotifyWidget)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -28,11 +28,9 @@ namespace NAPS2.WinForms
|
||||
private readonly IOperationFactory operationFactory;
|
||||
private readonly IFormFactory formFactory;
|
||||
private readonly OcrManager ocrManager;
|
||||
private readonly IEmailProviderFactory emailProviderFactory;
|
||||
private readonly IOperationProgress operationProgress;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
public WinFormsExportHelper(PdfSettingsContainer pdfSettingsContainer, ImageSettingsContainer imageSettingsContainer, EmailSettingsContainer emailSettingsContainer, DialogHelper dialogHelper, FileNamePlaceholders fileNamePlaceholders, ChangeTracker changeTracker, IOperationFactory operationFactory, IFormFactory formFactory, OcrManager ocrManager, IEmailProviderFactory emailProviderFactory, IOperationProgress operationProgress, IUserConfigManager userConfigManager)
|
||||
public WinFormsExportHelper(PdfSettingsContainer pdfSettingsContainer, ImageSettingsContainer imageSettingsContainer, EmailSettingsContainer emailSettingsContainer, DialogHelper dialogHelper, FileNamePlaceholders fileNamePlaceholders, ChangeTracker changeTracker, IOperationFactory operationFactory, IFormFactory formFactory, OcrManager ocrManager, IOperationProgress operationProgress)
|
||||
{
|
||||
this.pdfSettingsContainer = pdfSettingsContainer;
|
||||
this.imageSettingsContainer = imageSettingsContainer;
|
||||
@ -43,9 +41,7 @@ namespace NAPS2.WinForms
|
||||
this.operationFactory = operationFactory;
|
||||
this.formFactory = formFactory;
|
||||
this.ocrManager = ocrManager;
|
||||
this.emailProviderFactory = emailProviderFactory;
|
||||
this.operationProgress = operationProgress;
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
public async Task<bool> SavePDF(List<ScannedImage> images, ISaveNotify notify)
|
||||
@ -134,7 +130,7 @@ namespace NAPS2.WinForms
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userConfigManager.Config.EmailSetup == null)
|
||||
if (UserConfig.Current.EmailSetup == null)
|
||||
{
|
||||
// First run; prompt for a
|
||||
var form = formFactory.Create<FEmailProvider>();
|
||||
|
@ -13,15 +13,13 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
private readonly IFormFactory formFactory;
|
||||
private readonly NotificationManager notificationManager;
|
||||
private readonly IUserConfigManager userConfigManager;
|
||||
|
||||
private readonly HashSet<IOperation> activeOperations = new HashSet<IOperation>();
|
||||
|
||||
public WinFormsOperationProgress(IFormFactory formFactory, NotificationManager notificationManager, IUserConfigManager userConfigManager)
|
||||
public WinFormsOperationProgress(IFormFactory formFactory, NotificationManager notificationManager)
|
||||
{
|
||||
this.formFactory = formFactory;
|
||||
this.notificationManager = notificationManager;
|
||||
this.userConfigManager = userConfigManager;
|
||||
}
|
||||
|
||||
public void Attach(IOperation op)
|
||||
@ -39,7 +37,7 @@ namespace NAPS2.WinForms
|
||||
|
||||
public void ShowProgress(IOperation op)
|
||||
{
|
||||
if (userConfigManager.Config.BackgroundOperations.Contains(op.GetType().Name))
|
||||
if (UserConfig.Current.BackgroundOperations.Contains(op.GetType().Name))
|
||||
{
|
||||
ShowBackgroundProgress(op);
|
||||
}
|
||||
@ -53,8 +51,8 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
Attach(op);
|
||||
|
||||
userConfigManager.Config.BackgroundOperations.Remove(op.GetType().Name);
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.BackgroundOperations.Remove(op.GetType().Name);
|
||||
UserConfig.Manager.Save();
|
||||
|
||||
if (!op.IsFinished)
|
||||
{
|
||||
@ -73,8 +71,8 @@ namespace NAPS2.WinForms
|
||||
{
|
||||
Attach(op);
|
||||
|
||||
userConfigManager.Config.BackgroundOperations.Add(op.GetType().Name);
|
||||
userConfigManager.Save();
|
||||
UserConfig.Current.BackgroundOperations.Add(op.GetType().Name);
|
||||
UserConfig.Manager.Save();
|
||||
|
||||
if (!op.IsFinished)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user