//增加收取文件样式 public void AddRecvFile(string filename,long filesize) { ImageSource fileicon = GetFileImage(filename); Is_Send = true; //开始接收 sendfile file = new sendfile(); file.icon = fileicon; file.name = filename; file.filesize = filesize; file.size = FomatFileSize(filesize); if (filelist.Count != 0) { file.id = filelist[filelist.Count - 1].id + 1; } else { file.id = 0; } file.Button1_name = "接收文件"; file.Button2_name = "拒绝接收"; file.ShowButton1 = Visibility.Visible; file.ShowSpeed = Visibility.Hidden; file.Speed = "0kb/s"; file.Progress = 0; filelist.Add(file); File_List.ItemsSource = null; File_List.ItemsSource = filelist; //显示发送列表 SharedFile_List.Visibility = Visibility.Hidden; File_List.Visibility = Visibility.Visible; }
//增加发送文件样式 private void AddSendFile() { ImageSource fileicon = GetFileImage(SendFilePath); sendfile file = new sendfile(); file.icon = fileicon; file.name = SendFilePath.Substring(SendFilePath.LastIndexOf('\\') + 1); if (filelist.Count != 0) { file.id = filelist[filelist.Count - 1].id + 1; } else { file.id = 0; } file.filepath = SendFilePath; file.filesize = GetFileSize(SendFilePath); file.size = FomatFileSize(file.filesize); file.Button1_name = "接收文件"; file.Button2_name = "取消发送"; file.ShowButton1 = Visibility.Hidden; file.ShowSpeed = Visibility.Hidden; file.Speed = "0kb/s"; file.Progress = 0; filelist.Add(file); File_List.ItemsSource = null; File_List.ItemsSource = filelist; //显示发送列表 SharedFile_List.Visibility = Visibility.Hidden; File_List.Visibility = Visibility.Visible; }