using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace Dongke.IBOSS.PRD.Basics.BaseControls.ExportExcel
{
public partial class ExportExcelProgress : Form
{
public ExportExcel_EPPlus _eeep = null;
private bool _done = false;
public ExportExcelProgress()
{
InitializeComponent();
}
public Label StatusLabel
{
get
{
return this.label1;
}
//set
//{
// this.label1 = value;
//}
}
public ProgressBar StatusBar
{
get
{
return this.progressBar1;
}
//set
//{
// this.label1 = value;
//}
}
///
/// 取消
///
///
///
private void button1_Click(object sender, EventArgs e)
{
try
{
if (_done)
{
this.Close();
}
else
{
_eeep?.CancelExport();
}
}
catch
{
}
}
///
/// 打开目录
///
///
///
private void button2_Click(object sender, EventArgs e)
{
try
{
if (_eeep != null)
{
string f = _eeep._exportParams.FilePath;
string d = Path.GetDirectoryName(f);
if (Directory.Exists(d))
{
Process.Start(d);
return;
}
}
}
catch
{
}
}
///
/// 打开文件
///
///
///
private void button3_Click(object sender, EventArgs e)
{
try
{
if (_eeep != null)
{
string f = _eeep._exportParams.FilePath;
if (File.Exists(f))
{
Process.Start(f);
return;
}
}
}
catch
{
}
}
public void Done()
{
_done = true;
button1.Enabled = true;
button1.Text = "关闭";
button2.Enabled = true;
button3.Enabled = true;
}
private void ExportExcelProgress_FormClosing(object sender, FormClosingEventArgs e)
{
if (!_done)
{
e.Cancel = true;
return;
}
_eeep?.Dispose();
_eeep = null;
}
}
}