mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Add option to edit DAT information in database.
This commit is contained in:
233
RomRepoMgr/ViewModels/EditDatViewModel.cs
Normal file
233
RomRepoMgr/ViewModels/EditDatViewModel.cs
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// 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 ReactiveUI;
|
||||||
|
using RomRepoMgr.Core.EventArgs;
|
||||||
|
using RomRepoMgr.Core.Models;
|
||||||
|
using RomRepoMgr.Database;
|
||||||
|
using RomRepoMgr.Database.Models;
|
||||||
|
using RomRepoMgr.Views;
|
||||||
|
|
||||||
|
namespace RomRepoMgr.ViewModels
|
||||||
|
{
|
||||||
|
public class EditDatViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
readonly EditDat _view;
|
||||||
|
string _author;
|
||||||
|
string _comment;
|
||||||
|
string _date;
|
||||||
|
string _description;
|
||||||
|
string _homepage;
|
||||||
|
|
||||||
|
bool _modified;
|
||||||
|
string _name;
|
||||||
|
readonly RomSetModel _romSet;
|
||||||
|
string _version;
|
||||||
|
|
||||||
|
public EditDatViewModel(EditDat view, RomSetModel romSet)
|
||||||
|
{
|
||||||
|
_view = view;
|
||||||
|
_romSet = romSet;
|
||||||
|
_name = romSet.Name;
|
||||||
|
_version = romSet.Version;
|
||||||
|
_author = romSet.Author;
|
||||||
|
_comment = romSet.Comment;
|
||||||
|
_date = romSet.Date;
|
||||||
|
_description = romSet.Description;
|
||||||
|
_homepage = romSet.Homepage;
|
||||||
|
SaveCommand = ReactiveCommand.Create(ExecuteSaveCommand);
|
||||||
|
CancelCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||||
|
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string NameLabel => "Name";
|
||||||
|
public string VersionLabel => "Version";
|
||||||
|
public string AuthorLabel => "Author";
|
||||||
|
public string CommentLabel => "Comment";
|
||||||
|
public string DateLabel => "Date";
|
||||||
|
public string DescriptionLabel => "Description";
|
||||||
|
public string HomepageLabel => "Homepage";
|
||||||
|
public string TotalMachinesLabel => "Total games";
|
||||||
|
public string CompleteMachinesLabel => "Complete games";
|
||||||
|
public string IncompleteMachinesLabel => "Incomplete games";
|
||||||
|
public string TotalRomsLabel => "Total ROMs";
|
||||||
|
public string HaveRomsLabel => "Have ROMs";
|
||||||
|
public string MissRomsLabel => "Missing ROMs";
|
||||||
|
public string Title => "Edit DAT";
|
||||||
|
public string SaveLabel => "Save";
|
||||||
|
public string CancelLabel => "Cancel";
|
||||||
|
public string CloseLabel => "Close";
|
||||||
|
|
||||||
|
public ReactiveCommand<Unit, Unit> SaveCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> CancelCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
|
||||||
|
public long TotalMachines => _romSet.TotalMachines;
|
||||||
|
public long CompleteMachines => _romSet.CompleteMachines;
|
||||||
|
public long IncompleteMachines => _romSet.IncompleteMachines;
|
||||||
|
public long TotalRoms => _romSet.TotalRoms;
|
||||||
|
public long HaveRoms => _romSet.HaveRoms;
|
||||||
|
public long MissRoms => _romSet.MissRoms;
|
||||||
|
|
||||||
|
public bool Modified
|
||||||
|
{
|
||||||
|
get => _modified;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _modified, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => _name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value != _name)
|
||||||
|
Modified = true;
|
||||||
|
|
||||||
|
this.RaiseAndSetIfChanged(ref _name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get => _version;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value != _version)
|
||||||
|
Modified = true;
|
||||||
|
|
||||||
|
this.RaiseAndSetIfChanged(ref _version, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Author
|
||||||
|
{
|
||||||
|
get => _author;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value != _author)
|
||||||
|
Modified = true;
|
||||||
|
|
||||||
|
this.RaiseAndSetIfChanged(ref _author, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Comment
|
||||||
|
{
|
||||||
|
get => _comment;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value != _comment)
|
||||||
|
Modified = true;
|
||||||
|
|
||||||
|
this.RaiseAndSetIfChanged(ref _comment, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Date
|
||||||
|
{
|
||||||
|
get => _date;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value != _date)
|
||||||
|
Modified = true;
|
||||||
|
|
||||||
|
this.RaiseAndSetIfChanged(ref _date, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get => _description;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value != _description)
|
||||||
|
Modified = true;
|
||||||
|
|
||||||
|
this.RaiseAndSetIfChanged(ref _description, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Homepage
|
||||||
|
{
|
||||||
|
get => _homepage;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(value != _homepage)
|
||||||
|
Modified = true;
|
||||||
|
|
||||||
|
this.RaiseAndSetIfChanged(ref _homepage, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventHandler<RomSetEventArgs> RomSetModified { get; set; }
|
||||||
|
|
||||||
|
void ExecuteCloseCommand() => _view.Close();
|
||||||
|
|
||||||
|
async void ExecuteSaveCommand()
|
||||||
|
{
|
||||||
|
RomSet romSetDb = await Context.Singleton.RomSets.FindAsync(_romSet.Id);
|
||||||
|
|
||||||
|
if(romSetDb == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
romSetDb.Author = Author;
|
||||||
|
romSetDb.Comment = Comment;
|
||||||
|
romSetDb.Date = Date;
|
||||||
|
romSetDb.Description = Description;
|
||||||
|
romSetDb.Homepage = Homepage;
|
||||||
|
romSetDb.Name = Name;
|
||||||
|
romSetDb.Version = Version;
|
||||||
|
romSetDb.UpdatedOn = DateTime.UtcNow;
|
||||||
|
|
||||||
|
await Context.Singleton.SaveChangesAsync();
|
||||||
|
|
||||||
|
RomSetModified?.Invoke(this, new RomSetEventArgs
|
||||||
|
{
|
||||||
|
RomSet = new RomSetModel
|
||||||
|
{
|
||||||
|
Author = Author,
|
||||||
|
Comment = Comment,
|
||||||
|
Date = Date,
|
||||||
|
Description = Description,
|
||||||
|
Homepage = Homepage,
|
||||||
|
Name = Name,
|
||||||
|
Version = Version,
|
||||||
|
Filename = _romSet.Filename,
|
||||||
|
Sha384 = _romSet.Sha384,
|
||||||
|
TotalMachines = _romSet.TotalMachines,
|
||||||
|
CompleteMachines = _romSet.CompleteMachines,
|
||||||
|
IncompleteMachines = _romSet.IncompleteMachines,
|
||||||
|
TotalRoms = _romSet.TotalRoms,
|
||||||
|
HaveRoms = _romSet.HaveRoms,
|
||||||
|
MissRoms = _romSet.MissRoms,
|
||||||
|
Id = _romSet.Id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Modified = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
@@ -55,6 +56,7 @@ namespace RomRepoMgr.ViewModels
|
|||||||
ImportDatFolderCommand = ReactiveCommand.Create(ExecuteImportDatFolderCommand);
|
ImportDatFolderCommand = ReactiveCommand.Create(ExecuteImportDatFolderCommand);
|
||||||
ImportRomFolderCommand = ReactiveCommand.Create(ExecuteImportRomFolderCommand);
|
ImportRomFolderCommand = ReactiveCommand.Create(ExecuteImportRomFolderCommand);
|
||||||
DeleteRomSetCommand = ReactiveCommand.Create(ExecuteDeleteRomSetCommand);
|
DeleteRomSetCommand = ReactiveCommand.Create(ExecuteDeleteRomSetCommand);
|
||||||
|
EditRomSetCommand = ReactiveCommand.Create(ExecuteEditRomSetCommand);
|
||||||
RomSets = new ObservableCollection<RomSetModel>(romSets);
|
RomSets = new ObservableCollection<RomSetModel>(romSets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +87,7 @@ namespace RomRepoMgr.ViewModels
|
|||||||
public ReactiveCommand<Unit, Unit> ImportDatFolderCommand { get; }
|
public ReactiveCommand<Unit, Unit> ImportDatFolderCommand { get; }
|
||||||
public ReactiveCommand<Unit, Unit> ImportRomFolderCommand { get; }
|
public ReactiveCommand<Unit, Unit> ImportRomFolderCommand { get; }
|
||||||
public ReactiveCommand<Unit, Unit> DeleteRomSetCommand { get; }
|
public ReactiveCommand<Unit, Unit> DeleteRomSetCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> EditRomSetCommand { get; }
|
||||||
|
|
||||||
public RomSetModel SelectedRomSet
|
public RomSetModel SelectedRomSet
|
||||||
{
|
{
|
||||||
@@ -213,5 +216,26 @@ namespace RomRepoMgr.ViewModels
|
|||||||
RomSets.Remove(SelectedRomSet);
|
RomSets.Remove(SelectedRomSet);
|
||||||
SelectedRomSet = null;
|
SelectedRomSet = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExecuteEditRomSetCommand()
|
||||||
|
{
|
||||||
|
var window = new EditDat();
|
||||||
|
var viewModel = new EditDatViewModel(window, SelectedRomSet);
|
||||||
|
|
||||||
|
viewModel.RomSetModified += (sender, args) =>
|
||||||
|
{
|
||||||
|
RomSetModel old = RomSets.FirstOrDefault(r => r.Id == args.RomSet.Id);
|
||||||
|
|
||||||
|
if(old == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RomSets.Remove(old);
|
||||||
|
RomSets.Add(args.RomSet);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.DataContext = viewModel;
|
||||||
|
|
||||||
|
window.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
178
RomRepoMgr/Views/EditDat.xaml
Normal file
178
RomRepoMgr/Views/EditDat.xaml
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
<!--
|
||||||
|
// /***************************************************************************
|
||||||
|
// 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="720" Height="480" x:Class="RomRepoMgr.Views.EditDat"
|
||||||
|
Icon="/Assets/avalonia-logo.ico" CanResize="False" Title="{Binding Title}" WindowStartupLocation="CenterScreen">
|
||||||
|
<Design.DataContext>
|
||||||
|
<vm:EditDatViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
|
<Border Padding="15">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding NameLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{Binding Name}"
|
||||||
|
Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding VersionLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||||
|
Text="{Binding Version}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding AuthorLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||||
|
Text="{Binding Author}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="3">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding CommentLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||||
|
Text="{Binding Comment}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="4">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding DateLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{Binding Date}"
|
||||||
|
Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding DescriptionLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||||
|
Text="{Binding Description}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="6">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding HomepageLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||||
|
Text="{Binding Homepage}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="7">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding TotalMachinesLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
|
Text="{Binding TotalMachines}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding CompleteMachinesLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
|
Text="{Binding CompleteMachines}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="9">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding IncompleteMachinesLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
|
Text="{Binding IncompleteMachines}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding TotalRomsLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
|
Text="{Binding TotalRoms}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="11">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding HaveRomsLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
|
Text="{Binding HaveRoms}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="12">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" /> <ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
|
Text="{Binding MissRomsLabel}" FontWeight="Bold" Padding="5" />
|
||||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
|
Text="{Binding MissRoms}" Padding="5" />
|
||||||
|
</Grid>
|
||||||
|
<StackPanel Grid.Row="13" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding SaveCommand}"
|
||||||
|
IsVisible="{Binding Modified}">
|
||||||
|
<TextBlock Text="{Binding SaveLabel}" />
|
||||||
|
</Button>
|
||||||
|
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding CancelCommand}"
|
||||||
|
IsVisible="{Binding Modified}">
|
||||||
|
<TextBlock Text="{Binding CancelLabel}" />
|
||||||
|
</Button>
|
||||||
|
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding CloseCommand}"
|
||||||
|
IsVisible="{Binding !Modified}">
|
||||||
|
<TextBlock Text="{Binding CloseLabel}" />
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
||||||
37
RomRepoMgr/Views/EditDat.xaml.cs
Normal file
37
RomRepoMgr/Views/EditDat.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// 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 Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace RomRepoMgr.Views
|
||||||
|
{
|
||||||
|
public sealed class EditDat : Window
|
||||||
|
{
|
||||||
|
public EditDat() => InitializeComponent();
|
||||||
|
|
||||||
|
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="ROM _sets"
|
<MenuItem Header="ROM _sets"
|
||||||
IsEnabled="{Binding SelectedRomSet, Converter={x:Static ObjectConverters.IsNotNull}}">
|
IsEnabled="{Binding SelectedRomSet, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||||
|
<MenuItem Header="_Edit" Command="{Binding EditRomSetCommand}" /> <Separator />
|
||||||
<MenuItem Header="_Delete" Command="{Binding DeleteRomSetCommand}" /> <Separator />
|
<MenuItem Header="_Delete" Command="{Binding DeleteRomSetCommand}" /> <Separator />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_Help">
|
<MenuItem Header="_Help">
|
||||||
|
|||||||
Reference in New Issue
Block a user