Exemplo n.º 1
0
        private void btnFetchFromPhone_Click(object sender, EventArgs e)
        {
            if (dgvCards.SelectedRows == null) return;
            if (dgvCards.SelectedRows.Count == 0) return;
            this.FetchList.Clear();
            this.FetchListIndex = 0;

            List<string> phone_card_paths = new List<string>();
            List<string> pc_card_paths = new List<string>();

            string phone_card_path = "";
            string pc_card_path = "";
            for (int i = 0; i < dgvCards.SelectedRows.Count; i++)
            {
                phone_card_path = (string)dgvCards.SelectedRows[i].Cells[clmnCardPathPhone.Index].Value;
                if (phone_card_path != null) phone_card_paths.Add(phone_card_path);

                pc_card_path = (string)dgvCards.SelectedRows[i].Cells[clmnCardPathPc.Index].Value;
                if (pc_card_path != null) pc_card_paths.Add(pc_card_path);


            }

            foreach (string card in pc_card_paths)
            {
                if (Globals.DeleteDirectory(card) == false)
                {
                    rtxtLog.AppendText(string.Format("Unable to remove directory '{0}'\r\n", card));
                }
            }


            foreach (string card in phone_card_paths)
            {
                string rel_path = Globals.GetRelPath(card);
                string[] files = com.GetListOfAllFiles(rel_path);
                this.FetchList.AddRange(files);
            }
            if (this.FetchList.Count == 0) return;
            com.FetchFile(this.FetchList[0]);
        }