Skip to content

Commit

Permalink
add reimport button
Browse files Browse the repository at this point in the history
  • Loading branch information
neil3d committed Jan 16, 2018
1 parent b9ed84a commit f5fed2c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions GUI/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace excel2json.GUI {
public partial class MainForm : Form {
// Excel导入数据管理
private DataManager mDataMgr;
private string mCurrentXlsx;

// 支持语法高亮的文本框
private FastColoredTextBox mJsonTextBox;
Expand Down Expand Up @@ -68,6 +69,7 @@ public MainForm() {

//-- data manager
mDataMgr = new DataManager();
this.btnReimport.Enabled = false;
}

/// <summary>
Expand Down Expand Up @@ -110,10 +112,17 @@ private void jsonTextChanged(object sender, TextChangedEventArgs e) {
/// </summary>
/// <param name="path">Excel文件路径</param>
private void loadExcelAsync(string path) {

mCurrentXlsx = path;

//-- update ui
this.btnReimport.Enabled = true;
this.labelExcelFile.Text = path;
enableExportButtons(false);

this.statusLabel.IsLink = false;
this.statusLabel.Text = "Loading Excel ...";

//-- load options from ui
Program.Options options = new Program.Options();
options.ExcelPath = path;
Expand Down Expand Up @@ -289,5 +298,14 @@ private void showStatus(string szMessage, Color color) {
this.statusLabel.ForeColor = color;
this.statusLabel.IsLink = false;
}

/// <summary>
/// 配置项变更之后,手动重新导入xlsx文件
/// </summary>
private void btnReimport_Click(object sender, EventArgs e) {
if (!string.IsNullOrEmpty(mCurrentXlsx)) {
loadExcelAsync(mCurrentXlsx);
}
}
}
}

0 comments on commit f5fed2c

Please sign in to comment.