简体   繁体   English

在MVVM模式中为Windows Phone 8.1使用playbackagent

[英]using playbackagent for windows phone 8.1 in MVVM Pattern

I'm trying to play audio in background, I have made a project using MVVM light Desing pattern. 我正在尝试在后台播放音频,我已经使用MVVM灯光设计模式制作了一个项目。
After some research I found this sample that helped to implement playbackagent in windows phone 8.1! 经过一番研究后,我发现该示例有助于在Windows Phone 8.1中实现播放代理!
My goal is to implement the Agent in my solution with MVVM Pattern. 我的目标是在我的解决方案中使用MVVM模式实现代理。
Could someone help me with that? 有人可以帮我吗?

I can provide some general rules: 我可以提供一些一般规则:

  • Put business logic / condictional code into the ViewModel. 将业务逻辑/条件代码放入ViewModel。
  • Your View (.xaml.cs) files should only have minimum and necessary code for UI 您的View(.xaml.cs)文件应仅具有用于UI的最少且必要的代码
  • Use the service locator to always have one instance of the music player (which can be warped inside a controller). 使用服务定位器始终拥有一个音乐播放器实例(可以在控制器内部进行扭曲)。
  • Use Messenger service to send data / notify the player from difference view models 使用Messenger服务发送数据/通过差异视图模型通知玩家

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM