none
어떻게 접근할수 있을까요 ㅠㅠ RRS feed

  • 질문

  • Update UpdateFile = new Update(new Uri("https://www.dropbox.com/s/d4oiwfvvseuprc2/Update.xml?dl=1"));
            ArrayList File = new ArrayList();
            ArrayList ver = new ArrayList();
            ArrayList link = new ArrayList();
            //List<ProgressBar> pro = new List<ProgressBar>();
            ProgressBar pb;
            int m_index;
            string m_path;

            private void Form1_Load(object sender, EventArgs e)
            {
                //MessageBox.Show(UpdateFile.FileVersion);
                File = UpdateFile.FileNameLoad();
                ver = UpdateFile.FileVerLoad();
                link = UpdateFile.FileLinkLoad();
                FileDownload();
            }

            private void FileDownload()
            {
                    ListAdd();
                    WebClient wc = new WebClient();
                    wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownProgress);
                    wc.DownloadFileCompleted += new AsyncCompletedEventHandler(wc_DownCompleted);
                    wc.DownloadFileAsync(new Uri(link[m_index].ToString()), Application.StartupPath + File[m_index].ToString());
            }

            private void wc_DownProgress(object sender, DownloadProgressChangedEventArgs e)
            {       
                pb.Maximum = (int)e.TotalBytesToReceive;
                pb.Value = (int)e.BytesReceived;
            }

            private void wc_DownCompleted(object sender, AsyncCompletedEventArgs e)
            {
                //listView1.Items[m_index].SubItems[2].Text = "다운로드 완료";
            }

            private void ListAdd() 리스트뷰에 프로그래스바 추가
            {
                pb = new ProgressBar();
                //pro.Add(pb);
                listView1.Items.Add(File[m_index].ToString());
                listView1.Items[m_index].SubItems.Add(ver[m_index].ToString());
                listView1.Items[m_index].SubItems.Add("0%");
                listView1.Items[m_index].SubItems.Add(new ListViewItem.ListViewSubItem());
                pb.Parent = listView1;
                pb.Location = listView1.Items[m_index].SubItems[2].Bounds.Location;
                pb.Size = listView1.Items[m_index].SubItems[2].Bounds.Size;
            }

    이렇게 해서 리스트뷰에 프로그래스바를 칼럼쪽에 추가를 하고있는데요..

    하나씩 추가해서 다운로드를 하는건대 어떻게 해서 WebClient 진행률이랑 프로그래스바를 접근을 어떻게 해야할지 모르겠습니다.

    어떻게 해야할까요 ㅠㅠ

    2015년 10월 20일 화요일 오전 10:17

답변