Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 5178619

Browse files
authored
Merge pull request #435 from hrntsm/feature/improve-dashboard-csv-load
Add warning dialog for mismatched CSV file names in output view model
2 parents c887730 + 4100d09 commit 5178619

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Tunny/Eto/Message/TunnyMessageBox_warn.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,18 @@ internal static void Warn_PreferentialGpSupportRange()
3838
MessageBoxType.Warning
3939
);
4040
}
41+
42+
internal static DialogResult Warn_ResultFileNameNotMatch()
43+
{
44+
TLog.MethodStart();
45+
return Show(
46+
"The selected csv file name does not match the target StudyName.\n" +
47+
"Rhino may crash if results from a different Study are loaded.\n\n" +
48+
"Do you want to continue loading?",
49+
"Tunny",
50+
MessageBoxButtons.YesNo,
51+
MessageBoxType.Warning
52+
);
53+
}
4154
}
4255
}

Tunny/WPF/ViewModels/Output/OutputViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ private void LoadCsv(CsvType type)
149149
if (result == true)
150150
{
151151
var reader = new CsvReader(dialog.FileName);
152+
if (dialog.SafeFileName != _selectedStudyName.Name + ".csv" &&
153+
TunnyMessageBox.Warn_ResultFileNameNotMatch() == global::Eto.Forms.DialogResult.No)
154+
{
155+
return;
156+
}
152157
int[] indices = reader.ReadSelectionCsv(type);
153158
foreach (int index in indices)
154159
{

0 commit comments

Comments
 (0)