Add list of ROM sets to main window.

This commit is contained in:
2020-08-22 03:26:43 +01:00
parent 8c38694b7e
commit 899590432a
3 changed files with 56 additions and 1 deletions

View 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.Models
{
public sealed class RomSetModel
{
public string Name { get; set; }
public string Version { get; set; }
}
}

View File

@@ -23,11 +23,13 @@
// Copyright © 2020 Natalia Portillo
*******************************************************************************/
using System.Collections.ObjectModel;
using System.Reactive;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using ReactiveUI;
using RomRepoMgr.Models;
using RomRepoMgr.Views;
namespace RomRepoMgr.ViewModels
@@ -42,8 +44,14 @@ namespace RomRepoMgr.ViewModels
ExitCommand = ReactiveCommand.Create(ExecuteExitCommand);
SettingsCommand = ReactiveCommand.Create(ExecuteSettingsCommand);
AboutCommand = ReactiveCommand.Create(ExecuteAboutCommand);
RomSets = new ObservableCollection<RomSetModel>();
}
public ObservableCollection<RomSetModel> RomSets { get; }
public string RomSetLabel => "ROM sets";
public string RomSetNameLabel => "Name";
public string RomSetVersionLabel => "Version";
public string Greeting => "Hello World!";
public bool NativeMenuSupported =>
NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as

View File

@@ -19,6 +19,20 @@
Command="{Binding AboutCommand}" />
</MenuItem>
</Menu>
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TabItem>
<TabItem.Header>
<TextBlock Text="{Binding RomSetLabel}" />
</TabItem.Header>
<DataGrid Items="{Binding RomSets}" HorizontalScrollBarVisibility="Visible">
<DataGrid.Columns>
<DataGridTextColumn Header="{Binding RomSetNameLabel}" Binding="{Binding Name}" Width="Auto"
IsReadOnly="True" />
<DataGridTextColumn Header="{Binding RomSetVersionLabel}" Binding="{Binding Version}"
Width="Auto" IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
</TabItem>
</TabControl>
</DockPanel>
</Window>