Browse Source

hotfix, added exception handling to isad import method call and added missing method comment to svg import ui method

Vincenz Mechler 5 years ago
parent
commit
b3e1f256e7
1 changed files with 22 additions and 8 deletions
  1. 22 8
      SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs

+ 22 - 8
SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs

@@ -97,18 +97,32 @@ namespace SketchAssistantWPF
                 if (!fileNameTup.Item1.Equals("") && !fileNameTup.Item2.Equals(""))
                 {
                     programView.SetToolStripLoadStatus(fileNameTup.Item2);
-                    Tuple<int, int, List<InternalLine>> values = fileImporter.ParseISADInputFile(fileNameTup.Item1);
-                    programModel.SetLeftLineList(values.Item1, values.Item2, values.Item3);
-
-                    programModel.ResetRightImage();
-                    programModel.CanvasActivated();
-                    programModel.ChangeState(true);
-                    programView.EnableTimer();
-                    ClearRightLines();
+                    try
+                    {
+                        Tuple<int, int, List<InternalLine>> values = fileImporter.ParseISADInputFile(fileNameTup.Item1);
+                        programModel.SetLeftLineList(values.Item1, values.Item2, values.Item3);
+
+                        programModel.ResetRightImage();
+                        programModel.CanvasActivated();
+                        programModel.ChangeState(true);
+                        programView.EnableTimer();
+                        ClearRightLines();
+                    }
+                    catch (FileImporterException ex)
+                    {
+                        programView.ShowInfoMessage(ex.ToString());
+                    }
+                    catch (Exception ex)
+                    {
+                        programView.ShowInfoMessage("exception occured while trying to load interactive sketch-assistant drawing file:\n\n" + ex.ToString() + "\n\n" + ex.StackTrace);
+                    }
                 }
             }
         }
 
+        /// <summary>
+        /// Display a new FileDialog to a svg drawing.
+        /// </summary>
         public void SVGToolStripMenuItemClick()
         {
             var okToContinue = true;