lu
2024-11-11 afb82d4d75ae1b58385c168ba85ba44c00fc980c
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
@@ -6,8 +6,10 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Net;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm
@@ -639,5 +641,43 @@
            
            }
        }
        private void repositoryItemButtonEdit3_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var rowhandle = gvMx3.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            if (e.Button.Index == 0)
            {
                try
                {
                    var dr = gvMx3.GetDataRow(rowhandle);
                    var urlPath = dr["urlPath"].ToString();
                    using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
                    {
                        folderBrowserDialog.Description = "选择导出文件的保存路径";
                        DialogResult dialogResult = folderBrowserDialog.ShowDialog();
                        if (dialogResult == DialogResult.OK)
                        {
                            string _folder = folderBrowserDialog.SelectedPath;
                            string _folderName = _folder + "\\" + urlPath;
                            string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + "upload/" + urlPath;
                            using (WebClient client = new WebClient())
                            {
                                client.DownloadFile(_url, _folderName);
                            }
                            ToolBox.MsgHelper.ShowInformation("下载成功!");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message);
                }
            }
        }
    }
}