mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
[Refactor] Replace direct localization property bindings with static resource references
This commit is contained in:
@@ -34,7 +34,6 @@ using System.Threading.Tasks;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using RomRepoMgr.Core.Models;
|
||||
using RomRepoMgr.Resources;
|
||||
using RomRepoMgr.Views;
|
||||
|
||||
namespace RomRepoMgr.ViewModels;
|
||||
@@ -82,23 +81,14 @@ public sealed class AboutViewModel : ViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
public string AboutLabel => Localization.AboutLabel;
|
||||
public string LibrariesLabel => Localization.LibrariesLabel;
|
||||
public string AuthorsLabel => Localization.AuthorsLabel;
|
||||
public string Title => Localization.AboutTitle;
|
||||
public string SoftwareName => "RomRepoMgr";
|
||||
public string SuiteName => "ROM Repository Manager";
|
||||
public string Copyright => "© 2020-2024 Natalia Portillo";
|
||||
public string Website => "https://www.claunia.com";
|
||||
public string License => Localization.LicenseLabel;
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
public string AssembliesLibraryText => Localization.AssembliesLibraryText;
|
||||
public string AssembliesVersionText => Localization.AssembliesVersionText;
|
||||
public string Authors => Localization.AuthorsText;
|
||||
public ReactiveCommand<Unit, Unit> WebsiteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> LicenseCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
public ObservableCollection<AssemblyModel> Assemblies { get; }
|
||||
public string SoftwareName => "RomRepoMgr";
|
||||
public string SuiteName => "ROM Repository Manager";
|
||||
public string Copyright => "© 2020-2024 Natalia Portillo";
|
||||
public string Website => "https://www.claunia.com";
|
||||
public ReactiveCommand<Unit, Unit> WebsiteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> LicenseCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
public ObservableCollection<AssemblyModel> Assemblies { get; }
|
||||
|
||||
public string VersionText
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ using RomRepoMgr.Core.EventArgs;
|
||||
using RomRepoMgr.Core.Models;
|
||||
using RomRepoMgr.Database;
|
||||
using RomRepoMgr.Database.Models;
|
||||
using RomRepoMgr.Resources;
|
||||
using RomRepoMgr.Views;
|
||||
|
||||
namespace RomRepoMgr.ViewModels;
|
||||
@@ -67,25 +66,6 @@ public class EditDatViewModel : ViewModelBase
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
}
|
||||
|
||||
public string NameLabel => Localization.RomSetNameLabel;
|
||||
public string VersionLabel => Localization.RomSetVersionLabel;
|
||||
public string AuthorLabel => Localization.RomSetAuthorLabel;
|
||||
public string CategoryLabel => Localization.RomSetCategoryLabel;
|
||||
public string CommentLabel => Localization.RomSetCommentLabel;
|
||||
public string DateLabel => Localization.RomSetDateLabel;
|
||||
public string DescriptionLabel => Localization.RomSetDescriptionLabel;
|
||||
public string HomepageLabel => Localization.HomepageLabel;
|
||||
public string TotalMachinesLabel => Localization.TotalMachinesLabel;
|
||||
public string CompleteMachinesLabel => Localization.CompleteMachinesLabel;
|
||||
public string IncompleteMachinesLabel => Localization.IncompleteMachinesLabel;
|
||||
public string TotalRomsLabel => Localization.TotalRomsLabel;
|
||||
public string HaveRomsLabel => Localization.HaveRomsLabel;
|
||||
public string MissRomsLabel => Localization.MissRomsLabel;
|
||||
public string Title => Localization.EditDatTitle;
|
||||
public string SaveLabel => Localization.SaveLabel;
|
||||
public string CancelLabel => Localization.CancelLabel;
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
|
||||
public ReactiveCommand<Unit, Unit> SaveCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CancelCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
|
||||
@@ -62,8 +62,6 @@ public sealed class ExportDatViewModel : ViewModelBase
|
||||
_worker.FailedWithText += OnWorkerOnFailedWithText;
|
||||
}
|
||||
|
||||
public string Title => Localization.ExportDatTitle;
|
||||
|
||||
public string StatusMessage
|
||||
{
|
||||
get => _statusMessage;
|
||||
@@ -94,7 +92,6 @@ public sealed class ExportDatViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _canClose, value);
|
||||
}
|
||||
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
|
||||
void OnWorkerOnFinishedWithText(object sender, MessageEventArgs args) => Dispatcher.UIThread.Post(() =>
|
||||
|
||||
@@ -30,7 +30,6 @@ using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using RomRepoMgr.Core.EventArgs;
|
||||
using RomRepoMgr.Core.Workers;
|
||||
using RomRepoMgr.Resources;
|
||||
using RomRepoMgr.Views;
|
||||
|
||||
namespace RomRepoMgr.ViewModels;
|
||||
@@ -68,7 +67,6 @@ public sealed class ExportRomsViewModel : ViewModelBase
|
||||
CanClose = false;
|
||||
}
|
||||
|
||||
public string PathLabel => Localization.PathLabel;
|
||||
public string FolderPath { get; }
|
||||
|
||||
public bool ProgressVisible
|
||||
@@ -179,9 +177,6 @@ public sealed class ExportRomsViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _progress3IsIndeterminate, value);
|
||||
}
|
||||
|
||||
public string Title => Localization.ExportRomsTitle;
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
|
||||
public bool CanClose
|
||||
{
|
||||
get => _canClose;
|
||||
|
||||
@@ -75,11 +75,7 @@ public sealed class ImportDatFolderViewModel : ViewModelBase
|
||||
StartCommand = ReactiveCommand.Create(ExecuteStartCommand);
|
||||
}
|
||||
|
||||
public string PathLabel => Localization.PathLabel;
|
||||
public string CategoryLabel => Localization.RomSetCategoryLabel;
|
||||
public string FolderPath { get; }
|
||||
public string AllFilesLabel => Localization.AllFilesLabel;
|
||||
public string RecursiveLabel => Localization.RecursiveLabel;
|
||||
public string FolderPath { get; }
|
||||
|
||||
public bool AllFilesChecked
|
||||
{
|
||||
@@ -191,13 +187,7 @@ public sealed class ImportDatFolderViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _category, value);
|
||||
}
|
||||
|
||||
public string Title => Localization.ImportDatFolderTitle;
|
||||
|
||||
public ObservableCollection<ImportDatFolderItem> ImportResults { get; }
|
||||
public string ResultFilenameLabel => Localization.ResultFilenameLabel;
|
||||
public string ResultStatusLabel => Localization.ResultStatusLabel;
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
public string StartLabel => Localization.StartLabel;
|
||||
public ObservableCollection<ImportDatFolderItem> ImportResults { get; }
|
||||
|
||||
public bool CanClose
|
||||
{
|
||||
|
||||
@@ -30,7 +30,6 @@ using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using RomRepoMgr.Core.EventArgs;
|
||||
using RomRepoMgr.Core.Workers;
|
||||
using RomRepoMgr.Resources;
|
||||
using RomRepoMgr.Views;
|
||||
|
||||
namespace RomRepoMgr.ViewModels;
|
||||
@@ -65,8 +64,6 @@ public sealed class ImportDatViewModel : ViewModelBase
|
||||
_worker.WorkFinished += OnWorkerOnWorkFinished;
|
||||
}
|
||||
|
||||
public string Title => Localization.ImportDatTitle;
|
||||
|
||||
public string StatusMessage
|
||||
{
|
||||
get => _statusMessage;
|
||||
@@ -121,7 +118,6 @@ public sealed class ImportDatViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _canClose, value);
|
||||
}
|
||||
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
|
||||
void OnWorkerOnWorkFinished(object sender, MessageEventArgs args) => Dispatcher.UIThread.Post(() =>
|
||||
|
||||
@@ -77,11 +77,7 @@ public sealed class ImportRomFolderViewModel : ViewModelBase
|
||||
_removeFilesEnabled = false;
|
||||
}
|
||||
|
||||
public string PathLabel => Localization.PathLabel;
|
||||
public string FolderPath { get; }
|
||||
public string RemoveFilesLabel => Localization.RemoveFilesLabel;
|
||||
public string KnownOnlyLabel => Localization.KnownOnlyLabel;
|
||||
public string RecurseArchivesLabel => Localization.RecurseArchivesLabel;
|
||||
public bool RecurseArchivesEnabled => Settings.Settings.UnArUsable;
|
||||
|
||||
public bool RemoveFilesChecked
|
||||
@@ -198,13 +194,7 @@ public sealed class ImportRomFolderViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _isImporting, value);
|
||||
}
|
||||
|
||||
public string Title => Localization.ImportRomFolderTitle;
|
||||
|
||||
public ObservableCollection<ImportRomItem> ImportResults { get; }
|
||||
public string ResultFilenameLabel => Localization.ResultFilenameLabel;
|
||||
public string ResultStatusLabel => Localization.ResultStatusLabel;
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
public string StartLabel => Localization.StartLabel;
|
||||
public ObservableCollection<ImportRomItem> ImportResults { get; }
|
||||
|
||||
public bool CanClose
|
||||
{
|
||||
|
||||
@@ -71,41 +71,8 @@ public class MainWindowViewModel : ViewModelBase
|
||||
RomSets = new ObservableCollection<RomSetModel>(romSets);
|
||||
}
|
||||
|
||||
public ObservableCollection<RomSetModel> RomSets { get; }
|
||||
public string RomSetLabel => Localization.RomSets;
|
||||
public string RomSetNameLabel => Localization.RomSetNameLabel;
|
||||
public string RomSetVersionLabel => Localization.RomSetVersionLabel;
|
||||
public string RomSetAuthorLabel => Localization.RomSetAuthorLabel;
|
||||
public string RomSetCategoryLabel => Localization.RomSetCategoryLabel;
|
||||
public string RomSetDateLabel => Localization.RomSetDateLabel;
|
||||
public string RomSetDescriptionLabel => Localization.RomSetDescriptionLabel;
|
||||
public string RomSetCommentLabel => Localization.RomSetCommentLabel;
|
||||
public string RomSetTotalMachinesLabel => Localization.RomSetTotalMachinesLabel;
|
||||
public string RomSetCompleteMachinesLabel => Localization.RomSetCompleteMachinesLabel;
|
||||
public string RomSetIncompleteMachinesLabel => Localization.RomSetIncompleteMachinesLabel;
|
||||
public string RomSetTotalRomsLabel => Localization.RomSetTotalRomsLabel;
|
||||
public string RomSetHaveRomsLabel => Localization.RomSetHaveRomsLabel;
|
||||
public string RomSetMissRomsLabel => Localization.RomSetMissRomsLabel;
|
||||
public bool IsVfsAvailable => Vfs.IsAvailable;
|
||||
public string FileMenuText => Localization.FileMenuText;
|
||||
public string FileMenuImportDatFileText => Localization.FileMenuImportDatFileText;
|
||||
public string FileMenuImportDatFolderText => Localization.FileMenuImportDatFolderText;
|
||||
public string FileMenuSettingsText => Localization.FileMenuSettingsText;
|
||||
public string FileMenuExitText => Localization.FileMenuExitText;
|
||||
public string FilesystemMenuText => Localization.FilesystemMenuText;
|
||||
public string FilesystemMenuMountText => Localization.FilesystemMenuMountText;
|
||||
public string RomsMenuText => Localization.RomsMenuText;
|
||||
public string RomsMenuImportText => Localization.RomsMenuImportText;
|
||||
public string RomSetsMenuText => Localization.RomSetsMenuText;
|
||||
public string RomSetsMenuSaveRomsText => Localization.RomSetsMenuSaveRomsText;
|
||||
public string RomSetsMenuSaveDatText => Localization.RomSetsMenuSaveDatText;
|
||||
public string RomSetsMenuEditText => Localization.RomSetsMenuEditText;
|
||||
public string RomSetsMenuDeleteText => Localization.RomSetsMenuDeleteText;
|
||||
public string HelpMenuText => Localization.HelpMenuText;
|
||||
public string HelpMenuAboutText => Localization.HelpMenuAboutText;
|
||||
public string FilesystemMenuUmountText => Localization.FilesystemMenuUmountText;
|
||||
public string DatabaseMenuText => Localization.DatabaseMenuText;
|
||||
public string DatabaseMenuUpdateStatsText => Localization.DatabaseMenuUpdateStatsText;
|
||||
public ObservableCollection<RomSetModel> RomSets { get; }
|
||||
public bool IsVfsAvailable => Vfs.IsAvailable;
|
||||
|
||||
public bool NativeMenuSupported =>
|
||||
NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as
|
||||
@@ -159,18 +126,9 @@ public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
var datFileType = new FilePickerFileType(Localization.DatFilesDialogLabel)
|
||||
{
|
||||
Patterns =
|
||||
[
|
||||
"*.dat", "*.xml"
|
||||
],
|
||||
AppleUniformTypeIdentifiers =
|
||||
[
|
||||
"public.xml", "public.json"
|
||||
],
|
||||
MimeTypes =
|
||||
[
|
||||
"application/xml", "text/*"
|
||||
]
|
||||
Patterns = ["*.dat", "*.xml"],
|
||||
AppleUniformTypeIdentifiers = ["public.xml", "public.json"],
|
||||
MimeTypes = ["application/xml", "text/*"]
|
||||
};
|
||||
|
||||
IReadOnlyList<IStorageFile> result = await _view.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
|
||||
@@ -39,8 +39,6 @@ public sealed class RemoveDatViewModel(RemoveDat view, long romSetId) : ViewMode
|
||||
{
|
||||
string _statusMessage;
|
||||
|
||||
public string Title => Localization.RemoveDatTitle;
|
||||
|
||||
public string StatusMessage
|
||||
{
|
||||
get => _statusMessage;
|
||||
|
||||
@@ -79,14 +79,6 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
if(!string.IsNullOrWhiteSpace(UnArPath)) CheckUnAr();
|
||||
}
|
||||
|
||||
public string ChooseLabel => Localization.ChooseLabel;
|
||||
public string Title => Localization.SettingsTitle;
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
public string DatabaseLabel => Localization.DatabaseFileLabel;
|
||||
public string RepositoryLabel => Localization.RepositoryFolderLabel;
|
||||
public string TemporaryLabel => Localization.TemporaryFolderLabel;
|
||||
public string UnArPathLabel => Localization.UnArPathLabel;
|
||||
|
||||
public ReactiveCommand<Unit, Unit> UnArCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> TemporaryCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> RepositoryCommand { get; }
|
||||
@@ -138,8 +130,6 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _unArVersion, value);
|
||||
}
|
||||
|
||||
public string SaveLabel => Localization.SaveLabel;
|
||||
|
||||
void CheckUnAr()
|
||||
{
|
||||
var worker = new Compression();
|
||||
@@ -155,7 +145,7 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
UnArVersion = "";
|
||||
UnArPath = "";
|
||||
|
||||
_ = MessageBoxManager.GetMessageBoxStandard(Localization.Error, $"{args.Message}", ButtonEnum.Ok, Icon.Error)
|
||||
_ = MessageBoxManager.GetMessageBoxStandard(Localization.Error, args.Message, ButtonEnum.Ok, Icon.Error)
|
||||
.ShowWindowDialogAsync(_view);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ using RomRepoMgr.Core.EventArgs;
|
||||
using RomRepoMgr.Core.Models;
|
||||
using RomRepoMgr.Core.Workers;
|
||||
using RomRepoMgr.Database;
|
||||
using RomRepoMgr.Resources;
|
||||
|
||||
namespace RomRepoMgr.ViewModels;
|
||||
|
||||
@@ -180,13 +179,7 @@ public sealed class SplashWindowViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _loadingRomSetsUnknown, value);
|
||||
}
|
||||
|
||||
public string LoadingText => "ROM Repository Manager";
|
||||
public string LoadingSettingsText => Localization.LoadingSettingsText;
|
||||
public string CheckingUnArText => Localization.CheckingUnArText;
|
||||
public string LoadingDatabaseText => Localization.LoadingDatabaseText;
|
||||
public string MigratingDatabaseText => Localization.MigratingDatabaseText;
|
||||
public string LoadingRomSetsText => Localization.LoadingRomSetsText;
|
||||
public string ExitButtonText => Localization.ExitButtonText;
|
||||
public string LoadingText => "ROM Repository Manager";
|
||||
|
||||
void ExecuteExitCommand() =>
|
||||
(Application.Current.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown();
|
||||
|
||||
@@ -60,21 +60,6 @@ public sealed class UpdateStatsViewModel : ViewModelBase
|
||||
RomSets = [];
|
||||
}
|
||||
|
||||
public string Title => Localization.UpdateStatsTitle;
|
||||
public string RomSetNameLabel => Localization.RomSetNameLabel;
|
||||
public string RomSetVersionLabel => Localization.RomSetVersionLabel;
|
||||
public string RomSetAuthorLabel => Localization.RomSetAuthorLabel;
|
||||
public string RomSetCategoryLabel => Localization.RomSetCategoryLabel;
|
||||
public string RomSetDateLabel => Localization.RomSetDateLabel;
|
||||
public string RomSetDescriptionLabel => Localization.RomSetDescriptionLabel;
|
||||
public string RomSetCommentLabel => Localization.RomSetCommentLabel;
|
||||
public string RomSetTotalMachinesLabel => Localization.RomSetTotalMachinesLabel;
|
||||
public string RomSetCompleteMachinesLabel => Localization.RomSetCompleteMachinesLabel;
|
||||
public string RomSetIncompleteMachinesLabel => Localization.RomSetIncompleteMachinesLabel;
|
||||
public string RomSetTotalRomsLabel => Localization.RomSetTotalRomsLabel;
|
||||
public string RomSetHaveRomsLabel => Localization.RomSetHaveRomsLabel;
|
||||
public string RomSetMissRomsLabel => Localization.RomSetMissRomsLabel;
|
||||
|
||||
public string StatusMessage
|
||||
{
|
||||
get => _statusMessage;
|
||||
@@ -125,7 +110,6 @@ public sealed class UpdateStatsViewModel : ViewModelBase
|
||||
|
||||
public ObservableCollection<RomSetModel> RomSets { get; }
|
||||
|
||||
public string CloseLabel => Localization.CloseLabel;
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
|
||||
internal void OnOpened()
|
||||
|
||||
Reference in New Issue
Block a user