SVN-Revision: r790
This commit is contained in:
wyf
2025-06-26 09:49:25 +00:00
parent 22ff712f65
commit 7cb7cdeaf2
+15 -35
View File
@@ -66,7 +66,7 @@ namespace Lskj.Control
string localFilePath = null;//需要现在的文件名称
bool isOpen = false;//是否直接打开程序
bool isprompt = true;//是否提示
public FrmDownload(string URL, string FileName, string LocalFilePath, bool isOpen = false,bool isprompt = true)
public FrmDownload(string URL, string FileName, string LocalFilePath, bool isOpen = false, bool isprompt = true)
{
InitializeComponent();
this.url = URL;
@@ -91,7 +91,7 @@ namespace Lskj.Control
{
try
{
if (!isBatchPrind&& RightDisplay) this.Opacity = 100D;
if (!isBatchPrind && RightDisplay) this.Opacity = 100D;
evtDownload = new ManualResetEvent(true);
evtDownload.Reset();
ThreadPool.QueueUserWorkItem(new WaitCallback(this.ProcDownload));
@@ -217,7 +217,7 @@ namespace Lskj.Control
//DealWithDownloadErrors();
if (isFinished)
{
if (!isBatchPrind&& RightDisplay&& this.isprompt) MessageUtil.Show("附件下载成功!");
if (!isBatchPrind && RightDisplay && this.isprompt) MessageUtil.Show("附件下载成功!");
OpenDownFile();
Exit(true);
@@ -241,11 +241,17 @@ namespace Lskj.Control
/// <param name="FileName">Name of the file.</param>
private void OpenDownFile()
{
if (!isOpen) return;
string v_OpenFilePath = localFilePath;
//存在则打开
System.Diagnostics.Process.Start(v_OpenFilePath);
try
{
if (!isOpen) return;
string v_OpenFilePath = localFilePath;
//存在则打开
System.Diagnostics.Process.Start(v_OpenFilePath);
}
catch (Exception ex)
{
MessageUtil.Show($"打开附件失败\r\n{ex.Message}");
}
}
/// <summary>
/// 关闭触发事件删除webclient下载资源
@@ -340,30 +346,4 @@ namespace Lskj.Control
/// <para>说明:取消</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-02-23 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void OnCancel(object sender, EventArgs e)
{
try
{
if (!isFinished && DialogResult.Yes == MessageBox.Show("附件正在下载确定取消下载吗?", ConstModel.LS_TITLE_NAME, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
evtDownload.Set();
evtPerDonwload.Set();
Exit(false);
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show("附件下载取消出错!" + Message);
}
}
}
}
/// <par