呈現IsolatedStorage中的多媒體資
来源:互联网 发布:音频剪辑合成软件 mac 编辑:程序博客网 时间:2024/04/27 22:30
熟悉WP7程序设计的开发人员大概都知道,IsolatedStorage是我们在WP7程序设计中存放数据的储存区,也是目前开发WP7唯一可以存放数据的位置。而数据存入IsolatedStorage中总是要读取出来,但是不同类型的数据,在读取时也有所不同。
举例来说,同样存放于IsolatedStorage中的图档、影音档,在不同的情况下使用的方式也不同。若是以图文件来说,要透过Image控件显示某个存放于IsolatedStorage中的图档,其程序代码如下:
System.IO.IsolatedStorage.IsolatedStorageFile iso = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();//開檔var fs1 = iso.OpenFile("Pic1.jpg", System.IO.FileMode.Open);//顯示jpgSystem.Windows.Media.Imaging.BitmapImage BitmapImage1= new System.Windows.Media.Imaging.BitmapImage();BitmapImage1.SetSource(fs1);image1.Source = BitmapImage1;
如果是多媒体档案,因为是透过MediaElement来显示,所以程序代码就变成底下这样:
System.IO.IsolatedStorage.IsolatedStorageFile iso = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();//開檔var fs2 = iso.OpenFile("Nokia Lumia 800.mp4", System.IO.FileMode.Open);//顯示mp4mediaElement1.SetSource(fs2);
如果是使用MediaPlayerLauncher,用系统内建的拨放器来拨放位于IsolatedStorage中的影片呢? 程序代码又变成底下这样:
Microsoft.Phone.Tasks.MediaPlayerLauncher mp = new Microsoft.Phone.Tasks.MediaPlayerLauncher();//撥放isolatedStorage中的影片mp.Media = new Uri("Nokia Lumia 800.mp4", UriKind.Relative);mp.Show();
很有趣,还是很讨厌? 由于使用的拨放方式不同,处理的媒体类型不同,使用的程序代码也有所不同。
在WP7当中,原则上,谈到了uri,绝对位置Always是指向http远程的,问题不大,但是如果是近端(Relative, 指向手机上),则有许多不同的位置需要存取,Content(项目中的Content)、IsolatedStorage、Embedded Resource...etc, 不同的位置存取的方式也不同...
本周五,在微软的研讨会,我们先从WP7的远程与近端数据存取、DataBinding谈起,3月另一场研讨会,我们会继续来讨论这些多媒体数据存取的问题...
- 呈現IsolatedStorage中的多媒體資
- Using IsolatedStorage in Silverlight3
- 独立文件系统(IsolatedStorage)
- IsolatedStorage文件读写
- windows phone7 IsolatedStorage
- Silverlight中FullScreen和IsolatedStorage
- WP7 IsolatedStorage--读取、保存二进制文件
- WP7 IsolatedStorage--通过XmlSerializer读写XML文件
- WP7 IsolatedStorage--通过XmlWriter读写XML文件
- WP7 IsolatedStorage--读取、保存图片文件
- WP7 IsolatedStorage--读取、保存图片文件
- 涨姿势UWP源码——IsolatedStorage
- WP7录音-IsolatedStorage保存wav文件-IsolatedStorage上传wav录音文件(完整版)
- WP7--IsolatedStorage类初识获取存储的所有文件和文件夹
- <WP7>(六)手把手教你写天气预报程序:使用Isolatedstorage保存设置
- window phone7.1 天气预报教程(三)xml读取数据与Isolatedstorage存储数据
- 中的句子
- 偿中的
- 关于C语言中的函数scanf函数
- 如何建立长方形的Application Tile动态砖
- 精心整理的C语言面试题目
- Android ApiDemo分析(八)
- HDOJ FATE 二维DP
- 呈現IsolatedStorage中的多媒體資
- java中传值与传地址
- const初始化
- Android ApiDemo分析(九)--Graphics
- Struts2总结
- 树状数组-模板
- 怎样在Android中解析doc、docx、xls、xlsx格式文件?
- Windows Phone 7应用程序开发(二)Hello Windows Phone(5)
- PHP内核研究: PHP源码目录分析