示例#1
0
 private void FilelistView_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (FilelistView.SelectedIndices.Count <= 0)
     {
         return;
     }
     if (Fileinfo.ContainsKey(FilelistView.SelectedItems[0].Text))
     {
         DiskFileInfo info = Fileinfo[FilelistView.SelectedItems[0].Text];
         if (info.isdir == 1)
         {
             Path += "/" + FilelistView.SelectedItems[0].Text;
             new Thread(this.updateFileList).Start(HomePath + Path);
             return;
         }
         if (info.getSuffix() == "mp4" || info.getSuffix() == "mkv")
         {
             new Video
             {
                 info = info
             }.Show();
             return;
         }
         new AddDownload(this, info).ShowDialog();
     }
 }
示例#2
0
 void updateFileList(object path)
 {
     try
     {
         Path_Lab.Text = "当前路径:" + path.ToString().Replace("apps", "我的应用数据");
         var jobj = JObject.Parse(WebTool.GetHtml($"https://pcs.baidu.com/rest/2.0/pcs/file?method=list&access_token={Program.config.Access_Token}&path=" + Uri.EscapeDataString($"{path.ToString()}")));
         FilelistView.BeginUpdate();
         FilelistView.Items.Clear();
         Fileinfo.Clear();
         foreach (JObject job in jobj["list"])
         {
             DiskFileInfo fileinfo = JsonConvert.DeserializeObject <DiskFileInfo>(job.ToString());
             FilelistView.Items.Add(fileinfo.getName());
             this.Fileinfo.Add(fileinfo.getName(), fileinfo);
             if (fileinfo.isdir == 1)
             {
                 setEndItemImageKey("Dir.png");
             }
             else
             {
                 setEndItemImageKey(getIconImage(fileinfo.getSuffix()));
             }
         }
         FilelistView.EndUpdate();
     }
     catch (Exception ex)
     {
         MessageBox.Show("更新文件列表时遇到意外的错误: " + ex.ToString());
     }
     Info_Lab.Text = "等待中...";
 }