ab56a9bcf7
SVN-Revision: r240
64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
using Lskj.Control;
|
|
using Lskj.Core;
|
|
using Lskj.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.BatchUpload
|
|
{
|
|
public partial class FrmMain : BaseForm
|
|
{
|
|
public DynamicPowerModel Model;
|
|
public FrmMain(string args)
|
|
{
|
|
DBConfig.Instance.ReadConfig();
|
|
DBConfig.Instance.CreateConnection();
|
|
//args = "上传测试,1,管理员,1,121212,1941";
|
|
if (!string.IsNullOrWhiteSpace(args))
|
|
{
|
|
string[] stringArray = args.Split(','); // 将字符串转换回数组
|
|
Model= new DynamicPowerModel(stringArray);
|
|
}
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
private void btnPreview_Click(object sender, EventArgs e)
|
|
{
|
|
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
|
|
folderBrowserDialog.Description = "请选择一个文件夹";
|
|
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
|
|
{
|
|
this.labAddress.EditText = folderBrowserDialog.SelectedPath;
|
|
}
|
|
}
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
string address = this.labAddress.EditText;
|
|
if (!string.IsNullOrEmpty(address) && Directory.Exists(address))
|
|
{
|
|
// 获取文件夹中的所有文件
|
|
string[] fileNames = Directory.GetFiles(address);
|
|
FrmProgress dp = new FrmProgress(fileNames.ToList());
|
|
dp.Model = Model;
|
|
if (dp.ShowDialog() == DialogResult.OK)
|
|
{
|
|
MessageUtil.Show("上传完成");
|
|
this.Close();
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("上传文件位置出错");
|
|
}
|
|
}
|
|
}
|
|
} |