Esempio n. 1
0
        private void btnRemoteRecycleBin_Click(object sender, EventArgs e)
        {
            List <BaiduPCSUtil.BaiduFileInfo> lst_bdfi = new List <BaiduPCSUtil.BaiduFileInfo>();

            m_baidu.ListRecycleBin(ref lst_bdfi);

            gbRemote.Enabled = false;

            lvwRemote.BeginUpdate();
            lvwRemote.Items.Clear();

            int dir_num = 0, file_num = 0;

            foreach (BaiduPCSUtil.BaiduFileInfo bdfi in lst_bdfi)
            {
                ListViewItem lvi = new ListViewItem(bdfi.m_server_filename);
                lvi.Tag = bdfi;

                if (1 == bdfi.m_is_dir)
                {
                    dir_num++;
                    lvi.ImageKey = "Folder";
                    lvi.SubItems.Add("");
                    lvi.SubItems.Add(BaiduPCSUtil.FromUnixtime(bdfi.m_server_ctime));
                    lvi.SubItems.Add("");
                }
                else
                {
                    file_num++;
                    lvi.ImageKey = "File";
                    lvi.SubItems.Add(FormatCapability(bdfi.m_size));
                    lvi.SubItems.Add(BaiduPCSUtil.FromUnixtime(bdfi.m_server_ctime));
                    lvi.SubItems.Add(bdfi.m_md5);
                }

                lvwRemote.Items.Add(lvi);
            }

            lvwRemote.EndUpdate();
            gbRemote.Enabled = true;

            m_is_recycle_bin            = true;
            lvwRemote.LabelEdit         = false;
            btnRemoteRefresh.Checked    = false;
            btnRemoteRecycleBin.Checked = true;

            btnRemoteRename.Enabled  = false;
            btnRemoteMkdir.Enabled   = false;
            btnRemoteRestore.Enabled = true;
            btnRemoteClear.Enabled   = true;
            btnDownload.Enabled      = false;

            lblStatus.Text = "所有操作已完成";
            OnNewLog("回收站内共计 " + dir_num + " 个文件夹," + file_num + " 个文件!");
        }
Esempio n. 2
0
        public frmMain()
        {
            InitializeComponent();

            CheckForIllegalCrossThreadCalls = false;

            pbStatus.ControlAlign = ContentAlignment.MiddleRight;

            m_baidu = new BaiduPCSUtil();
            m_baidu.InitLogin();
            m_baidu.OnNewLog         += new BaiduPCSUtil.OnNewLogDelegate(OnNewLog);
            m_baidu.OnReportProgress += new BaiduPCSUtil.OnReportProgressDelegate(OnReportProgress);
        }