Background Task (background Task) file transfer (upload and download)
Introduced
Unique Windows Phone 7.5 (SDK 7.1) after the task
Background File transfer (download)
Background File transfer (upload)
Example
1, demo How to implement the background file transfer (download)
Backgroundtransferdownload.xaml
<phone:phoneapplicationpage x:class= "Demo.BackgroundTask.BackgroundTransferDownload" xmlns= "http://schemas.m Icrosoft.com/winfx/2006/xaml/presentation "xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "xmlns:phone=" Clr-namespace:microsoft.phone.controls;assembly=microsoft.phone "Xmlns:shell=" Clr-namespace:
Microsoft.phone.shell;assembly=microsoft.phone "xmlns:d=" http://schemas.microsoft.com/expression/blend/2008 " Xmlns:mc= "http://schemas.openxmlformats.org/markup-compatibility/2006" fontfamily= "{StaticResource Phonefontfamilynormal} "fontsize=" {StaticResource phonefontsizenormal} "foreground=" {StaticResource PhoneForegroun Dbrush} "supportedorientations=" Portrait "orientation=" Portrait "mc:ignorable=" D "d:designheight=" 768 "D:DesignWid
Th= "shell:systemtray.isvisible=" "True" > <grid x:name= "layoutroot" background= "Transparent" > <stackpanel orientation= "Vertical" > &Lt Button X:name= "Btndownloadsilverlightdemo" content= "Download Silverlight Demo compression package" click= "Btndownloadsilverlightdemo_click "/> <button x:name=" Btndownloadxnademo "content=" Download XNA Demo compression package "click= Btndownloadxnademo_click"/&G
T <button x:name= "Btndownloadwindowsphonedemo" content= download WindowsPhone Demo compression package "click="
Btndownloadwindowsphonedemo_click "/> <textblock text=" Download Task List: "margin=" 0 0 0 "/>
<listbox name= "ListBox" > <ListBox.ItemTemplate> <DataTemplate>
<grid margin= "0" width= "> <Grid.ColumnDefinitions>" <columndefinition width= "8*"/> <columndefiniti
On width= "2*"/> </Grid.ColumnDefinitions>
<Grid> <stackpanel orientation= "Vertical" > <stackpanel Orient
ation= "Horizontal" > <textblock text= "filename:"/>
<textblock text= "{Binding Tag}"/> </StackPanel> <stackpanel orientation= "Horizontal" > <textbl
Ock text= "Download status:"/> <textblock text= "{Binding transferstatus}"/> </StackPanel> <stackpanel orientation= "Horizo
Ntal "> <textblock text=" bytes Received: "/>
<textblock text= "{Binding bytesreceived}"/> </StackPanel> <stackpanel orientation= "Horizontal" > <textblock text= "total bytes:"/>
<textblock text= "{Binding totalbytestoreceive}"/> </StackPanel> </StackPanel> &L T;/grid> <grid grid.column= "1" > <button x:name= "
Btncancel "tag=" {Binding RequestID} "click= Btncancel_click" content= "Delete Task" ></Button> </Grid> </Grid> </DataTemplate> </li stbox.itemtemplate> </ListBox> </StackPanel> </GRID&G
T </phone:PhoneApplicationPage>