Asp.net源码专业站
预留广告位
首页->上传下载->Silverlight多文件(大文件)上传项目源码>>mpost.SilverlightMultiFileUpload/FileRowControl.xaml.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Silverlight多文件(大文件)上传项目源码
当前文件:文件类型 SilverlightMultiFileUploader/mpost.SilverlightMultiFileUpload/FileRowControl.xaml.cs[3K,2009-6-12 11:53:52]打开代码结构图
普通视图
		            
1using System; 2using System.Collections.Generic; 3using System.Linq; 4using System.Net; 5using System.Windows; 6using System.Windows.Controls; 7using System.Windows.Documents; 8using System.Windows.Input; 9using System.Windows.Media; 10using System.Windows.Media.Animation; 11using System.Windows.Shapes; 12using mpost.SilverlightMultiFileUpload.Classes; 13 14/* 15 * Copyright Michiel Post 16 * http://www.michielpost.nl 17 * contact@michielpost.nl 18 * */ 19 20namespace mpost.SilverlightMultiFileUpload 21{ 22 public partial class FileRowControl : UserControl 23 { 24 25 private UserFile UserFile 26 { 27 get 28 { 29 if (this.DataContext != null) 30 return ((UserFile)this.DataContext); 31 else 32 return null; 33 34 } 35 } 36 37 public FileRowControl() 38 { 39 InitializeComponent(); 40 41 this.Loaded += new RoutedEventHandler(FileRowControl_Loaded); 42 } 43 44 45 void FileRowControl_Loaded(object sender, RoutedEventArgs e) 46 { 47 //定制UserFile的PropertyChanged 属性,如BytesUploaded,Percentage,IsDeleted 48 UserFile.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(FileRowControl_PropertyChanged); 49 50 } 51 52 void FileRowControl_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) 53 { 54 if (e.PropertyName == "State") 55 { 56 //当前文件上传完毕后显示灰字 57 if (this.UserFile.State == Constants.FileStates.Finished) 58 { 59 GreyOutText(); 60 ShowValidIcon(); 61 } 62 63 //如上传失败显示错误信息 64 if (this.UserFile.State == Constants.FileStates.Error) 65 { 66 ErrorMsgTextBlock.Visibility = Visibility.Visible; 67 } 68 } 69 70 } 71 72 private void ShowValidIcon() 73 { 74 PercentageProgress.Visibility = Visibility.Collapsed; 75 ValidUploadIcon.Visibility = Visibility.Visible; 76 } 77 78 private void GreyOutText() 79 { 80 SolidColorBrush grayBrush = new SolidColorBrush(Colors.Gray); 81 82 FileNameTextBlock.Foreground = grayBrush; 83 StateTextBlock.Foreground = grayBrush; 84 FileSizeTextBlock.Foreground = grayBrush; 85 } 86 87 88 private void TextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) 89 { 90 UserFile file = (UserFile)((TextBlock)e.OriginalSource).DataContext; 91 file.IsDeleted = true; 92 93 this.Visibility = Visibility.Collapsed; 94 } 95 96 private void Button_Click(object sender, RoutedEventArgs e) 97 { 98 UserFile file = (UserFile)((Button)e.OriginalSource).DataContext; 99 file.IsDeleted = true; 100 101 this.Visibility = Visibility.Collapsed; 102 } 103 104 105 } 106} 107
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Silverlight多文件(大文件)上传项目源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146