Files
Aaru/Aaru.Gui/ViewModels/Dialogs/LicenseDialogViewModel.cs

33 lines
1.1 KiB
C#
Raw Normal View History

2020-04-10 02:28:10 +01:00
using System.IO;
using System.Reactive;
using System.Reflection;
2020-04-16 20:40:25 +01:00
using Aaru.Gui.Views.Dialogs;
2020-04-10 02:28:10 +01:00
using ReactiveUI;
2020-04-16 20:40:25 +01:00
namespace Aaru.Gui.ViewModels.Dialogs
2020-04-10 02:28:10 +01:00
{
public class LicenseDialogViewModel : ViewModelBase
{
readonly LicenseDialog _view;
string _versionText;
public LicenseDialogViewModel(LicenseDialog view)
{
_view = view;
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
using(Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Aaru.Gui.LICENSE"))
using(var reader = new StreamReader(stream))
{
LicenseText = reader.ReadToEnd();
}
}
public string Title => "Aaru's license";
public string CloseLabel => "Close";
public string LicenseText { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
void ExecuteCloseCommand() => _view.Close();
}
}