private void UpdateProgressBarMethod(object param) { UploadParam up = (UploadParam)param; ProgressBar pp = (ProgressBar)up.Bar; string packfile = up.PackPath; string serverpath = up.ServerPath + "/"; this.Upload1(packfile, serverpath, pp); }
private void llbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { LinkLabel l = (LinkLabel)sender; EXControlListViewSubItem subitem = l.Tag as EXControlListViewSubItem; ProgressBar p = subitem.MyControl as ProgressBar; ListViewItem item = (ListViewItem)p.Tag; string serverpath = item.SubItems[1].Text; if (!l.Text.Equals("上传") && !l.Text.Equals("重传")) { item.Tag = "false"; } else { item.Tag = "true"; if (string.IsNullOrEmpty(serverpath)) { System.DateTime today = System.DateTime.Now; string todaystr = today.ToString("yyyyMMdd"); DialogResult mr = MessageBox.Show("是否使用当前日期“" + todaystr + "“作为文件夹?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == mr) { item.SubItems[1].Text = todaystr; serverpath = todaystr; } else { return; } } Thread th = new Thread(new ParameterizedThreadStart(UpdateProgressBarMethod)); th.IsBackground = true; UploadParam up = new UploadParam(); up.PackPath = item.SubItems[6].Text; //@"D:\111.txt"; up.Bar = p; up.ServerPath = serverpath; th.Start(up); l.Text = "取消"; } }
private void llbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { LinkLabel l = (LinkLabel)sender; EXControlListViewSubItem subitem = l.Tag as EXControlListViewSubItem; ProgressBar p = subitem.MyControl as ProgressBar; ListViewItem item = (ListViewItem)p.Tag; string serverpath = item.SubItems[1].Text; if (string.IsNullOrEmpty(serverpath)) { SelectPath sp = new SelectPath(); sp.StartPosition = FormStartPosition.CenterParent; if (sp.ShowDialog() == DialogResult.OK) { serverpath = sp.selpath; item.SubItems[1].Text = serverpath; sp.Dispose(); } else { sp.Dispose(); return; } } if (l.Text == "正在上传") { return; } Thread th = new Thread(new ParameterizedThreadStart(UpdateProgressBarMethod)); th.IsBackground = true; UploadParam up = new UploadParam(); up.PackPath = @"D:\111.txt"; up.Bar = p; up.ServerPath = serverpath; th.Start(up); ((LinkLabel)sender).Text = "正在上传"; }