From d5ab47dc9d870ca8543000430b61399803b3edaf Mon Sep 17 00:00:00 2001
From: Dinesh Solanki <15937452+DineshSolanki@users.noreply.github.com>
Date: Tue, 30 Jul 2024 00:31:52 +0530
Subject: [PATCH] various refactoring (#215)
* replace LangProvider calls with the Lang object across app
Replaced all instances of LangProvider.GetLang with direct Lang object properties to simplify code and enhance readability. Also made IfNotAdminRestartAsAdmin method private and added Localizable attribute to several classes.
* Add Localizable attribute and improve encapsulation
Added the `[Localizable(false)]` attribute to various classes to exclude them from localization. Improved encapsulation by modifying access modifiers for properties and fields, ensuring private or protected access where appropriate. These changes help in better resource management and code maintainability.
---
FoliCon/App.xaml.cs | 1 +
FoliCon/Models/Constants/GlobalVariables.cs | 2 +-
FoliCon/Models/Data/PosterIcon.cs | 1 +
FoliCon/Models/Data/StatusBarData.cs | 2 +-
FoliCon/Modules/Configuration/AppConfig.cs | 1 +
FoliCon/Modules/Configuration/AssemblyInfo.cs | 1 +
.../BoolToPermissionTextConvertor.cs | 3 +-
.../Modules/Convertor/ImageCacheConverter.cs | 1 +
FoliCon/Modules/DeviantArt/DArt.cs | 15 ++--
.../Extension/BindingPathExtensions.cs | 1 +
.../Extension/DialogServiceExtensions.cs | 1 +
FoliCon/Modules/Extension/Extensions.cs | 1 +
FoliCon/Modules/Extension/StreamExtension.cs | 1 +
FoliCon/Modules/IGDB/IgdbDataTransformer.cs | 1 +
FoliCon/Modules/IGDB/IgdbService.cs | 3 +-
FoliCon/Modules/LangProvider.cs | 1 +
FoliCon/Modules/Media/PngToIcoService.cs | 1 +
FoliCon/Modules/TMDB/TMDBService.cs | 5 +-
FoliCon/Modules/UI/CustomMessageBox.cs | 11 +--
FoliCon/Modules/UI/FolderDragDropHelper.cs | 2 +-
FoliCon/Modules/UI/HandyWindow.cs | 1 +
.../Modules/UI/ListViewClickSortBehavior.cs | 2 +-
FoliCon/Modules/utils/CultureUtils.cs | 25 +++---
FoliCon/Modules/utils/DataUtils.cs | 5 +-
FoliCon/Modules/utils/DialogUtils.cs | 11 +--
FoliCon/Modules/utils/FileUtils.cs | 14 +--
FoliCon/Modules/utils/ProcessUtils.cs | 10 +--
FoliCon/Modules/utils/StaTask.cs | 1 +
FoliCon/Modules/utils/TitleCleaner.cs | 1 +
FoliCon/ViewModels/AboutBoxViewModel.cs | 7 +-
.../ViewModels/ApiConfigurationViewModel.cs | 2 +-
.../ViewModels/CustomIconControlViewModel.cs | 33 +++----
FoliCon/ViewModels/DialogControlViewModel.cs | 6 +-
FoliCon/ViewModels/MainWindowViewModel.cs | 88 +++++++++----------
FoliCon/ViewModels/ManualExplorerViewModel.cs | 9 +-
FoliCon/ViewModels/PosterPickerViewModel.cs | 10 ++-
FoliCon/ViewModels/PreviewerViewModel.cs | 5 +-
.../ViewModels/ProSearchResultViewModel.cs | 26 +++---
FoliCon/ViewModels/SearchResultViewModel.cs | 17 ++--
.../SubfolderProcessingViewModel.cs | 6 +-
.../ViewModels/posterIconConfigViewModel.cs | 5 +-
FoliCon/Views/HtmlBox.xaml.cs | 9 +-
FoliCon/Views/ImageGalleryControl.xaml.cs | 1 +
43 files changed, 191 insertions(+), 158 deletions(-)
diff --git a/FoliCon/App.xaml.cs b/FoliCon/App.xaml.cs
index c22a4654..c5a08446 100644
--- a/FoliCon/App.xaml.cs
+++ b/FoliCon/App.xaml.cs
@@ -7,6 +7,7 @@ namespace FoliCon;
///
/// Interaction logic for App.xaml
///
+[Localizable(false)]
public partial class App
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
diff --git a/FoliCon/Models/Constants/GlobalVariables.cs b/FoliCon/Models/Constants/GlobalVariables.cs
index ddb51fa4..02282b24 100644
--- a/FoliCon/Models/Constants/GlobalVariables.cs
+++ b/FoliCon/Models/Constants/GlobalVariables.cs
@@ -17,7 +17,7 @@ public static IconOverlay IconOverlayType()
};
}
- public static readonly string MediaInfoFile = "info.folicon";
+ public const string MediaInfoFile = "info.folicon";
private static string IconOverlayTypeString =>
Services.Tracker.Store.GetData("PosterIconConfigViewModel")["p.IconOverlay"].ToString();
diff --git a/FoliCon/Models/Data/PosterIcon.cs b/FoliCon/Models/Data/PosterIcon.cs
index 9d800dd4..cc06d753 100644
--- a/FoliCon/Models/Data/PosterIcon.cs
+++ b/FoliCon/Models/Data/PosterIcon.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Models.Data;
+[Localizable(false)]
public class PosterIcon: BindableBase
{
public ImageSource FolderJpg { get; set; }
diff --git a/FoliCon/Models/Data/StatusBarData.cs b/FoliCon/Models/Data/StatusBarData.cs
index a91f60f2..143cd01d 100644
--- a/FoliCon/Models/Data/StatusBarData.cs
+++ b/FoliCon/Models/Data/StatusBarData.cs
@@ -20,7 +20,7 @@ public class StatusBarData : BindableBase
public void ResetData()
{
- AppStatus = LangProvider.GetLang("Idle");
+ AppStatus = Lang.Idle;
AppStatusAdditional = "";
ProcessedFolder = 0;
TotalFolders = 0;
diff --git a/FoliCon/Modules/Configuration/AppConfig.cs b/FoliCon/Modules/Configuration/AppConfig.cs
index 3b3f3fb1..b8f1bdde 100644
--- a/FoliCon/Modules/Configuration/AppConfig.cs
+++ b/FoliCon/Modules/Configuration/AppConfig.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.Configuration;
+[Localizable(false)]
public class AppConfig : GlobalDataHelper
{
public string DevClientId { get; set; }
diff --git a/FoliCon/Modules/Configuration/AssemblyInfo.cs b/FoliCon/Modules/Configuration/AssemblyInfo.cs
index 8e0bafc8..f5100b68 100644
--- a/FoliCon/Modules/Configuration/AssemblyInfo.cs
+++ b/FoliCon/Modules/Configuration/AssemblyInfo.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.Configuration;
+[Localizable(false)]
internal static class AssemblyInfo
{
public static string GetVersion()
diff --git a/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs b/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs
index 80a32e3c..4161aa4b 100644
--- a/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs
+++ b/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs
@@ -1,12 +1,13 @@
namespace FoliCon.Modules.Convertor;
+[Localizable(false)]
public class BoolToPermissionTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool hasWritePermission)
{
- return hasWritePermission ? LangProvider.GetLang("WritePermissionAllowed") : LangProvider.GetLang("WritePermissionNotAllowed");
+ return hasWritePermission ? Lang.WritePermissionAllowed : Lang.WritePermissionNotAllowed;
}
throw new InvalidOperationException("Must be a boolean value.");
diff --git a/FoliCon/Modules/Convertor/ImageCacheConverter.cs b/FoliCon/Modules/Convertor/ImageCacheConverter.cs
index 5c3b9c63..8ca7217b 100644
--- a/FoliCon/Modules/Convertor/ImageCacheConverter.cs
+++ b/FoliCon/Modules/Convertor/ImageCacheConverter.cs
@@ -4,6 +4,7 @@
/// Converts an image path to a BitmapImage with caching to improve performance and thread safety.
/// CREDIT: https://stackoverflow.com/a/37652158/8076598
///
+[Localizable(false)]
public class ImageCacheConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
diff --git a/FoliCon/Modules/DeviantArt/DArt.cs b/FoliCon/Modules/DeviantArt/DArt.cs
index 6ad9a4bd..64506d8d 100644
--- a/FoliCon/Modules/DeviantArt/DArt.cs
+++ b/FoliCon/Modules/DeviantArt/DArt.cs
@@ -2,29 +2,30 @@
namespace FoliCon.Modules.DeviantArt;
+[Localizable(false)]
public class DArt : BindableBase
{
private string _clientAccessToken;
private string _clientSecret;
- private string _clientId;
+ private readonly string _clientId;
private readonly MemoryCache _cache = new(new MemoryCacheOptions());
private static readonly JsonSerializerSettings SerializerSettings = new() { NullValueHandling = NullValueHandling.Ignore };
-
- public string ClientId
+
+ private string ClientId
{
get => _clientId;
- set => SetProperty(ref _clientId, value);
+ init => SetProperty(ref _clientId, value);
}
- public string ClientSecret
+ private string ClientSecret
{
get => _clientSecret;
- set => SetProperty(ref _clientSecret, value);
+ init => SetProperty(ref _clientSecret, value);
}
- public string ClientAccessToken
+ private string ClientAccessToken
{
get => _clientAccessToken;
set => SetProperty(ref _clientAccessToken, value);
diff --git a/FoliCon/Modules/Extension/BindingPathExtensions.cs b/FoliCon/Modules/Extension/BindingPathExtensions.cs
index 7cc39126..c9fa977c 100644
--- a/FoliCon/Modules/Extension/BindingPathExtensions.cs
+++ b/FoliCon/Modules/Extension/BindingPathExtensions.cs
@@ -2,6 +2,7 @@
namespace FoliCon.Modules.Extension;
+[Localizable(false)]
public static class BindingPathExtensions
{
private static readonly ImageCacheConverter ImageCacheConverter = new ();
diff --git a/FoliCon/Modules/Extension/DialogServiceExtensions.cs b/FoliCon/Modules/Extension/DialogServiceExtensions.cs
index fa76cc38..94626a58 100644
--- a/FoliCon/Modules/Extension/DialogServiceExtensions.cs
+++ b/FoliCon/Modules/Extension/DialogServiceExtensions.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.Extension;
+[Localizable(false)]
public static class DialogServiceExtensions
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
diff --git a/FoliCon/Modules/Extension/Extensions.cs b/FoliCon/Modules/Extension/Extensions.cs
index 1b7af176..97b8d489 100644
--- a/FoliCon/Modules/Extension/Extensions.cs
+++ b/FoliCon/Modules/Extension/Extensions.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.Extension;
+[Localizable(false)]
public static class Extensions
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
diff --git a/FoliCon/Modules/Extension/StreamExtension.cs b/FoliCon/Modules/Extension/StreamExtension.cs
index 06857cf7..616bc4e0 100644
--- a/FoliCon/Modules/Extension/StreamExtension.cs
+++ b/FoliCon/Modules/Extension/StreamExtension.cs
@@ -5,6 +5,7 @@
namespace FoliCon.Modules.Extension;
+[Localizable(false)]
public static class StreamExtensions
{
private static readonly ReaderOptions ReaderOptions = new() { ArchiveEncoding =
diff --git a/FoliCon/Modules/IGDB/IgdbDataTransformer.cs b/FoliCon/Modules/IGDB/IgdbDataTransformer.cs
index 9e2268ca..59cf4c58 100644
--- a/FoliCon/Modules/IGDB/IgdbDataTransformer.cs
+++ b/FoliCon/Modules/IGDB/IgdbDataTransformer.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.IGDB;
+[Localizable(false)]
public class IgdbDataTransformer(ref List listDataTable, ref List imgDownloadList)
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
diff --git a/FoliCon/Modules/IGDB/IgdbService.cs b/FoliCon/Modules/IGDB/IgdbService.cs
index 2eb6fc36..698c6f2e 100644
--- a/FoliCon/Modules/IGDB/IgdbService.cs
+++ b/FoliCon/Modules/IGDB/IgdbService.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.IGDB;
+[Localizable(false)]
public class IgdbService(ref IGDBClient serviceClient)
{
private const string ServiceClientIsNotInitialized = "Service Client is not initialized.";
@@ -19,7 +20,7 @@ public async Task SearchGameAsync(string query)
}
var r = await _serviceClient.QueryAsync(IGDBClient.Endpoints.Games,
- $"search \"{query}\"; fields artworks.image_id, name,first_release_date,total_rating,summary,cover.*;");
+ $"""search "{query}"; fields artworks.image_id, name,first_release_date,total_rating,summary,cover.*;""");
return new ResultResponse
{
diff --git a/FoliCon/Modules/LangProvider.cs b/FoliCon/Modules/LangProvider.cs
index 591de4d3..ebd6986e 100644
--- a/FoliCon/Modules/LangProvider.cs
+++ b/FoliCon/Modules/LangProvider.cs
@@ -2,6 +2,7 @@
namespace FoliCon.Properties.Langs;
+[Localizable(false)]
public class LangProvider : INotifyPropertyChanged
{
private static string _cultureInfoStr;
diff --git a/FoliCon/Modules/Media/PngToIcoService.cs b/FoliCon/Modules/Media/PngToIcoService.cs
index bf4c4082..e12c9c7b 100644
--- a/FoliCon/Modules/Media/PngToIcoService.cs
+++ b/FoliCon/Modules/Media/PngToIcoService.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.Media;
+[Localizable(false)]
public static class PngToIcoService
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
diff --git a/FoliCon/Modules/TMDB/TMDBService.cs b/FoliCon/Modules/TMDB/TMDBService.cs
index 1abab68b..75d0a03b 100644
--- a/FoliCon/Modules/TMDB/TMDBService.cs
+++ b/FoliCon/Modules/TMDB/TMDBService.cs
@@ -3,6 +3,7 @@
namespace FoliCon.Modules.TMDB;
+[Localizable(false)]
internal class TmdbService
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -114,8 +115,8 @@ public async Task SearchWithParamsAsync(ParsedTitle parsedTitle,
{
Logger.Debug("Searching for {ParsedTitle} in {SearchMode}", parsedTitle, searchMode);
- var mediaType = "";
- object? searchResult = null;
+ string mediaType;
+ object? searchResult;
switch (searchMode)
{
diff --git a/FoliCon/Modules/UI/CustomMessageBox.cs b/FoliCon/Modules/UI/CustomMessageBox.cs
index 1af4e98d..f03a8661 100644
--- a/FoliCon/Modules/UI/CustomMessageBox.cs
+++ b/FoliCon/Modules/UI/CustomMessageBox.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.UI;
+[Localizable(false)]
internal static class CustomMessageBox
{
public static MessageBoxInfo Ask(string messageBoxText, string caption)
@@ -11,8 +12,8 @@ public static MessageBoxInfo Ask(string messageBoxText, string caption)
Button = MessageBoxButton.YesNo,
IconBrushKey = ResourceToken.AccentBrush,
IconKey = ResourceToken.AskGeometry,
- YesContent = LangProvider.GetLang("Confirm"),
- NoContent = LangProvider.GetLang("Cancel")
+ YesContent = Lang.Confirm,
+ NoContent = Lang.Cancel
};
}
public static MessageBoxInfo Error(string messageBoxText, string caption)
@@ -24,7 +25,7 @@ public static MessageBoxInfo Error(string messageBoxText, string caption)
Button = MessageBoxButton.OK,
IconBrushKey = ResourceToken.AccentBrush,
IconKey = ResourceToken.ErrorGeometry,
- ConfirmContent = LangProvider.GetLang("OK")
+ ConfirmContent = Lang.OK
};
}
public static MessageBoxInfo Warning(string messageBoxText, string caption)
@@ -36,7 +37,7 @@ public static MessageBoxInfo Warning(string messageBoxText, string caption)
Button = MessageBoxButton.OK,
IconBrushKey = ResourceToken.AccentBrush,
IconKey = ResourceToken.WarningGeometry,
- ConfirmContent = LangProvider.GetLang("OK")
+ ConfirmContent = Lang.OK
};
}
public static MessageBoxInfo Info(string messageBoxText, string caption)
@@ -48,7 +49,7 @@ public static MessageBoxInfo Info(string messageBoxText, string caption)
Button = MessageBoxButton.OK,
IconBrushKey = ResourceToken.AccentBrush,
IconKey = ResourceToken.InfoGeometry,
- ConfirmContent = LangProvider.GetLang("OK")
+ ConfirmContent = Lang.OK
};
}
}
\ No newline at end of file
diff --git a/FoliCon/Modules/UI/FolderDragDropHelper.cs b/FoliCon/Modules/UI/FolderDragDropHelper.cs
index 9cd1e234..6c99f37b 100644
--- a/FoliCon/Modules/UI/FolderDragDropHelper.cs
+++ b/FoliCon/Modules/UI/FolderDragDropHelper.cs
@@ -59,7 +59,7 @@ private static void Control_DragOver(object sender, DragEventArgs e)
var dt = e.Data.GetData(DataFormats.FileDrop);
var data = (dt as Array)?.GetValue(0)?.ToString();
- Logger.Trace("Control_DragOver: Data: {Data}", data ?? "null");
+ Logger.Trace("Control_DragOver: Data: {Data}", data);
e.Effects = Directory.Exists(data) ? DragDropEffects.Link : DragDropEffects.None;
e.Handled = true;
diff --git a/FoliCon/Modules/UI/HandyWindow.cs b/FoliCon/Modules/UI/HandyWindow.cs
index de5d93b0..fc682887 100644
--- a/FoliCon/Modules/UI/HandyWindow.cs
+++ b/FoliCon/Modules/UI/HandyWindow.cs
@@ -3,6 +3,7 @@
namespace FoliCon.Modules.UI;
+[Localizable(false)]
public class HandyWindow : Window, IDialogWindow
{
static HandyWindow()
diff --git a/FoliCon/Modules/UI/ListViewClickSortBehavior.cs b/FoliCon/Modules/UI/ListViewClickSortBehavior.cs
index 56e5b4d4..421c1e72 100644
--- a/FoliCon/Modules/UI/ListViewClickSortBehavior.cs
+++ b/FoliCon/Modules/UI/ListViewClickSortBehavior.cs
@@ -62,7 +62,7 @@ private void OnClick(object sender, RoutedEventArgs e)
? Application.Current.Resources["HeaderTemplateArrowUp"] as DataTemplate
: Application.Current.Resources["HeaderTemplateArrowDown"] as DataTemplate;
- // Remove arrow from previously sorted header
+ // Remove arrow from the previously sorted header
if (_lastHeaderClicked != null && _lastHeaderClicked != headerClicked)
{
_lastHeaderClicked.Column.HeaderTemplate = null;
diff --git a/FoliCon/Modules/utils/CultureUtils.cs b/FoliCon/Modules/utils/CultureUtils.cs
index 1b3a98fd..8a2a51b9 100644
--- a/FoliCon/Modules/utils/CultureUtils.cs
+++ b/FoliCon/Modules/utils/CultureUtils.cs
@@ -1,24 +1,25 @@
namespace FoliCon.Modules.utils;
+[Localizable(false)]
public static class CultureUtils
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
+ private static readonly Dictionary LanguageCodes = new()
+ {
+ { Languages.English, "en-US" },
+ { Languages.Spanish, "es-MX" },
+ { Languages.Arabic, "ar-SA" },
+ { Languages.Russian, "ru-RU" },
+ { Languages.Hindi, "hi-IN" },
+ { Languages.Portuguese, "pt-PT" }
+ };
+
public static CultureInfo GetCultureInfoByLanguage(Languages language)
{
Logger.Debug("Getting CultureInfo by Language: {Language}", language);
-
- var languageCodes = new Dictionary
- {
- { Languages.English, "en-US" },
- { Languages.Spanish, "es-MX" },
- { Languages.Arabic, "ar-SA" },
- { Languages.Russian, "ru-RU" },
- { Languages.Hindi, "hi-IN" },
- { Languages.Portuguese, "pt-PT" }
- };
-
- var langCode = languageCodes.GetValueOrDefault(language, "en-US");
+
+ var langCode = LanguageCodes.GetValueOrDefault(language, "en-US");
ConfigHelper.Instance.SetLang(langCode.Split("-")[0]);
return new CultureInfo(langCode);
diff --git a/FoliCon/Modules/utils/DataUtils.cs b/FoliCon/Modules/utils/DataUtils.cs
index cb4c1f67..6c3d65a1 100644
--- a/FoliCon/Modules/utils/DataUtils.cs
+++ b/FoliCon/Modules/utils/DataUtils.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.utils;
+[Localizable(false)]
public static class DataUtils
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -24,10 +25,10 @@ public static int GetResultCount(bool isPickedById, dynamic result, string searc
/// Formatted Rating value.
public static string FormatRating(double ratingInput)
{
- Logger.Debug("Start FormatRatingString() - Input received : {RatingInput}", ratingInput);
+ Logger.Trace("Start FormatRatingString() - Input received : {RatingInput}", ratingInput);
var decimalPart = ratingInput % 1;
var formattedRatingValue = decimalPart > 0 ? ratingInput.ToString("0.##") : ratingInput.ToString("0");
- Logger.Debug("End FormatRatingString() - Formatted Rating : {FormattedRatingValue}", formattedRatingValue);
+ Logger.Trace("End FormatRatingString() - Formatted Rating : {FormattedRatingValue}", formattedRatingValue);
return formattedRatingValue;
}
diff --git a/FoliCon/Modules/utils/DialogUtils.cs b/FoliCon/Modules/utils/DialogUtils.cs
index 02d2a082..860a3121 100644
--- a/FoliCon/Modules/utils/DialogUtils.cs
+++ b/FoliCon/Modules/utils/DialogUtils.cs
@@ -16,10 +16,10 @@ public static void ShowGrowlInfo(string message)
public static void ConfirmUpdate(ReleaseInfo ver)
{
- var message = LangProvider.GetLang("NewVersionFound")
+ var message = Lang.NewVersionFound
.Format(ver.TagName, ver.Changelog.Replace("\\n", Environment.NewLine));
- var confirmMessage = LangProvider.GetLang("UpdateNow");
- var cancelMessage = LangProvider.GetLang("Ignore");
+ var confirmMessage = Lang.UpdateNow;
+ var cancelMessage = Lang.Ignore;
var info = new GrowlInfo
{
@@ -54,10 +54,7 @@ public static VistaFolderBrowserDialog NewFolderBrowserDialog(string description
};
return folderBrowser;
}
- public static VistaOpenFileDialog NewOpenFileDialog(string description)
- {
- return NewOpenFileDialog(description, "All files (*.*)|*.*");
- }
+
public static VistaOpenFileDialog NewOpenFileDialog(string description, string filter)
{
Logger.Debug("Creating New Open File Dialog");
diff --git a/FoliCon/Modules/utils/FileUtils.cs b/FoliCon/Modules/utils/FileUtils.cs
index 2773c080..c9b6918b 100644
--- a/FoliCon/Modules/utils/FileUtils.cs
+++ b/FoliCon/Modules/utils/FileUtils.cs
@@ -229,14 +229,14 @@ public static void SaveMediaInfo(int id, string mediaType, string folderPath)
mediaType, filePath).Log();
MessageBox.Show(CustomMessageBox.Error(
e.Message.Contains("The process cannot access the file")
- ? LangProvider.GetLang("FileIsInUse")
- : LangProvider.GetLang("FailedToSaveMediaInfoAt").Format(filePath), LangProvider.GetLang("UnauthorizedAccess")));
+ ? Lang.FileIsInUse
+ : Lang.FailedToSaveMediaInfoAt.Format(filePath), Lang.UnauthorizedAccess));
}
catch (Exception e)
{
Logger.ForExceptionEvent(e, LogLevel.Error).Message("Error Occurred while Saving Media Info, ID: {Id}, Media Type: {MediaType}, Folder Path: {FolderPath}", id,
mediaType, folderPath).Log();
- CustomMessageBox.Error(e.Message, LangProvider.GetLang("ExceptionOccurred"));
+ CustomMessageBox.Error(e.Message, Lang.ExceptionOccurred);
}
}
@@ -337,7 +337,7 @@ public static async Task CheckForUpdate(bool onlyShowIfUpdateAvailable)
if (!ApplicationHelper.IsConnectedToInternet())
{
- DialogUtils.ShowGrowlError(LangProvider.GetLang("NetworkNotAvailable"));
+ DialogUtils.ShowGrowlError(Lang.NetworkNotAvailable);
return;
}
@@ -349,7 +349,7 @@ public static async Task CheckForUpdate(bool onlyShowIfUpdateAvailable)
if (!onlyShowIfUpdateAvailable)
{
- DialogUtils.ShowGrowlInfo(LangProvider.GetLang("ThisIsLatestVersion"));
+ DialogUtils.ShowGrowlInfo(Lang.ThisIsLatestVersion);
}
return;
@@ -363,8 +363,8 @@ public static void HandleUnauthorizedAccessException(UnauthorizedAccessException
{
MessageBox.Show(CustomMessageBox.Error(
ex.Message.Contains("The process cannot access the file")
- ? LangProvider.GetLang("FileIsInUse")
- : LangProvider.GetLang("FailedFileAccessAt").Format(path), LangProvider.GetLang("ExceptionOccurred")));
+ ? Lang.FileIsInUse
+ : Lang.FailedFileAccessAt.Format(path), Lang.ExceptionOccurred));
}
///
diff --git a/FoliCon/Modules/utils/ProcessUtils.cs b/FoliCon/Modules/utils/ProcessUtils.cs
index ade59d1e..ee773253 100644
--- a/FoliCon/Modules/utils/ProcessUtils.cs
+++ b/FoliCon/Modules/utils/ProcessUtils.cs
@@ -43,8 +43,8 @@ public static void CheckWebView2()
{
Logger.ForErrorEvent().Message("WebView2 Runtime is not installed.").Exception(exception).Log();
- var result = MessageBox.Show(CustomMessageBox.Ask(LangProvider.GetLang("WebView2DownloadConfirmation"),
- LangProvider.GetLang("WebView2DownloadConfirmationHeader")));
+ var result = MessageBox.Show(CustomMessageBox.Ask(Lang.WebView2DownloadConfirmation,
+ Lang.WebView2DownloadConfirmationHeader));
if (result != MessageBoxResult.Yes)
{
return;
@@ -136,15 +136,15 @@ public static IDictionary GetCmdArgs()
return arguments;
}
- public static bool? IfNotAdminRestartAsAdmin()
+ private static bool? IfNotAdminRestartAsAdmin()
{
if (ApplicationHelper.IsAdministrator())
{
Logger.Info("Application is running as Administrator");
return null;
}
- if (MessageBox.Show(CustomMessageBox.Ask(LangProvider.GetLang("RestartAsAdmin"),
- LangProvider.GetLang("Error"))) != MessageBoxResult.Yes)
+ if (MessageBox.Show(CustomMessageBox.Ask(Lang.RestartAsAdmin,
+ Lang.ExceptionOccurred)) != MessageBoxResult.Yes)
{
return false;
}
diff --git a/FoliCon/Modules/utils/StaTask.cs b/FoliCon/Modules/utils/StaTask.cs
index c884f12c..d94b8e4c 100644
--- a/FoliCon/Modules/utils/StaTask.cs
+++ b/FoliCon/Modules/utils/StaTask.cs
@@ -1,6 +1,7 @@
namespace FoliCon.Modules.utils;
//Taken from-https://stackoverflow.com/a/16722767/8076598
+[Localizable(false)]
public static class StaTask
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
diff --git a/FoliCon/Modules/utils/TitleCleaner.cs b/FoliCon/Modules/utils/TitleCleaner.cs
index 90c79e44..00d9b2c2 100644
--- a/FoliCon/Modules/utils/TitleCleaner.cs
+++ b/FoliCon/Modules/utils/TitleCleaner.cs
@@ -1,5 +1,6 @@
namespace FoliCon.Modules.utils;
+[Localizable(false)]
internal static class TitleCleaner
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
diff --git a/FoliCon/ViewModels/AboutBoxViewModel.cs b/FoliCon/ViewModels/AboutBoxViewModel.cs
index d78fcd04..08118036 100644
--- a/FoliCon/ViewModels/AboutBoxViewModel.cs
+++ b/FoliCon/ViewModels/AboutBoxViewModel.cs
@@ -1,16 +1,17 @@
namespace FoliCon.ViewModels;
+[Localizable(false)]
public class AboutBoxViewModel : BindableBase, IDialogAware
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private string _title = AssemblyInfo.GetVersionWithoutBuild();
private string _logo = "/Resources/icons/folicon Icon.png";
- private string _description = LangProvider.GetLang("FoliConDescription");
+ private string _description = Lang.FoliConDescription;
private string _website = "https://aprogrammers.wordpress.com";
- private string _additionalNotes = LangProvider.GetLang("DevelopedByDinesh");
- private string _license = LangProvider.GetLang("LicenseInfo");
+ private string _additionalNotes = Lang.DevelopedByDinesh;
+ private string _license = Lang.LicenseInfo;
private string _version = AssemblyInfo.GetVersion();
//These properties can also be initialized from Parameters for better re-usability. or From assembly
diff --git a/FoliCon/ViewModels/ApiConfigurationViewModel.cs b/FoliCon/ViewModels/ApiConfigurationViewModel.cs
index 99d49383..cbcdc11f 100644
--- a/FoliCon/ViewModels/ApiConfigurationViewModel.cs
+++ b/FoliCon/ViewModels/ApiConfigurationViewModel.cs
@@ -2,7 +2,7 @@
public class ApiConfigurationViewModel : BindableBase, IDialogAware
{
- private string _title = "API Configuration";
+ private string _title = Lang.APIKeysConfiguration;
private string _dartClient;
private string _dartClientId;
private string _tmdbKey;
diff --git a/FoliCon/ViewModels/CustomIconControlViewModel.cs b/FoliCon/ViewModels/CustomIconControlViewModel.cs
index 14a4a437..4fcdf184 100644
--- a/FoliCon/ViewModels/CustomIconControlViewModel.cs
+++ b/FoliCon/ViewModels/CustomIconControlViewModel.cs
@@ -4,6 +4,7 @@
namespace FoliCon.ViewModels;
+[Localizable(false)]
public class CustomIconControlViewModel : BindableBase, IDialogAware, IFileDragDropTarget
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -17,12 +18,12 @@ public class CustomIconControlViewModel : BindableBase, IDialogAware, IFileDragD
private bool _keepExactOnly;
private bool _isBusy;
private bool _stopSearch;
- public string Title => LangProvider.GetLang("CustomIconSetter");
+ public string Title => Lang.CustomIconSetter;
private ObservableCollection _undoDirectories = [];
private ObservableCollection _backupDirectories = [];
private ObservableCollection _backupIcons = [];
- private string _busyContent = LangProvider.GetLang("CreatingIcons");
+ private string _busyContent = Lang.CreatingIcons;
private int _index;
private int _totalIcons;
public bool KeepExactOnly
@@ -54,7 +55,7 @@ public bool IsUndoEnable
set => SetProperty(ref _isUndoEnable, value);
}
- public string SelectedDirectory
+ private string SelectedDirectory
{
get => _selectedDirectory;
set
@@ -69,7 +70,7 @@ public string SelectedDirectory
}
}
- public string SelectedIconsDirectory
+ private string SelectedIconsDirectory
{
get => _selectedIconsDirectory;
set
@@ -88,17 +89,17 @@ public string SelectedIconsDirectory
public ObservableCollection Directories
{
get => _directories;
- set => SetProperty(ref _directories, value);
+ private set => SetProperty(ref _directories, value);
}
public ObservableCollection Icons
{
get => _icons;
- set => SetProperty(ref _icons, value);
+ private set => SetProperty(ref _icons, value);
}
public int Index { get => _index; set => SetProperty(ref _index, value); }
public int TotalIcons { get => _totalIcons; set => SetProperty(ref _totalIcons, value); }
- public bool StopSearch { get => _stopSearch; set => SetProperty(ref _stopSearch, value); }
+ private bool StopSearch { get => _stopSearch; set => SetProperty(ref _stopSearch, value); }
#region Declare Delegates
public DelegateCommand LoadDirectory { get; set; }
@@ -145,7 +146,7 @@ private async void UndoCreatedIcons()
var info = new GrowlInfo
{
- Message = LangProvider.GetLang("UndoSuccessful"),
+ Message = Lang.UndoSuccessful,
ShowDateTime = false,
StaysOpen = false
};
@@ -159,7 +160,7 @@ private async void UndoCreatedIcons()
private void LoadDirectoryMethod()
{
- var folderBrowserDialog = DialogUtils.NewFolderBrowserDialog(LangProvider.GetLang("SelectFolder"));
+ var folderBrowserDialog = DialogUtils.NewFolderBrowserDialog(Lang.SelectFolder);
var dialogResult = folderBrowserDialog.ShowDialog();
if (dialogResult != null && (bool)!dialogResult)
{
@@ -173,7 +174,7 @@ private void LoadDirectoryMethod()
private void LoadIconsMethod()
{
- var folderBrowserDialog = DialogUtils.NewFolderBrowserDialog(LangProvider.GetLang("SelectIconsDirectory"));
+ var folderBrowserDialog = DialogUtils.NewFolderBrowserDialog(Lang.SelectIconsDirectory);
var dialogResult = folderBrowserDialog.ShowDialog();
if (dialogResult != null && (bool)!dialogResult)
{
@@ -201,7 +202,7 @@ protected virtual void CloseDialog(string parameter)
RaiseRequestClose(new DialogResult(result));
}
- public virtual void RaiseRequestClose(IDialogResult dialogResult) =>
+ protected virtual void RaiseRequestClose(IDialogResult dialogResult) =>
RequestClose?.Invoke(dialogResult);
public virtual bool CanCloseDialog() => true;
@@ -222,20 +223,20 @@ private void StartProcessing()
if (Directories.Count <= 0 || SelectedDirectory is null)
{
Logger.Warn("No folders to process");
- MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("NoFolderOrIconAlready"), LangProvider.GetLang("NoFoldersToProcess")));
+ MessageBox.Show(CustomMessageBox.Error(Lang.NoFolderOrIconAlready, Lang.NoFoldersToProcess));
return;
}
if (Icons.Count <= 0 || SelectedIconsDirectory is null)
{
- MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("NoIconsSelected"), LangProvider.GetLang("NoIconsToApply")));
+ MessageBox.Show(CustomMessageBox.Error(Lang.NoIconsSelected, Lang.NoIconsToApply));
return;
}
var iconProcessedCount = MakeIcons();
var info = new GrowlInfo
{
- Message = LangProvider.GetLang("IconCreatedWithCount").Format(iconProcessedCount),
+ Message = Lang.IconCreatedWithCount.Format(iconProcessedCount),
ShowDateTime = false,
StaysOpen = false
};
@@ -246,8 +247,8 @@ private void StartProcessing()
Growl.SuccessGlobal(info);
if (MessageBox.Show(
CustomMessageBox.Ask(
- $"{LangProvider.GetLang("IconReloadMayTakeTime")} {Environment.NewLine}{LangProvider.GetLang("ToForceReload")} {Environment.NewLine}{LangProvider.GetLang("ConfirmToOpenFolder")}",
- LangProvider.GetLang("IconCreated"))) == MessageBoxResult.Yes)
+ $"{Lang.IconReloadMayTakeTime} {Environment.NewLine}{Lang.ToForceReload} {Environment.NewLine}{Lang.ConfirmToOpenFolder}",
+ Lang.IconCreated)) == MessageBoxResult.Yes)
{
ProcessUtils.StartProcess(SelectedDirectory + Path.DirectorySeparatorChar);
}
diff --git a/FoliCon/ViewModels/DialogControlViewModel.cs b/FoliCon/ViewModels/DialogControlViewModel.cs
index c2a1e952..1f3ee5c0 100644
--- a/FoliCon/ViewModels/DialogControlViewModel.cs
+++ b/FoliCon/ViewModels/DialogControlViewModel.cs
@@ -13,7 +13,7 @@ public class DialogControlViewModel : BindableBase, IDialogAware
public string Message
{
get => _message;
- set => SetProperty(ref _message, value);
+ private set => SetProperty(ref _message, value);
}
private string _title = "Notification";
@@ -21,7 +21,7 @@ public string Message
public string Title
{
get => _title;
- set => SetProperty(ref _title, value);
+ private set => SetProperty(ref _title, value);
}
public event Action RequestClose;
@@ -39,7 +39,7 @@ protected virtual void CloseDialog(string parameter)
RaiseRequestClose(new DialogResult(result));
}
- public virtual void RaiseRequestClose(IDialogResult dialogResult)
+ protected virtual void RaiseRequestClose(IDialogResult dialogResult)
{
RequestClose?.Invoke(dialogResult);
}
diff --git a/FoliCon/ViewModels/MainWindowViewModel.cs b/FoliCon/ViewModels/MainWindowViewModel.cs
index bced57d9..f4866703 100644
--- a/FoliCon/ViewModels/MainWindowViewModel.cs
+++ b/FoliCon/ViewModels/MainWindowViewModel.cs
@@ -62,7 +62,7 @@ public bool IsSearchModeVisible
public ListViewData FinalListViewData
{
get => _finalListViewData;
- set => SetProperty(ref _finalListViewData, value);
+ private set => SetProperty(ref _finalListViewData, value);
}
private readonly IDialogService _dialogService;
@@ -70,7 +70,7 @@ public ListViewData FinalListViewData
private DirectoryPermissionsResult _directoryPermissionResult;
public StatusBarData StatusBarProperties { get; set; }
public ProgressBarData BusyIndicatorProperties { get => _busyIndicatorProperties; set => SetProperty(ref _busyIndicatorProperties, value); }
- public List Fnames { get; set; } = [];
+ private List Fnames { get; set; } = [];
public bool IsMakeEnabled
{
@@ -84,13 +84,13 @@ public bool IsSkipAmbiguous
set => SetProperty(ref _isSkipAmbiguous, value);
}
- public bool StopIconDownload
+ private bool StopIconDownload
{
get => _stopIconDownload;
set => SetProperty(ref _stopIconDownload, value);
}
- public string IconMode
+ private string IconMode
{
get => _iconMode;
set
@@ -100,7 +100,7 @@ public string IconMode
}
}
- public string SearchMode
+ private string SearchMode
{
get => _searchMode;
set => SetProperty(ref _searchMode, value);
@@ -200,8 +200,8 @@ public FoliconThemes Theme
public DelegateCommand RestartExCommand { get; } = new(delegate
{
- if (MessageBox.Show(CustomMessageBox.Ask(LangProvider.GetLang("RestartExplorerConfirmation"),
- LangProvider.GetLang("ConfirmExplorerRestart"))) != MessageBoxResult.Yes)
+ if (MessageBox.Show(CustomMessageBox.Ask(Lang.RestartExplorerConfirmation,
+ Lang.ConfirmExplorerRestart)) != MessageBoxResult.Yes)
{
return;
}
@@ -260,7 +260,7 @@ private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvai
private void LoadMethod()
{
- var folderBrowserDialog = DialogUtils.NewFolderBrowserDialog(LangProvider.GetLang("SelectFolder"));
+ var folderBrowserDialog = DialogUtils.NewFolderBrowserDialog(Lang.SelectFolder);
if (!SelectedFolder.IsNullOrEmpty())
{
folderBrowserDialog.SelectedPath = SelectedFolder;
@@ -329,14 +329,14 @@ private bool ValidateFolder()
}
Logger.Warn("SearchAndMakeMethod: Folder is empty: {SelectedFolder}", SelectedFolder);
- MessageBox.Show(CustomMessageBox.Warning(LangProvider.GetLang("IconsAlready"),
- LangProvider.GetLang("FolderError")));
+ MessageBox.Show(CustomMessageBox.Warning(Lang.IconsAlready,
+ Lang.FolderError));
return false;
}
Logger.Error("Folder does not exist: {SelectedFolder}", SelectedFolder);
- MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("FolderDoesNotExist"),
- LangProvider.GetLang("InvalidPath")));
+ MessageBox.Show(CustomMessageBox.Error(Lang.FolderDoesNotExist,
+ Lang.InvalidPath));
return false;
}
@@ -347,8 +347,8 @@ private static bool ValidateNetwork()
return true;
}
- MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("NoInternet"),
- LangProvider.GetLang("NetworkError")));
+ MessageBox.Show(CustomMessageBox.Error(Lang.NoInternet,
+ Lang.NetworkError));
return false;
}
@@ -376,7 +376,7 @@ private async Task DownloadIconsOrEnableMake()
StatusBarProperties.TotalIcons = BusyIndicatorProperties.Max =
StatusBarProperties.ProgressBarData.Max = _imgDownloadList.Count;
BusyIndicatorProperties.Text =
- LangProvider.GetLang("DownloadingIconWithCount").Format(1, _imgDownloadList.Count);
+ Lang.DownloadingIconWithCount.Format(1, _imgDownloadList.Count);
if (_imgDownloadList.Count > 0)
{
@@ -392,7 +392,7 @@ private void HandleException(Exception e)
{
Logger.ForErrorEvent().Message("SearchAndMakeMethod: Exception Occurred. message: {Message}", e.Message)
.Exception(e).Log();
- MessageBox.Show(CustomMessageBox.Error(e.Message, LangProvider.GetLang("ExceptionOccurred")));
+ MessageBox.Show(CustomMessageBox.Error(e.Message, Lang.ExceptionOccurred));
StatusBarProperties.ResetData();
IsMakeEnabled = true;
IsBusy = false;
@@ -405,7 +405,7 @@ private async Task ProcessPosterModeAsync()
IsMakeEnabled = false;
await ProcessPosterFolderAsync(SelectedFolder);
- StatusBarProperties.AppStatus = "Idle";
+ StatusBarProperties.AppStatus = Lang.Idle;
StatusBarProperties.AppStatusAdditional = "";
}
@@ -497,7 +497,7 @@ private static void ProcessSubfolders(string folderPath, Queue folderQue
private async Task<(ResultResponse response, ParsedTitle parsedTitle, bool isPickedById, string mediaType)> PerformPreprocessing(string itemTitle, string fullFolderPath)
{
- StatusBarProperties.AppStatus = "Searching";
+ StatusBarProperties.AppStatus = Lang.Searching;
StatusBarProperties.AppStatusAdditional = itemTitle;
var parsedTitle = TitleCleaner.CleanAndParse(itemTitle);
var (id, mediaType) = FileUtils.ReadMediaInfo(fullFolderPath);
@@ -547,8 +547,8 @@ private int CalculateResultCount(ResultResponse response, bool isPickedById)
string parsedTitle, bool isPickedById)
{
Logger.Debug("No result found for {ItemTitle}, {Mode}", itemTitle, SearchMode);
- MessageBox.Show(CustomMessageBox.Info(LangProvider.GetLang("NothingFoundFor").Format(itemTitle),
- LangProvider.GetLang("NoResultFound")));
+ MessageBox.Show(CustomMessageBox.Info(Lang.NothingFoundFor.Format(itemTitle),
+ Lang.NoResultFound));
return await ShowSearchResultDialog(parsedTitle, fullFolderPath, response, isPickedById);
}
@@ -580,10 +580,10 @@ private void ProcessSingleResultCase(string itemTitle, ResultResponse response,
.Exception(ex).Log();
if (ex.Message == "NoPoster")
{
- MessageBox.Show(CustomMessageBox.Warning(LangProvider.GetLang("NoPosterFound"), itemTitle));
+ MessageBox.Show(CustomMessageBox.Warning(Lang.NoPosterFound, itemTitle));
}
#if DEBUG
- MessageBox.Show(CustomMessageBox.Warning(ex.Message, LangProvider.GetLang("ExceptionOccurred")));
+ MessageBox.Show(CustomMessageBox.Warning(ex.Message, Lang.ExceptionOccurred));
#endif
}
}
@@ -652,7 +652,7 @@ private void ProcessProfessionalMode(string initialFolderPath)
continue;
}
StatusBarProperties.TotalFolders+= subfolderNames.Count;
- StatusBarProperties.AppStatus = "Searching";
+ StatusBarProperties.AppStatus = Lang.Searching;
_dialogService.ShowProSearchResult(folderPath, subfolderNames, _pickedListDataTable, _imgDownloadList,
_dArtObject, _ => { });
Logger.Debug("ProcessProfessionalMode: found {ResultCount} results, adding to final list", _pickedListDataTable.Count);
@@ -729,8 +729,8 @@ private void DeleteMediaInfo()
{
if (Directory.Exists(SelectedFolder))
{
- if (MessageBox.Show(CustomMessageBox.Ask(LangProvider.GetLang("DeleteMediaInfoConfirmation"),
- LangProvider.GetLang("ConfirmMediaInfoDeletion"))) == MessageBoxResult.Yes)
+ if (MessageBox.Show(CustomMessageBox.Ask(Lang.DeleteMediaInfoConfirmation,
+ Lang.ConfirmMediaInfoDeletion)) == MessageBoxResult.Yes)
{
FileUtils.DeleteMediaInfoFromSubfolders(SelectedFolder);
}
@@ -738,15 +738,15 @@ private void DeleteMediaInfo()
else
{
Logger.Debug("DeleteMediaInfoMethod: Directory does not exist: {SelectedFolder}", SelectedFolder);
- MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("DirectoryIsEmpty"),
- LangProvider.GetLang("EmptyDirectory")));
+ MessageBox.Show(CustomMessageBox.Error(Lang.DirectoryIsEmpty,
+ Lang.EmptyDirectory));
}
}
catch (Exception e)
{
Logger.ForErrorEvent().Message("DeleteMediaInfoMethod: Exception Occurred. message: {Message}", e.Message)
.Exception(e).Log();
- MessageBox.Show(CustomMessageBox.Error(e.Message, LangProvider.GetLang("ExceptionOccurred")));
+ MessageBox.Show(CustomMessageBox.Error(e.Message, Lang.ExceptionOccurred));
}
}
@@ -758,7 +758,7 @@ private async Task InitializeProperties()
{
Max = 100,
Value = 0,
- Text = LangProvider.GetLang("DownloadIt")
+ Text = Lang.DownloadIt
};
StatusBarProperties = new StatusBarData
{
@@ -817,8 +817,8 @@ private async void DeleteIconsMethod()
{
if (Directory.Exists(SelectedFolder))
{
- if (MessageBox.Show(CustomMessageBox.Ask(LangProvider.GetLang("DeleteIconsConfirmation"),
- LangProvider.GetLang("ConfirmIconDeletion"))) == MessageBoxResult.Yes)
+ if (MessageBox.Show(CustomMessageBox.Ask(Lang.DeleteIconsConfirmation,
+ Lang.ConfirmIconDeletion)) == MessageBoxResult.Yes)
{
await FileUtils.DeleteIconsFromSubfoldersAsync(SelectedFolder);
}
@@ -826,8 +826,8 @@ private async void DeleteIconsMethod()
else
{
Logger.Debug("DeleteIconsMethod: Directory does not exist: {SelectedFolder}", SelectedFolder);
- MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("DirectoryIsEmpty"),
- LangProvider.GetLang("EmptyDirectory")));
+ MessageBox.Show(CustomMessageBox.Error(Lang.DirectoryIsEmpty,
+ Lang.EmptyDirectory));
}
}
catch (Exception e)
@@ -867,7 +867,7 @@ private async Task StartDownloadingAsync()
IsMakeEnabled = false;
StatusBarProperties.AppStatus = LangProvider.GetLang("Creating Icons");
await DownloadAndMakeIconsAsync();
- StatusBarProperties.AppStatus = "Idle";
+ StatusBarProperties.AppStatus = Lang.Idle;
StatusBarProperties.AppStatusAdditional = "";
}
@@ -905,12 +905,12 @@ private async Task DownloadAndMakeIconsAsync()
" message: {Message}", e.Message)
.Property("Image", img)
.Log();
- MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("FailedFileAccessAt").Format(Directory.GetParent(img.LocalPath)),
- LangProvider.GetLang("UnauthorizedAccess")));
+ MessageBox.Show(CustomMessageBox.Error(Lang.FailedFileAccessAt.Format(Directory.GetParent(img.LocalPath)),
+ Lang.UnauthorizedAccess));
continue;
}
i += 1;
- BusyIndicatorProperties.Text = LangProvider.GetLang("DownloadingIconWithCount")
+ BusyIndicatorProperties.Text = Lang.DownloadingIconWithCount
.Format(i, BusyIndicatorProperties.Max);
BusyIndicatorProperties.Value = i;
StatusBarProperties.ProgressBarData.Value = i;
@@ -940,16 +940,16 @@ private async Task MakeIcons()
IsBusy = false;
var info = new GrowlInfo
{
- Message = LangProvider.GetLang("IconCreatedWithCount").Format(iconProcessedCount),
+ Message = Lang.IconCreatedWithCount.Format(iconProcessedCount),
ShowDateTime = false,
StaysOpen = false,
- ConfirmStr = LangProvider.GetLang("Confirm")
+ ConfirmStr = Lang.Confirm
};
Growl.SuccessGlobal(info);
if (MessageBox.Show(
CustomMessageBox.Ask(
- $"{LangProvider.GetLang("IconReloadMayTakeTime")} {Environment.NewLine}{LangProvider.GetLang("ToForceReload")} {Environment.NewLine}{LangProvider.GetLang("ConfirmToOpenFolder")}",
- LangProvider.GetLang("IconCreated"))) == MessageBoxResult.Yes)
+ $"{Lang.IconReloadMayTakeTime} {Environment.NewLine}{Lang.ToForceReload} {Environment.NewLine}{Lang.ConfirmToOpenFolder}",
+ Lang.IconCreated)) == MessageBoxResult.Yes)
{
ProcessUtils.StartProcess(SelectedFolder + Path.DirectorySeparatorChar);
}
@@ -974,9 +974,9 @@ private async Task InitializeClientObjects()
return;
}
- MessageBox.Show(CustomMessageBox.Error($"{LangProvider.GetLang("APIKeysNotProvided")}{Environment.NewLine}" +
- LangProvider.GetLang("AppWillClose"),
- LangProvider.GetLang("ClosingApplication")));
+ MessageBox.Show(CustomMessageBox.Error($"{Lang.APIKeysNotProvided}{Environment.NewLine}" +
+ Lang.AppWillClose,
+ Lang.ClosingApplication));
Logger.Warn("API Keys not provided, Closing Application.");
Environment.Exit(0);
});
diff --git a/FoliCon/ViewModels/ManualExplorerViewModel.cs b/FoliCon/ViewModels/ManualExplorerViewModel.cs
index 3f3d34ee..1eec5dd4 100644
--- a/FoliCon/ViewModels/ManualExplorerViewModel.cs
+++ b/FoliCon/ViewModels/ManualExplorerViewModel.cs
@@ -1,5 +1,6 @@
namespace FoliCon.ViewModels;
+[Localizable(false)]
public class ManualExplorerViewModel : BindableBase, IDialogAware
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -18,7 +19,7 @@ private void PickMethod(object localImagePath)
CloseDialog(ButtonResult.OK, (string)localImagePath);
}
- private string _title = LangProvider.GetLang("ManualExplorer");
+ private string _title = Lang.ManualExplorer;
private bool _isBusy;
private ObservableCollection _directory;
private DArt _dArtObject;
@@ -28,9 +29,9 @@ private void PickMethod(object localImagePath)
public string Title { get => _title; set => SetProperty(ref _title, value); }
public bool IsBusy { get => _isBusy; set => SetProperty(ref _isBusy, value); }
- public DArt DArtObject { get => _dArtObject; set => SetProperty(ref _dArtObject, value); }
+ private DArt DArtObject { get => _dArtObject; set => SetProperty(ref _dArtObject, value); }
public ProgressBarData ProgressInfo { get => _progressInfo; set => SetProperty(ref _progressInfo, value); }
- public DArtDownloadResponse DArtDownloadResponse { get => _dArtDownloadResponse; set => SetProperty(ref _dArtDownloadResponse, value); }
+ private DArtDownloadResponse DArtDownloadResponse { get => _dArtDownloadResponse; set => SetProperty(ref _dArtDownloadResponse, value); }
public ObservableCollection Directory { get => _directory; set => SetProperty(ref _directory, value); }
public DelegateCommand