|
|
@ -197,6 +197,9 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
SaveTestResult(SaveStatus.AutoSave); |
|
|
|
SaveTestResult(SaveStatus.AutoSave); |
|
|
|
SaveToCsv(); |
|
|
|
SaveToCsv(); |
|
|
|
|
|
|
|
}catch(IOException) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -955,8 +958,8 @@ public class GradingResultVM : BaseViewModel |
|
|
|
[Log] |
|
|
|
[Log] |
|
|
|
private async void ExportFile(string filePath) |
|
|
|
private async void ExportFile(string filePath) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try { |
|
|
|
|
|
|
|
ExportDialog exportDialog = new ExportDialog(); |
|
|
|
ExportDialog exportDialog = new ExportDialog(); |
|
|
|
|
|
|
|
try { |
|
|
|
var tcs = new TaskCompletionSource<bool>(); |
|
|
|
var tcs = new TaskCompletionSource<bool>(); |
|
|
|
var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => { |
|
|
|
var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => { |
|
|
|
exportDialog.Closed += (s, e) => tcs.SetResult(true); |
|
|
|
exportDialog.Closed += (s, e) => tcs.SetResult(true); |
|
|
@ -1010,13 +1013,21 @@ public class GradingResultVM : BaseViewModel |
|
|
|
// }); |
|
|
|
// }); |
|
|
|
}); |
|
|
|
}); |
|
|
|
await Task.Delay(500); |
|
|
|
await Task.Delay(500); |
|
|
|
exportDialog.Close(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (IOException ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("FileOpened")}:{ex.Message}"); |
|
|
|
} |
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
|
catch(Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
finally |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
exportDialog.Close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
[Log] |
|
|
|
[Log] |
|
|
|
private bool FileSaveEnabled(string Key) |
|
|
|
private bool FileSaveEnabled(string Key) |
|
|
@ -1118,9 +1129,9 @@ public class GradingResultVM : BaseViewModel |
|
|
|
[Log] |
|
|
|
[Log] |
|
|
|
private void ExcelFile(string filePath) |
|
|
|
private void ExcelFile(string filePath) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
string fileName = filePath + ".xlsx"; |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
string fileName = filePath + ".xlsx"; |
|
|
|
|
|
|
|
IWorkbook workbook = new XSSFWorkbook(); |
|
|
|
IWorkbook workbook = new XSSFWorkbook(); |
|
|
|
ISheet sheet = workbook.CreateSheet("Sheet1"); |
|
|
|
ISheet sheet = workbook.CreateSheet("Sheet1"); |
|
|
|
|
|
|
|
|
|
|
@ -1174,10 +1185,14 @@ public class GradingResultVM : BaseViewModel |
|
|
|
workbook.Write(stream); |
|
|
|
workbook.Write(stream); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (IOException) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw new IOException($"{fileName}"); |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|