2020-04-17 21:45:50 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// Aaru Data Preservation Suite
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : LicenseViewModel.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : GUI view models.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// View model and code for the license dialog.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU General public License as
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
// GNU General public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU General public License
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
// Copyright © 2011-2020 Natalia Portillo
|
|
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System.IO;
|
2020-04-10 02:28:10 +01:00
|
|
|
|
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
|
|
|
|
{
|
2020-04-16 21:29:40 +01:00
|
|
|
|
public class LicenseViewModel : ViewModelBase
|
2020-04-10 02:28:10 +01:00
|
|
|
|
{
|
|
|
|
|
|
readonly LicenseDialog _view;
|
|
|
|
|
|
string _versionText;
|
|
|
|
|
|
|
2020-04-16 21:29:40 +01:00
|
|
|
|
public LicenseViewModel(LicenseDialog view)
|
2020-04-10 02:28:10 +01:00
|
|
|
|
{
|
|
|
|
|
|
_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();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|