-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
chenjz
authored and
chenjz
committed
May 14, 2024
1 parent
8f05113
commit aeffdf1
Showing
12 changed files
with
179 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using Avalonia; | ||
using Peach.Application.Interfaces; | ||
using Peach.Model.Models; | ||
using ReactiveUI; | ||
using Splat; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
|
||
namespace PeachPlayer.ViewModels | ||
{ | ||
public class ClassifyListViewModel : ViewModelBase | ||
{ | ||
private IVodInfoService vod; | ||
private readonly ClassModel Class; | ||
private readonly List<FilterModel> filters; | ||
private int PgIndex = 1; | ||
|
||
public string Type_Name => Class.Type_Name; | ||
|
||
private VideoViewModel selectedVod; | ||
public VideoViewModel SelectedVod | ||
{ | ||
get { return selectedVod; } | ||
set { this.RaiseAndSetIfChanged(ref selectedVod, value); } | ||
} | ||
public ObservableCollection<VideoViewModel> Videos { get; } = new(); | ||
|
||
private Vector offset; | ||
public Vector Offset | ||
{ | ||
get { return offset; } | ||
set { this.RaiseAndSetIfChanged(ref offset, value); Debug.WriteLine($"offset:{offset}"); } | ||
} | ||
|
||
private Size viewport; | ||
public Size Viewport | ||
{ | ||
get { return viewport; } | ||
set { this.RaiseAndSetIfChanged(ref viewport, value);Debug.WriteLine($"verticalViewport:{viewport}"); } | ||
} | ||
|
||
|
||
public ClassifyListViewModel(ClassModel _class, List<FilterModel> _filters = null) | ||
{ | ||
vod = Locator.Current.GetService<IVodInfoService>(); | ||
Class = _class; | ||
filters = _filters; | ||
} | ||
|
||
public async void LoadVodList() | ||
{ | ||
Videos.Clear(); | ||
var data = await vod?.ClassifyAsync(Class.Type_Id, PgIndex, "", ""); | ||
if (data?.List?.Count > 0) | ||
{ | ||
var vods = data.List.Select(x => new VideoViewModel(x)); | ||
foreach (var v in vods) | ||
{ | ||
Videos.Add(v); | ||
} | ||
} | ||
} | ||
|
||
public async void NextPage() | ||
{ | ||
PgIndex++; | ||
var data = await vod?.ClassifyAsync(Class.Type_Id, PgIndex, "", ""); | ||
if (data?.List?.Count > 0) | ||
{ | ||
var vods = data.List.Select(x => new VideoViewModel(x)); | ||
foreach (var v in vods) | ||
{ | ||
Videos.Add(v); | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
| ||
using Peach.Model.Models; | ||
|
||
namespace PeachPlayer.ViewModels | ||
{ | ||
internal class VideoViewModel : ViewModelBase | ||
public class VideoViewModel : ViewModelBase | ||
{ | ||
|
||
public VideoViewModel() | ||
{ | ||
|
||
} | ||
private readonly SmallVodModel Vod; | ||
|
||
|
||
private string typeId; | ||
|
||
public string TypeId | ||
public VideoViewModel(SmallVodModel vod) | ||
{ | ||
get { return typeId; } | ||
set { typeId = value; } | ||
Vod = vod; | ||
} | ||
|
||
public string Vid => Vod.vod_id; | ||
public string Vname => Vod.vod_name; | ||
public string VRemarks => Vod.vod_remarks; | ||
public string VPoc => Vod.vod_pic; | ||
public string VContent => Vod.vod_content; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<UserControl 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" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="PeachPlayer.Views.ClassifyListView" | ||
xmlns:vm="using:PeachPlayer.ViewModels" | ||
x:DataType="vm:ClassifyListViewModel"> | ||
|
||
<ListBox ItemsSource="{Binding Videos}" Background="Transparent" Margin="0 10"> | ||
<ListBox.ItemsPanel> | ||
<ItemsPanelTemplate> | ||
<WrapPanel HorizontalAlignment="Center" /> | ||
</ItemsPanelTemplate> | ||
</ListBox.ItemsPanel> | ||
</ListBox> | ||
|
||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace PeachPlayer.Views; | ||
|
||
public partial class ClassifyListView : UserControl | ||
{ | ||
public ClassifyListView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters