/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpload_Click(object sender, EventArgs e) { try { FileUploadItems items = new FileUploadItems(); this.listView.BeginUpdate(); foreach (ListViewItem lvi in this.listView.Items) { if (lvi.Checked && (lvi.Tag is FileUploadItem)) { items.Add((FileUploadItem)lvi.Tag); } } this.listView.EndUpdate(); if (items.Count == 0) { this.OnMessageEvent(MessageType.Normal | MessageType.PopupInfo, "请勾选需要上传的作品附件!"); return; } this.ShowUploadWindowDialog(items); } catch (Exception x) { this.OnMessageEvent(MessageType.Normal | MessageType.PopupWarn, "发生异常:" + x.Message); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UCCaptureScreenSet_DoubleClick(object sender, EventArgs e) { try { this.Enabled = !(this.bShowWin = true); this.csw = new CaptureScreenWindow(); FileUploadItems items = null; this.csw.CopyScreenCutEvent += new CaptureScreenHandler(delegate(Image data) { if (data != null) { string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); Catalog c = this.CoreService["catalog"] as Catalog; if (c != null) { path += string.Format("\\{0}_截屏_{1:HHmmss}.jpg", c.CatalogName, DateTime.Now); } else { path += string.Format("\\截屏_{0:HHmmss}.jpg", DateTime.Now); } data.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg); if (System.IO.File.Exists(path)) { items = new FileUploadItems(); string strFileName = System.IO.Path.GetFileName(path); string strExt = System.IO.Path.GetExtension(path); items.Add(new FileUploadItem(strFileName, strExt, path)); } } }); this.csw.CopyScreenWindowClosed += new EventHandler(delegate(object o, EventArgs x) { ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object obj) { Thread.Sleep(100); this.ThreadSafeMethod(new MethodInvoker(delegate() { this.AddUploadWindow(items); })); })); }); this.csw.ShowDialog(this); } catch (Exception x) { Program.GlobalExceptionHandler(x); this.OnMessageEvent(MessageType.PopupWarn, "截图异常:" + x.Message); } finally { this.Enabled = !(this.bShowWin = false); } }