X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FGUI.fs;fp=Parasitemia%2FParasitemiaUI%2FGUI.fs;h=0832a41985e18ae1563368303343597b32f65b5c;hp=3b6789408efed6c67719a6580a1f5025f94f6303;hb=24bfd2ea10b5945100168ad5a1b2545e43d05569;hpb=c3370c187e36ca3c73cf3600f19783f958097e29 diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 3b67894..0832a41 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -18,6 +18,7 @@ open Types let run (defaultConfig : Config) (fileToOpen : string option) = let app = new Application () let win = MainWindow () + win.Title <- Constants.APPLICATION_NAME let state = State.State defaultConfig let mutable currentScale = 1. @@ -401,6 +402,9 @@ let run (defaultConfig : Config) (fileToOpen : string option) = updateDocumentStatus () let loadFile (filepath : string) = + let displayLoadingErrorMessage (message : string) = + MessageBox.Show (sprintf "The document cannot be loaded from \"%s\": %s" filepath message, "Error loading the document", MessageBoxButton.OK, MessageBoxImage.Error) |> ignore + askSaveCurrent () let previousFilePath = state.FilePath try @@ -408,10 +412,14 @@ let run (defaultConfig : Config) (fileToOpen : string option) = state.Load () updateGUI () with + | PiaZ.VersionFileNewerException fileVersion -> + state.FilePath <- previousFilePath + displayLoadingErrorMessage $"File version ({fileVersion}) is newer than supported one ({PiaZ.CURRENT_FILE_VERSION}), you may update Parasitemia to the latest version" + | :? IOException as ex -> Log.Error "%O" ex state.FilePath <- previousFilePath - MessageBox.Show (sprintf "The document cannot be loaded from \"%s\"" filepath, "Error loading the document", MessageBoxButton.OK, MessageBoxImage.Error) |> ignore + displayLoadingErrorMessage "IO Error" let askLoadFile () = let dialog = OpenFileDialog (Filter = PiaZ.filter) @@ -443,7 +451,7 @@ let run (defaultConfig : Config) (fileToOpen : string option) = MessageBox.Show (sprintf "The results cannot be exported in \"%s\"" state.FilePath, "Error exporting the files", MessageBoxButton.OK, MessageBoxImage.Error) |> ignore let importImage () = - let dialog = OpenFileDialog (Filter = "Image Files|*.png;*.jpg;*.tif;*.tiff", Multiselect = true) + let dialog = OpenFileDialog (Filter = "Image Files|*.png;*.jpg;.jpeg;.bmp;*.tif;*.tiff", Multiselect = true) let res = dialog.ShowDialog () if res.HasValue && res.Value then let noSourceImage = state.SourceImages.Count () = 0