Restrcutured the database, and updated pipeline to include cover art.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using MangaReader.Core.Data;
|
||||
using MangaReader.WinUI.ViewModels;
|
||||
using MangaReader.WinUI.Views;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System;
|
||||
@@ -19,7 +21,9 @@ public partial class App : Application
|
||||
|
||||
services.AddSingleton<MainWindow>();
|
||||
|
||||
services.AddSingleton<MainViewModel>();
|
||||
services.AddSingleton<SearchViewModel>();
|
||||
services.AddSingleton<LibraryViewModel>();
|
||||
|
||||
services.AddMangaReader();
|
||||
|
||||
@@ -29,6 +33,7 @@ public partial class App : Application
|
||||
using var scope = ServiceProvider.CreateScope();
|
||||
var dbContext = scope.ServiceProvider.GetRequiredService<MangaContext>();
|
||||
dbContext.Database.EnsureCreated();
|
||||
dbContext.Database.Migrate();
|
||||
}
|
||||
|
||||
public App()
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Title Bar -->
|
||||
<Grid x:Name="AppTitleBar" Grid.Row="0" VerticalAlignment="Center" Padding="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
@@ -27,13 +28,7 @@
|
||||
<Image Grid.Column="0" x:Name="TitleBarIcon" Source="ms-appx:///Assets/Images/MangaReader.png" Width="20" Height="20" Margin="0 0 10 0" />
|
||||
<TextBlock Grid.Column="1" x:Name="AppTitle" Text="{x:Bind Title, Mode=OneWay}" Style="{StaticResource CaptionTextBlockStyle}" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<views:SearchView Grid.Row="1"></views:SearchView>
|
||||
<!--<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBox Name="KeywordTextBox" Width="300"></TextBox>
|
||||
<Button Content="Search" Click="Button_Click"></Button>
|
||||
</StackPanel>
|
||||
<Image Name="CoverImage" Width="256" Height="364" Source="https://mangadex.org/covers/a920060c-7e39-4ac1-980c-f0e605a40ae4/07d02b26-cbd0-4323-8774-9d83579863d5.jpg.256.jpg"></Image>
|
||||
</StackPanel>-->
|
||||
<!-- Main View -->
|
||||
<views:MainView Grid.Row="1"></views:MainView>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.2.250402" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.2.250402" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4188" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.10" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.119.0" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.6584" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.250916003" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.119.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MangaReader.Core\MangaReader.Core.csproj" />
|
||||
@@ -67,6 +67,9 @@
|
||||
<Page Update="Resources\Fonts.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\MainView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\LibraryView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MangaReader.Core.Data;
|
||||
using MangaReader.Core.Metadata;
|
||||
using MangaReader.Core.Pipeline;
|
||||
using MangaReader.Core.Search;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using SixLabors.ImageSharp;
|
||||
@@ -11,6 +13,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -18,7 +21,14 @@ using System.Windows.Input;
|
||||
|
||||
namespace MangaReader.WinUI.ViewModels;
|
||||
|
||||
public partial class LibraryViewModel : ViewModelBase
|
||||
public partial class LibraryViewModel(MangaContext context) : ViewModelBase
|
||||
{
|
||||
public void GetSomething()
|
||||
{
|
||||
var mangas = context.Mangas
|
||||
.Include(x => x.Sources)
|
||||
.ThenInclude(x => x.Chapters);
|
||||
|
||||
//mangas.Select(x => new MangaS)
|
||||
}
|
||||
}
|
||||
39
MangaReader.WinUI/ViewModels/MainViewModel.cs
Normal file
39
MangaReader.WinUI/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MangaReader.Core.Metadata;
|
||||
using MangaReader.Core.Pipeline;
|
||||
using MangaReader.Core.Search;
|
||||
using MangaReader.WinUI.Views;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace MangaReader.WinUI.ViewModels;
|
||||
|
||||
public partial class MainViewModel : ViewModelBase
|
||||
{
|
||||
private string? _keyword;
|
||||
|
||||
public string? Keyword
|
||||
{
|
||||
get
|
||||
{
|
||||
return _keyword;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _keyword, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,12 @@ namespace MangaReader.WinUI.ViewModels;
|
||||
|
||||
public class ViewModelLocator
|
||||
{
|
||||
public static MainViewModel MainViewModel
|
||||
=> App.ServiceProvider.GetRequiredService<MainViewModel>();
|
||||
|
||||
public static SearchViewModel SearchViewModel
|
||||
=> App.ServiceProvider.GetRequiredService<SearchViewModel>();
|
||||
|
||||
public static LibraryViewModel LibraryViewModel
|
||||
=> App.ServiceProvider.GetRequiredService<LibraryViewModel>();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<UserControl
|
||||
<Page
|
||||
x:Class="MangaReader.WinUI.Views.LibraryView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -38,4 +38,4 @@
|
||||
</ScrollViewer>-->
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</Page>
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MangaReader.WinUI.Views;
|
||||
|
||||
public sealed partial class LibraryView : UserControl
|
||||
public sealed partial class LibraryView : Page
|
||||
{
|
||||
private readonly LibraryViewModel viewModel;
|
||||
|
||||
|
||||
26
MangaReader.WinUI/Views/MainView.xaml
Normal file
26
MangaReader.WinUI/Views/MainView.xaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<UserControl
|
||||
x:Class="MangaReader.WinUI.Views.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:MangaReader.WinUI.Views"
|
||||
xmlns:vm="using:MangaReader.WinUI.ViewModels"
|
||||
xmlns:search="using:MangaReader.Core.Search"
|
||||
xmlns:UI="using:CommunityToolkit.WinUI"
|
||||
xmlns:Controls="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:Media="using:CommunityToolkit.WinUI.Media"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
DataContext="{Binding Source={StaticResource Locator}, Path=MainViewModel}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:MainViewModel, IsDesignTimeCreatable=True}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<NavigationView IsBackEnabled="False" IsBackButtonVisible="Collapsed" SelectionChanged="nvSample_SelectionChanged">
|
||||
<NavigationView.MenuItems>
|
||||
<NavigationViewItem Icon="Library" Content="Library" Tag="Library" />
|
||||
<NavigationViewItem Icon="Find" Content="Search" Tag="Search" />
|
||||
</NavigationView.MenuItems>
|
||||
<Frame x:Name="ContentFrame"/>
|
||||
</NavigationView>
|
||||
|
||||
</UserControl>
|
||||
50
MangaReader.WinUI/Views/MainView.xaml.cs
Normal file
50
MangaReader.WinUI/Views/MainView.xaml.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using MangaReader.WinUI.ViewModels;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MangaReader.WinUI.Views;
|
||||
|
||||
public sealed partial class MainView : UserControl
|
||||
{
|
||||
private readonly MainViewModel viewModel;
|
||||
|
||||
private readonly List<(string Tag, Type ViewType)> _tagViewMap =
|
||||
[
|
||||
("Search", typeof(SearchView)),
|
||||
("Library", typeof(LibraryView))
|
||||
];
|
||||
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
viewModel = (MainViewModel)DataContext;
|
||||
}
|
||||
|
||||
private void nvSample_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
||||
{
|
||||
if (args.SelectedItem is not NavigationViewItem navigationViewItem)
|
||||
return;
|
||||
|
||||
if (navigationViewItem.Tag is not string tagName)
|
||||
return;
|
||||
|
||||
UpdateContent(tagName, null);
|
||||
}
|
||||
|
||||
private void UpdateContent(string tag, NavigationTransitionInfo? transitionInfo)
|
||||
{
|
||||
Type? viewType = _tagViewMap.FirstOrDefault(x => x.Tag == tag).ViewType;
|
||||
|
||||
if (viewType == null)
|
||||
return;
|
||||
|
||||
ContentFrame.Navigate(viewType);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<UserControl
|
||||
<Page
|
||||
x:Class="MangaReader.WinUI.Views.SearchView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -14,7 +14,7 @@
|
||||
DataContext="{Binding Source={StaticResource Locator}, Path=SearchViewModel}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:SearchViewModel, IsDesignTimeCreatable=True}"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Page.Resources>
|
||||
<Media:AttachedCardShadow x:Key="CommonShadow" Offset="5" BlurRadius="10" Opacity=".4" />
|
||||
|
||||
<DataTemplate x:Key="MangaSearchResultTemplate" x:DataType="vm:ObservableMangaSearchResult">
|
||||
@@ -36,7 +36,9 @@
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{x:Bind Title, Mode=OneTime}" FontSize="24" FontFamily="{StaticResource PoppinsSemiBold}" TextWrapping="Wrap"></TextBlock>
|
||||
<Border>
|
||||
<TextBlock Grid.Row="0" Text="{x:Bind Title, Mode=OneTime}" FontSize="24" FontFamily="{StaticResource PoppinsSemiBold}" TextWrapping="Wrap"></TextBlock>
|
||||
</Border>
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{x:Bind Genres, Mode=OneTime}" ItemTemplate="{StaticResource GenreTemplate}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
@@ -65,7 +67,7 @@
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
</UserControl.Resources>
|
||||
</Page.Resources>
|
||||
<Grid Padding="0" RowSpacing="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
@@ -90,4 +92,4 @@
|
||||
</ScrollViewer>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</Page>
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MangaReader.WinUI.Views;
|
||||
|
||||
public sealed partial class SearchView : UserControl
|
||||
public sealed partial class SearchView : Page
|
||||
{
|
||||
private readonly SearchViewModel viewModel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user