Move models to core.

This commit is contained in:
2020-08-22 13:36:39 +01:00
parent ad4bbdc417
commit 94e7c9af84
8 changed files with 47 additions and 16 deletions

View File

@@ -0,0 +1,35 @@
/******************************************************************************
// 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.Collections.Generic;
using RomRepoMgr.Core.Models;
namespace RomRepoMgr.Core.EventArgs
{
public sealed class RomSetEventArgs : System.EventArgs
{
public List<RomSetModel> RomSets { get; set; }
}
}

View File

@@ -23,7 +23,7 @@
// Copyright © 2020 Natalia Portillo // Copyright © 2020 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
namespace RomRepoMgr.Models namespace RomRepoMgr.Core.Models
{ {
public sealed class AssemblyModel public sealed class AssemblyModel
{ {

View File

@@ -23,7 +23,7 @@
// Copyright © 2020 Natalia Portillo // Copyright © 2020 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
namespace RomRepoMgr.Models namespace RomRepoMgr.Core.Models
{ {
public class RomSetModel public class RomSetModel
{ {

View File

@@ -29,7 +29,8 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using RomRepoMgr.Models; using RomRepoMgr.Core.EventArgs;
using RomRepoMgr.Core.Models;
using RomRepoMgr.ViewModels; using RomRepoMgr.ViewModels;
using RomRepoMgr.Views; using RomRepoMgr.Views;
@@ -56,7 +57,7 @@ namespace RomRepoMgr
base.OnFrameworkInitializationCompleted(); base.OnFrameworkInitializationCompleted();
} }
void OnGotRomSets(object sender, SplashWindowViewModel.RomSetEventArgs e) => _romSets = e.RomSets; void OnGotRomSets(object sender, RomSetEventArgs e) => _romSets = e.RomSets;
void OnSplashFinished(object sender, EventArgs e) void OnSplashFinished(object sender, EventArgs e)
{ {

View File

@@ -4,7 +4,6 @@
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Models\" />
<Compile Update="**\*.xaml.cs"> <Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon> <DependentUpon>%(Filename)</DependentUpon>
</Compile> </Compile>

View File

@@ -33,7 +33,7 @@ using System.Threading.Tasks;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.DotNet.PlatformAbstractions; using Microsoft.DotNet.PlatformAbstractions;
using ReactiveUI; using ReactiveUI;
using RomRepoMgr.Models; using RomRepoMgr.Core.Models;
using RomRepoMgr.Views; using RomRepoMgr.Views;
namespace RomRepoMgr.ViewModels namespace RomRepoMgr.ViewModels

View File

@@ -30,7 +30,7 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using ReactiveUI; using ReactiveUI;
using RomRepoMgr.Models; using RomRepoMgr.Core.Models;
using RomRepoMgr.Views; using RomRepoMgr.Views;
namespace RomRepoMgr.ViewModels namespace RomRepoMgr.ViewModels
@@ -116,8 +116,9 @@ namespace RomRepoMgr.ViewModels
if(result?.Length != 1) if(result?.Length != 1)
return; return;
var dialog = new ImportDat(); var dialog = new ImportDat();
dialog.DataContext = new ImportDatViewModel(dialog, result[0]); var importDatViewModel = new ImportDatViewModel(dialog, result[0]);
dialog.DataContext = importDatViewModel;
await dialog.ShowDialog(_view); await dialog.ShowDialog(_view);
} }
} }

View File

@@ -24,7 +24,6 @@
*******************************************************************************/ *******************************************************************************/
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reactive; using System.Reactive;
@@ -34,8 +33,9 @@ using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Threading; using Avalonia.Threading;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ReactiveUI; using ReactiveUI;
using RomRepoMgr.Core.EventArgs;
using RomRepoMgr.Core.Models;
using RomRepoMgr.Database; using RomRepoMgr.Database;
using RomRepoMgr.Models;
namespace RomRepoMgr.ViewModels namespace RomRepoMgr.ViewModels
{ {
@@ -352,10 +352,5 @@ namespace RomRepoMgr.ViewModels
internal event EventHandler WorkFinished; internal event EventHandler WorkFinished;
internal event EventHandler<RomSetEventArgs> GotRomSets; internal event EventHandler<RomSetEventArgs> GotRomSets;
public sealed class RomSetEventArgs : EventArgs
{
public List<RomSetModel> RomSets { get; set; }
}
} }
} }