1.因为觉得原来的button巨丑,所以换成了ApplicationBar来实现控制。见图:
是不是漂亮多了 哈哈。 ApplicationBar中的ApplicationBarIconButton 有点特别。 这样使用
<phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar x:Name="AppBar" IsVisible="True" IsMenuEnabled="False"> <shell:ApplicationBarIconButton x:Name="btn_f" IconUri="/ICON/appbar.favs.rest.png" Text="最爱" /> <shell:ApplicationBarIconButton x:Name="btn_p" IconUri="/ICON/appbar.transport.play.rest.png" Text="播放" Click="btn_p_Click" /> <shell:ApplicationBarIconButton x:Name="btn_n" IconUri="/ICON/appbar.transport.ff.rest.png" Text="下一首" Click="btn_n_Click" /> </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
虽然在给BUTTON定义了Name,但是在cs中得到的却是NULL,一定要在构造方法中用Index获取一下。
btn_f = this.ApplicationBar.Buttons[0] as ApplicationBarIconButton;
btn_p = this.ApplicationBar.Buttons[1] as ApplicationBarIconButton;
btn_n = this.ApplicationBar.Buttons[2] as ApplicationBarIconButton;
2.因为MediaElement有个莫名其妙的问题,某个歌曲加载失败的时候会触发一个ERROR:2210 AG_E_INVALID_ARGUMENT 。这个错误发生后MediaElement再也不能播放了,状态一直是closed,Google了好久还是无解。于是只能替换XNA中的MediaPlayer类来播放歌曲了。MediaPlayer使用更简单,就那么几个静态方法,我就不多说。 本来想实现收藏功能的,由于下午再纠结MVC,未果。
QQ群:1022985150
作者:Agile.Zhou
本文版权归作者 欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。