mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 11:14:45 +00:00
Parse DAT files.
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "SabreTools"]
|
||||
path = SabreTools
|
||||
url = https://github.com/SabreTools/SabreTools
|
||||
32
RomRepoMgr.Core/EventArgs/ErrorEventArgs.cs
Normal file
32
RomRepoMgr.Core/EventArgs/ErrorEventArgs.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/******************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ 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 © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
namespace RomRepoMgr.Core.EventArgs
|
||||
{
|
||||
public sealed class ErrorEventArgs : System.EventArgs
|
||||
{
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
32
RomRepoMgr.Core/EventArgs/MessageEventArgs.cs
Normal file
32
RomRepoMgr.Core/EventArgs/MessageEventArgs.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/******************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ 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 © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
namespace RomRepoMgr.Core.EventArgs
|
||||
{
|
||||
public sealed class MessageEventArgs : System.EventArgs
|
||||
{
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
33
RomRepoMgr.Core/EventArgs/ProgressBoundsEventArgs.cs
Normal file
33
RomRepoMgr.Core/EventArgs/ProgressBoundsEventArgs.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/******************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ 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 © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
namespace RomRepoMgr.Core.EventArgs
|
||||
{
|
||||
public sealed class ProgressBoundsEventArgs : System.EventArgs
|
||||
{
|
||||
public double Minimum { get; set; }
|
||||
public double Maximum { get; set; }
|
||||
}
|
||||
}
|
||||
32
RomRepoMgr.Core/EventArgs/ProgressEventArgs.cs
Normal file
32
RomRepoMgr.Core/EventArgs/ProgressEventArgs.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/******************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ 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 © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
namespace RomRepoMgr.Core.EventArgs
|
||||
{
|
||||
public sealed class ProgressEventArgs : System.EventArgs
|
||||
{
|
||||
public double Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,8 @@
|
||||
<PackageReference Include="System.Security.Principal.Windows" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SabreTools\SabreTools.Library\SabreTools.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
79
RomRepoMgr.Core/Workers/DatImporter.cs
Normal file
79
RomRepoMgr.Core/Workers/DatImporter.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
/******************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ 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 © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using RomRepoMgr.Core.EventArgs;
|
||||
using SabreTools.Library.DatFiles;
|
||||
|
||||
namespace RomRepoMgr.Core.Workers
|
||||
{
|
||||
public sealed class DatImporter
|
||||
{
|
||||
readonly string _datPath;
|
||||
bool _aborted;
|
||||
|
||||
public DatImporter(string datPath) => _datPath = datPath;
|
||||
|
||||
public void Import()
|
||||
{
|
||||
try
|
||||
{
|
||||
SetIndeterminateProgress?.Invoke(this, System.EventArgs.Empty);
|
||||
|
||||
SetMessage?.Invoke(this, new MessageEventArgs
|
||||
{
|
||||
Message = "Parsing DAT file..."
|
||||
});
|
||||
|
||||
DateTime start = DateTime.UtcNow;
|
||||
var datFile = DatFile.CreateAndParse(_datPath);
|
||||
DateTime end = DateTime.UtcNow;
|
||||
double elapsed = (end - start).TotalSeconds;
|
||||
|
||||
WorkFinished?.Invoke(this, System.EventArgs.Empty);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
if(Debugger.IsAttached)
|
||||
throw;
|
||||
|
||||
ErrorOccurred?.Invoke(this, new ErrorEventArgs
|
||||
{
|
||||
Message = "Unhandled exception occurred."
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Abort() => _aborted = true;
|
||||
|
||||
public event EventHandler SetIndeterminateProgress;
|
||||
public event EventHandler WorkFinished;
|
||||
public event EventHandler<ErrorEventArgs> ErrorOccurred;
|
||||
public event EventHandler<ProgressBoundsEventArgs> SetProgressBounds;
|
||||
public event EventHandler<ProgressEventArgs> SetProgress;
|
||||
public event EventHandler<MessageEventArgs> SetMessage;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RomRepoMgr.Settings", "RomR
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RomRepoMgr.Core", "RomRepoMgr.Core\RomRepoMgr.Core.csproj", "{1C7E7286-1BA6-43B0-A042-4A3C378BDDC1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Library", "SabreTools\SabreTools.Library\SabreTools.Library.csproj", "{9DFA390F-1E96-476B-92CB-0C96EFF3CC9D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -30,5 +32,9 @@ Global
|
||||
{1C7E7286-1BA6-43B0-A042-4A3C378BDDC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1C7E7286-1BA6-43B0-A042-4A3C378BDDC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1C7E7286-1BA6-43B0-A042-4A3C378BDDC1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9DFA390F-1E96-476B-92CB-0C96EFF3CC9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9DFA390F-1E96-476B-92CB-0C96EFF3CC9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9DFA390F-1E96-476B-92CB-0C96EFF3CC9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9DFA390F-1E96-476B-92CB-0C96EFF3CC9D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -23,5 +23,6 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RomRepoMgr.Database\RomRepoMgr.Database.csproj" />
|
||||
<ProjectReference Include="..\RomRepoMgr.Settings\RomRepoMgr.Settings.csproj" />
|
||||
<ProjectReference Include="..\RomRepoMgr.Core\RomRepoMgr.Core.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
161
RomRepoMgr/ViewModels/ImportDatViewModel.cs
Normal file
161
RomRepoMgr/ViewModels/ImportDatViewModel.cs
Normal file
@@ -0,0 +1,161 @@
|
||||
/******************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ 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 © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
using RomRepoMgr.Core.EventArgs;
|
||||
using RomRepoMgr.Core.Workers;
|
||||
using RomRepoMgr.Views;
|
||||
|
||||
namespace RomRepoMgr.ViewModels
|
||||
{
|
||||
public sealed class ImportDatViewModel : ViewModelBase
|
||||
{
|
||||
readonly ImportDat _view;
|
||||
readonly DatImporter _worker;
|
||||
bool _canClose;
|
||||
double _currentValue;
|
||||
string _errorMessage;
|
||||
bool _errorVisible;
|
||||
bool _indeterminateProgress;
|
||||
double _maximumValue;
|
||||
double _minimumValue;
|
||||
bool _progressVisible;
|
||||
string _statusMessage;
|
||||
|
||||
public ImportDatViewModel(ImportDat view, string datPath)
|
||||
{
|
||||
_view = view;
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
IndeterminateProgress = true;
|
||||
ProgressVisible = false;
|
||||
ErrorVisible = false;
|
||||
_worker = new DatImporter(datPath);
|
||||
_worker.ErrorOccurred += OnWorkerOnErrorOccurred;
|
||||
_worker.SetIndeterminateProgress += OnWorkerOnSetIndeterminateProgress;
|
||||
_worker.SetMessage += OnWorkerOnSetMessage;
|
||||
_worker.SetProgress += OnWorkerOnSetProgress;
|
||||
_worker.SetProgressBounds += OnWorkerOnSetProgressBounds;
|
||||
_worker.WorkFinished += OnWorkerOnWorkFinished;
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
public string Title => "Importing DAT file...";
|
||||
|
||||
public string StatusMessage
|
||||
{
|
||||
get => _statusMessage;
|
||||
set => this.RaiseAndSetIfChanged(ref _statusMessage, value);
|
||||
}
|
||||
|
||||
public bool IndeterminateProgress
|
||||
{
|
||||
get => _indeterminateProgress;
|
||||
set => this.RaiseAndSetIfChanged(ref _indeterminateProgress, value);
|
||||
}
|
||||
|
||||
public double MaximumValue
|
||||
{
|
||||
get => _maximumValue;
|
||||
set => this.RaiseAndSetIfChanged(ref _maximumValue, value);
|
||||
}
|
||||
|
||||
public double MinimumValue
|
||||
{
|
||||
get => _minimumValue;
|
||||
set => this.RaiseAndSetIfChanged(ref _minimumValue, value);
|
||||
}
|
||||
|
||||
public double CurrentValue
|
||||
{
|
||||
get => _currentValue;
|
||||
set => this.RaiseAndSetIfChanged(ref _currentValue, value);
|
||||
}
|
||||
|
||||
public bool ProgressVisible
|
||||
{
|
||||
get => _progressVisible;
|
||||
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
|
||||
}
|
||||
|
||||
public bool ErrorVisible
|
||||
{
|
||||
get => _errorVisible;
|
||||
set => this.RaiseAndSetIfChanged(ref _errorVisible, value);
|
||||
}
|
||||
|
||||
public string ErrorMessage
|
||||
{
|
||||
get => _errorMessage;
|
||||
set => this.RaiseAndSetIfChanged(ref _errorMessage, value);
|
||||
}
|
||||
|
||||
public bool CanClose
|
||||
{
|
||||
get => _canClose;
|
||||
set => this.RaiseAndSetIfChanged(ref _canClose, value);
|
||||
}
|
||||
|
||||
public string CloseLabel => "Close";
|
||||
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||
|
||||
void OnWorkerOnWorkFinished(object sender, EventArgs args) => Dispatcher.UIThread.Post(() => CanClose = true);
|
||||
|
||||
void OnWorkerOnSetProgressBounds(object sender, ProgressBoundsEventArgs args) => Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
IndeterminateProgress = false;
|
||||
MaximumValue = args.Maximum;
|
||||
MinimumValue = args.Minimum;
|
||||
});
|
||||
|
||||
void OnWorkerOnSetProgress(object sender, ProgressEventArgs args) =>
|
||||
Dispatcher.UIThread.Post(() => CurrentValue = args.Value);
|
||||
|
||||
void OnWorkerOnSetMessage(object sender, MessageEventArgs args) =>
|
||||
Dispatcher.UIThread.Post(() => StatusMessage = args.Message);
|
||||
|
||||
void OnWorkerOnSetIndeterminateProgress(object sender, EventArgs args) =>
|
||||
Dispatcher.UIThread.Post(() => IndeterminateProgress = true);
|
||||
|
||||
void OnWorkerOnErrorOccurred(object sender, ErrorEventArgs args) => Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
ErrorMessage = args.Message;
|
||||
ErrorVisible = true;
|
||||
CanClose = true;
|
||||
});
|
||||
|
||||
void ExecuteCloseCommand() => _view.Close();
|
||||
|
||||
internal void OnOpened()
|
||||
{
|
||||
ProgressVisible = true;
|
||||
Task.Run(_worker.Import);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
// Copyright © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive;
|
||||
using Avalonia;
|
||||
@@ -40,11 +41,12 @@ namespace RomRepoMgr.ViewModels
|
||||
|
||||
public MainWindowViewModel(MainWindow view)
|
||||
{
|
||||
_view = view;
|
||||
ExitCommand = ReactiveCommand.Create(ExecuteExitCommand);
|
||||
SettingsCommand = ReactiveCommand.Create(ExecuteSettingsCommand);
|
||||
AboutCommand = ReactiveCommand.Create(ExecuteAboutCommand);
|
||||
RomSets = new ObservableCollection<RomSetModel>();
|
||||
_view = view;
|
||||
ExitCommand = ReactiveCommand.Create(ExecuteExitCommand);
|
||||
SettingsCommand = ReactiveCommand.Create(ExecuteSettingsCommand);
|
||||
AboutCommand = ReactiveCommand.Create(ExecuteAboutCommand);
|
||||
ImportDatCommand = ReactiveCommand.Create(ExecuteImportDatCommand);
|
||||
RomSets = new ObservableCollection<RomSetModel>();
|
||||
}
|
||||
|
||||
public ObservableCollection<RomSetModel> RomSets { get; }
|
||||
@@ -57,9 +59,10 @@ namespace RomRepoMgr.ViewModels
|
||||
NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as
|
||||
IClassicDesktopStyleApplicationLifetime)?.MainWindow);
|
||||
|
||||
public ReactiveCommand<Unit, Unit> AboutCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ExitCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> SettingsCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> AboutCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ExitCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> SettingsCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ImportDatCommand { get; }
|
||||
|
||||
internal async void ExecuteSettingsCommand()
|
||||
{
|
||||
@@ -77,5 +80,40 @@ namespace RomRepoMgr.ViewModels
|
||||
dialog.DataContext = new AboutViewModel(dialog);
|
||||
dialog.ShowDialog(_view);
|
||||
}
|
||||
|
||||
internal async void ExecuteImportDatCommand()
|
||||
{
|
||||
var dlgOpen = new OpenFileDialog();
|
||||
dlgOpen.AllowMultiple = false;
|
||||
dlgOpen.Title = "Import DAT file...";
|
||||
|
||||
dlgOpen.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>
|
||||
{
|
||||
"*.dat",
|
||||
"*.xml"
|
||||
},
|
||||
Name = "DAT files"
|
||||
});
|
||||
|
||||
dlgOpen.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new List<string>
|
||||
{
|
||||
"*.*"
|
||||
},
|
||||
Name = "All files"
|
||||
});
|
||||
|
||||
string[] result = await dlgOpen.ShowAsync(_view);
|
||||
|
||||
if(result?.Length != 1)
|
||||
return;
|
||||
|
||||
var dialog = new ImportDat();
|
||||
dialog.DataContext = new ImportDatViewModel(dialog, result[0]);
|
||||
await dialog.ShowDialog(_view);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
RomRepoMgr/Views/ImportDat.xaml
Normal file
55
RomRepoMgr/Views/ImportDat.xaml
Normal file
@@ -0,0 +1,55 @@
|
||||
<!--
|
||||
// /***************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// ‐‐[ 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 © 2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
-->
|
||||
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:RomRepoMgr.ViewModels;assembly=RomRepoMgr" mc:Ignorable="d" d:DesignWidth="800"
|
||||
d:DesignHeight="450" Width="480" Height="90" x:Class="RomRepoMgr.Views.ImportDat"
|
||||
Icon="/Assets/avalonia-logo.ico" CanResize="False" Title="{Binding Title}" WindowStartupLocation="CenterOwner">
|
||||
<Design.DataContext>
|
||||
<vm:ImportDatViewModel />
|
||||
</Design.DataContext>
|
||||
<Border Padding="15">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" /> <RowDefinition Height="auto" /> <RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding StatusMessage}" HorizontalAlignment="Center" />
|
||||
<ProgressBar Grid.Row="1" IsIndeterminate="{Binding IndeterminateProgress}"
|
||||
Maximum="{Binding MaximumValue}" Minimum="{Binding MinimumValue}"
|
||||
Value="{Binding CurrentValue}" HorizontalAlignment="Stretch"
|
||||
IsVisible="{Binding ProgressVisible}" />
|
||||
<TextBlock Grid.Row="2" Text="{Binding ErrorMessage}" HorizontalAlignment="Center" Foreground="Red"
|
||||
IsVisible="{Binding ErrorVisible}" />
|
||||
<Button Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" IsEnabled="{Binding CanClose}"
|
||||
Command="{Binding CloseCommand}">
|
||||
<TextBlock Text="{Binding CloseLabel}" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
45
RomRepoMgr/Views/ImportDat.xaml.cs
Normal file
45
RomRepoMgr/Views/ImportDat.xaml.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
/******************************************************************************
|
||||
// RomRepoMgr - ROM repository manager
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ 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 © 2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using RomRepoMgr.ViewModels;
|
||||
|
||||
namespace RomRepoMgr.Views
|
||||
{
|
||||
public sealed class ImportDat : Window
|
||||
{
|
||||
public ImportDat() => InitializeComponent();
|
||||
|
||||
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
protected override void OnOpened(EventArgs e)
|
||||
{
|
||||
base.OnOpened(e);
|
||||
(DataContext as ImportDatViewModel)?.OnOpened();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_Import DAT" Command="{Binding ImportDatCommand}" /> <Separator />
|
||||
<MenuItem Header="_Settings" IsVisible="{Binding !NativeMenuSupported}"
|
||||
Command="{Binding SettingsCommand}" />
|
||||
<Separator />
|
||||
|
||||
1
SabreTools
Submodule
1
SabreTools
Submodule
Submodule SabreTools added at b01217cffb
Reference in New Issue
Block a user