-
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 20, 2024
1 parent
7b6f288
commit 77285fb
Showing
8 changed files
with
126 additions
and
12 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,10 @@ | ||
using Peach.Model.Models; | ||
|
||
namespace PeachPlayer.Services | ||
{ | ||
public interface IPlayerService | ||
{ | ||
void Play(SmallVodModel vod); | ||
|
||
} | ||
} |
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,45 @@ | ||
using PeachPlayer.ViewModels; | ||
using PeachPlayer.Views; | ||
using Peach.Model.Models; | ||
using Avalonia.Controls; | ||
|
||
namespace PeachPlayer.Services | ||
{ | ||
public class PlayerService : IPlayerService | ||
{ | ||
|
||
//初始化嗅探器 | ||
|
||
private static VideoPlayView videoPlayView; | ||
private static SmallVodModel vodModel; | ||
private static VideoPlayViewModel videoPlayViewModel; | ||
public PlayerService() | ||
{ | ||
videoPlayView = new VideoPlayView(); | ||
videoPlayView.Closing += (s, e) => | ||
{ | ||
videoPlayViewModel.Stop(); | ||
((Window)s).Hide(); | ||
e.Cancel = true; | ||
}; | ||
videoPlayViewModel = new VideoPlayViewModel(); | ||
videoPlayView.DataContext = videoPlayViewModel; | ||
} | ||
|
||
//播放 | ||
public void Play(SmallVodModel vod) | ||
{ | ||
videoPlayView.Show(); | ||
videoPlayView.Activate(); | ||
if (videoPlayView.WindowState == WindowState.Minimized) | ||
videoPlayView.WindowState = WindowState.Normal; | ||
|
||
if (vodModel != vod) | ||
videoPlayViewModel.Play(vod); | ||
|
||
vodModel = vod; | ||
} | ||
|
||
|
||
} | ||
} |
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,18 +1,47 @@ | ||
| ||
using Peach.Application.Interfaces; | ||
using Peach.Model.Models; | ||
using ReactiveUI; | ||
using Splat; | ||
|
||
|
||
namespace PeachPlayer.ViewModels | ||
{ | ||
public class VideoPlayViewModel : ViewModelBase | ||
{ | ||
public VideoPlayViewModel() { } | ||
public VideoPlayViewModel(SmallVodModel small) | ||
private VodModel vod=new VodModel(); | ||
public VodModel Vod | ||
{ | ||
get { return vod; } | ||
set { vod = value; this.RaiseAndSetIfChanged(ref vod, value); } | ||
} | ||
|
||
public string VodName => Vod?.vod_name; | ||
|
||
public string VodContent => Vod?.vod_content; | ||
|
||
public string Type_Remarks => Vod?.vod_remarks; | ||
|
||
private IVodInfoService infoService; | ||
public VideoPlayViewModel() | ||
{ | ||
infoService = Locator.Current.GetService<IVodInfoService>(); | ||
} | ||
|
||
public async void Play(SmallVodModel vod) | ||
{ | ||
Vod.vod_id = vod.vod_id; | ||
Vod.vod_name = vod.vod_name; | ||
Vod.vod_content = vod.vod_content; | ||
Vod.vod_pic = vod.vod_pic; | ||
Vod.vod_remarks = vod.vod_remarks; | ||
|
||
await infoService.DetailsAsync(vod.vod_id); | ||
} | ||
|
||
public void Stop() | ||
{ | ||
|
||
} | ||
|
||
} | ||
} |
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