| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- 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;
- //}
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (_done)
- {
- this.Close();
- }
- else
- {
- _eeep?.CancelExport();
- }
- }
- catch
- {
- }
- }
- /// <summary>
- /// 打开目录
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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
- {
- }
- }
- /// <summary>
- /// 打开文件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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;
- }
- }
- }
|