Quellcode durchsuchen

Fixed duplicate code exception in DF dashboard

Kenric Nugteren vor 2 Jahren
Ursprung
Commit
d4c2003f4c
1 geänderte Dateien mit 8 neuen und 1 gelöschten Zeilen
  1. 8 1
      prs.desktop/Dashboards/DigitalFormsDashboard.xaml.cs

+ 8 - 1
prs.desktop/Dashboards/DigitalFormsDashboard.xaml.cs

@@ -947,7 +947,14 @@ namespace PRSDesktop
                 {
                     var code = variable.Code.Replace("/", " ");
                     QuestionCodes[code] = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(code.ToLower());
-                    data.Columns.Add(code, typeof(string));
+                    try
+                    {
+                        data.Columns.Add(code, typeof(string));
+                    }
+                    catch(DuplicateNameException e)
+                    {
+                        MessageBox.Show($"Error: duplicate variable code {code}");
+                    }
                 }
             }
             else if (questions.Any())