mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
[Refactor] Add public constructor to About viewmodel.
This commit is contained in:
@@ -25,11 +25,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
@@ -43,10 +41,35 @@ public sealed class AboutViewModel : ViewModelBase
|
|||||||
readonly About _view;
|
readonly About _view;
|
||||||
string _versionText;
|
string _versionText;
|
||||||
|
|
||||||
|
public AboutViewModel()
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
public AboutViewModel(About view)
|
public AboutViewModel(About view)
|
||||||
{
|
{
|
||||||
_view = view;
|
_view = view;
|
||||||
|
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
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; private set; }
|
||||||
|
public ReactiveCommand<Unit, Unit> LicenseCommand { get; private set; }
|
||||||
|
public ReactiveCommand<Unit, Unit> CloseCommand { get; private set; }
|
||||||
|
public ObservableCollection<AssemblyModel> Assemblies { get; private set; }
|
||||||
|
|
||||||
|
public string VersionText
|
||||||
|
{
|
||||||
|
get => _versionText;
|
||||||
|
private set => this.RaiseAndSetIfChanged(ref _versionText, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadData()
|
||||||
|
{
|
||||||
VersionText =
|
VersionText =
|
||||||
(Attribute.GetCustomAttribute(typeof(App).Assembly, typeof(AssemblyInformationalVersionAttribute)) as
|
(Attribute.GetCustomAttribute(typeof(App).Assembly, typeof(AssemblyInformationalVersionAttribute)) as
|
||||||
AssemblyInformationalVersionAttribute)?.InformationalVersion;
|
AssemblyInformationalVersionAttribute)?.InformationalVersion;
|
||||||
@@ -81,21 +104,6 @@ public sealed class AboutViewModel : ViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
get => _versionText;
|
|
||||||
set => this.RaiseAndSetIfChanged(ref _versionText, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExecuteWebsiteCommand()
|
void ExecuteWebsiteCommand()
|
||||||
{
|
{
|
||||||
_ = _view.Launcher.LaunchUriAsync(new Uri("https://www.claunia.com"));
|
_ = _view.Launcher.LaunchUriAsync(new Uri("https://www.claunia.com"));
|
||||||
|
|||||||
Reference in New Issue
Block a user