FIX #277
authorGreg Burri <greg.burri@gmail.com>
Sat, 21 Oct 2017 12:00:39 +0000 (14:00 +0200)
committerGreg Burri <greg.burri@gmail.com>
Sat, 21 Oct 2017 12:00:39 +0000 (14:00 +0200)
Add some information in the GUI to see the possible command arguments.

13 files changed:
Parasitemia/ParasitemiaCore/ParasitemiaCore.fsproj
Parasitemia/ParasitemiaCore/packages.config
Parasitemia/ParasitemiaUI/CommandLineArguments.fs [new file with mode: 0644]
Parasitemia/ParasitemiaUI/GUI.fs
Parasitemia/ParasitemiaUI/ParasitemiaUI.fsproj
Parasitemia/ParasitemiaUI/Program.fs
Parasitemia/ParasitemiaUI/Utils.fs
Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml [new file with mode: 0644]
Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml.fs [new file with mode: 0644]
Parasitemia/ParasitemiaUI/XAML/MainWindow.xaml
Parasitemia/ParasitemiaUI/packages.config
Parasitemia/Tests/ParasitemiaCore.Tests/ParasitemiaCore.Tests.fsproj
Parasitemia/Tests/ParasitemiaCore.Tests/packages.config

index c841f71..f6262e2 100644 (file)
       <Private>True</Private>
     </Reference>
     <Reference Include="FSharp.Core">
-      <HintPath>..\packages\FSharp.Core.4.2.1\lib\net45\FSharp.Core.dll</HintPath>
+      <HintPath>..\packages\FSharp.Core.4.2.3\lib\net45\FSharp.Core.dll</HintPath>
     </Reference>
     <Reference Include="MathNet.Numerics">
-      <HintPath>..\packages\MathNet.Numerics.3.19.0\lib\net40\MathNet.Numerics.dll</HintPath>
+      <HintPath>..\packages\MathNet.Numerics.3.20.0\lib\net40\MathNet.Numerics.dll</HintPath>
     </Reference>
     <Reference Include="MathNet.Numerics.FSharp">
-      <HintPath>..\packages\MathNet.Numerics.FSharp.3.19.0\lib\net40\MathNet.Numerics.FSharp.dll</HintPath>
+      <HintPath>..\packages\MathNet.Numerics.FSharp.3.20.0\lib\net40\MathNet.Numerics.FSharp.dll</HintPath>
     </Reference>
     <Reference Include="mscorlib" />
     <Reference Include="OpenTK">
     <Reference Include="System.Drawing" />
     <Reference Include="System.Numerics" />
     <Reference Include="System.ValueTuple">
-      <HintPath>..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
+      <HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
     </Reference>
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
index d0073d5..87c6b51 100644 (file)
@@ -2,11 +2,11 @@
 <packages>
   <package id="EmguCV" version="3.1.0.1" targetFramework="net452" />
   <package id="FSharp.Collections.ParallelSeq" version="1.0.2" targetFramework="net452" />
-  <package id="FSharp.Core" version="4.2.1" targetFramework="net452" />
-  <package id="MathNet.Numerics" version="3.19.0" targetFramework="net452" />
-  <package id="MathNet.Numerics.FSharp" version="3.19.0" targetFramework="net452" />
+  <package id="FSharp.Core" version="4.2.3" targetFramework="net452" />
+  <package id="MathNet.Numerics" version="3.20.0" targetFramework="net452" />
+  <package id="MathNet.Numerics.FSharp" version="3.20.0" targetFramework="net452" />
   <package id="OpenTK" version="2.0.0" targetFramework="net452" />
   <package id="OpenTK.GLControl" version="1.1.2349.61993" targetFramework="net452" />
-  <package id="System.ValueTuple" version="4.3.1" targetFramework="net452" />
+  <package id="System.ValueTuple" version="4.4.0" targetFramework="net452" />
   <package id="ZedGraph" version="5.1.7" targetFramework="net452" />
 </packages>
\ No newline at end of file
diff --git a/Parasitemia/ParasitemiaUI/CommandLineArguments.fs b/Parasitemia/ParasitemiaUI/CommandLineArguments.fs
new file mode 100644 (file)
index 0000000..8025ebf
--- /dev/null
@@ -0,0 +1,20 @@
+module ParasitemiaUI.CommandLineArguments
+
+open System
+open System.Windows
+open System.Windows.Controls
+open System.Diagnostics
+
+let showWindow (parent : Window) =
+    let win = Views.CommandLineArgumentsWindow ()
+    win.Owner <- parent
+
+    win.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Width / 2.
+    win.Top <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Top) + parent.ActualHeight / 2. - win.Height / 2.
+
+    win.txtCommandLineArguments.Text <- Utils.argsHelp
+
+    win.butClose.Click.AddHandler (fun obj args -> win.Close ())
+
+    win.ShowDialog () |> ignore
+
index 4eee1e5..d78c202 100644 (file)
@@ -484,6 +484,8 @@ let run (defaultConfig : Config) (fileToOpen : string option) =
 
     win.menuAbout.Click.AddHandler (fun obj args -> About.showWindow win)
 
+    win.menuCommandLineArguments.Click.AddHandler (fun obj args -> CommandLineArguments.showWindow win)
+
     win.Closing.AddHandler (fun obj args -> askSaveCurrent ())
 
     // Zoom on the current image.
index b9ad387..429ceaa 100644 (file)
@@ -80,6 +80,8 @@
     <Compile Include="XAML\PPICalculatorWindow.xaml.fs" />
     <Resource Include="XAML\AnalysisWindow.xaml" />
     <Compile Include="XAML\AnalysisWindow.xaml.fs" />
+    <Resource Include="XAML\CommandLineArgumentsWindow.xaml" />
+    <Compile Include="XAML\CommandLineArgumentsWindow.xaml.fs" />
     <Resource Include="XAML\AboutWindow.xaml" />
     <Compile Include="XAML\AboutWindow.xaml.fs" />
     <Resource Include="XAML\MainWindow.xaml" />
@@ -92,6 +94,7 @@
     <Compile Include="Export.fs" />
     <Compile Include="DPICalculator.fs" />
     <Compile Include="Analysis.fs" />
+    <Compile Include="CommandLineArguments.fs" />
     <Compile Include="About.fs" />
     <Compile Include="GUI.fs" />
     <None Include="App.config" />
       <HintPath>..\packages\EmguCV.3.1.0.1\lib\net30\Emgu.CV.World.dll</HintPath>
     </Reference>
     <Reference Include="FSharp.Core">
-      <HintPath>..\packages\FSharp.Core.4.2.1\lib\net45\FSharp.Core.dll</HintPath>
+      <HintPath>..\packages\FSharp.Core.4.2.3\lib\net45\FSharp.Core.dll</HintPath>
     </Reference>
     <Reference Include="FSharp.ViewModule">
       <HintPath>..\packages\FSharp.ViewModule.Core.1.0.7.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\FSharp.ViewModule.dll</HintPath>
     <Reference Include="System.IO.Compression.FileSystem" />
     <Reference Include="System.Numerics" />
     <Reference Include="System.ValueTuple">
-      <HintPath>..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
+      <HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
     </Reference>
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Interactivity">
index 87e1c26..63bd963 100644 (file)
@@ -20,7 +20,7 @@ type RunningMode =
     | CmdLine of Input * string // A file or a directory to process and the output directory.
     | Window of string option // An optional path to a file to open can be given in window mode.
 
-type Arguments = RunningMode * bool
+type Arguments = RunningMode * bool // bool : true if in debug mode.
 
 let parseArgs (args : string[]) : Arguments =
 
@@ -40,18 +40,7 @@ let parseArgs (args : string[]) : Arguments =
     runningMode, Array.exists ((=) "--debug") args
 
 let showArgsHelp () =
-    printfn "Usage of Parasitemia :"
-    printfn "Non-interactive mode:"
-    printfn "  %s (--folder <folder>|--file <file>) --output <folder> [--debug]" System.AppDomain.CurrentDomain.FriendlyName
-    printfn "    --folder <folder> : an input folder containing images to analyze"
-    printfn "    --file <file> : an image file to be analyzed"
-    printfn "    --output <folder> : a folder to put the results"
-    printfn "    --debug : output more information like intermediate images if set"
-
-    printfn "Interactive mode:"
-    printfn "  %s [<document-file>] [--debug]" System.AppDomain.CurrentDomain.FriendlyName
-    printfn "    <document-file> : a PIAZ file to automatically open at startup"
-    printfn "    --debug : output information like intermediate images if set in the current directory"
+    Console.WriteLine Utils.argsHelp
 
 [<System.Runtime.InteropServices.DllImport "kernel32.dll">]
 extern bool AttachConsole (int dwProcessId)
@@ -93,7 +82,7 @@ let main args =
 
                         use resultFile = new StreamWriter (new FileStream (Path.Combine (output, "results.txt"), FileMode.Append, FileAccess.Write))
 
-                        let images = [ for file in files -> Path.GetFileNameWithoutExtension (FileInfo(file).Name), config.Copy(), new Image<Bgr, byte> (file) ]
+                        let images = [ for file in files -> Path.GetFileNameWithoutExtension (FileInfo(file).Name), config.Copy (), new Image<Bgr, byte> (file) ]
 
                         Log.LogWithTime Severity.INFO (
                             fun () ->
@@ -109,7 +98,7 @@ let main args =
                                 Some ()
                         ) "Whole analyze" |> ignore
 
-                        Log.RmListener (listener)
+                        Log.RmListener listener
                         0
 
                     | Window fileToOpen ->
index 8635bcd..810494e 100644 (file)
@@ -61,3 +61,18 @@ let sensorSizes : SensorSize list =
     | _ex ->
         saveSensorSizesToFile defaultSensorSizes
         defaultSensorSizes
+
+let argsHelp =
+    let programName = System.AppDomain.CurrentDomain.FriendlyName
+    "Usage of Parasitemia:\n" +
+    "Non-interactive mode:\n" +
+    (sprintf "  %s (--folder <folder>|--file <file>) --output <folder> [--debug]\n" programName) +
+    "    --folder <folder> : an input folder containing images to analyze\n" +
+    "    --file <file> : an image file to be analyzed\n" +
+    "    --output <folder> : a folder to put the results\n" +
+    "    --debug : output more information like intermediate images (it takes more CPU and memory)\n" +
+
+    "Interactive mode:\n" +
+    (sprintf "  %s [<document-file>] [--debug]\n" programName) +
+    "    <document-file> : a PIAZ file to automatically open at startup\n" +
+    "    --debug : output information like intermediate images in the current directory (it takes more CPU and memory)"
\ No newline at end of file
diff --git a/Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml b/Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml
new file mode 100644 (file)
index 0000000..8952ea3
--- /dev/null
@@ -0,0 +1,17 @@
+<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        mc:Ignorable="d"
+        x:Name="CommandLineArgumentsWindow" Height="420" Width="620" Title="Command Line Arguments" Icon="pack://application:,,,/Resources/icon.ico" ResizeMode="CanResizeWithGrip">
+   <Grid Margin="3">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="*"/>
+            <RowDefinition Height="Auto"/>
+      </Grid.RowDefinitions>
+        <TextBlock Margin="3">Parasitemia can be launched via a command line, here are the possible arguments</TextBlock>
+        <TextBox x:Name="txtCommandLineArguments" Margin="6" Grid.Row="1" TextWrapping="Wrap" FontFamily="Courier New" FontSize="11" IsReadOnly="True" />
+        <Button x:Name="butClose" Content="Close" HorizontalAlignment="Right" Margin="3" VerticalAlignment="Bottom" Width="75" Grid.Row="2" Height="20"/>
+   </Grid>
+</Window>
\ No newline at end of file
diff --git a/Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml.fs b/Parasitemia/ParasitemiaUI/XAML/CommandLineArgumentsWindow.xaml.fs
new file mode 100644 (file)
index 0000000..716cb63
--- /dev/null
@@ -0,0 +1,6 @@
+namespace ParasitemiaUI.Views
+
+open FsXaml
+
+type CommandLineArgumentsWindow = XAML<"XAML/CommandLineArgumentsWindow.xaml">
+
index 9ce3f20..ac125de 100644 (file)
@@ -25,6 +25,7 @@
             <MenuItem x:Name="menuHightlightRBC" Header="_Highlight All Erythrocytes" IsCheckable="True" InputGestureText="Ctrl+H" />
          </MenuItem>
          <MenuItem x:Name="menuHelp" Header="_Help">
+            <MenuItem x:Name="menuCommandLineArguments" Header="_Command Line Arguments" />
             <MenuItem x:Name="menuAbout" Header="_About" />
          </MenuItem>
       </Menu>
index 30067c6..7e4b4ac 100644 (file)
@@ -2,12 +2,12 @@
 <packages>
   <package id="EmguCV" version="3.1.0.1" targetFramework="net452" />
   <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" />
-  <package id="FSharp.Core" version="4.2.1" targetFramework="net452" />
+  <package id="FSharp.Core" version="4.2.3" targetFramework="net452" />
   <package id="FSharp.ViewModule.Core" version="1.0.7.0" targetFramework="net462" />
   <package id="FsXaml.Wpf" version="3.1.6" targetFramework="net462" />
   <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
   <package id="OpenTK" version="2.0.0" targetFramework="net452" />
   <package id="OpenTK.GLControl" version="1.1.2349.61993" targetFramework="net452" />
-  <package id="System.ValueTuple" version="4.3.1" targetFramework="net452" />
+  <package id="System.ValueTuple" version="4.4.0" targetFramework="net452" />
   <package id="ZedGraph" version="5.1.7" targetFramework="net452" />
 </packages>
\ No newline at end of file
index d0cdfa5..75c810e 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" />
+  <Import Project="..\..\packages\xunit.runner.visualstudio.2.3.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\packages\xunit.runner.visualstudio.2.3.0\build\net20\xunit.runner.visualstudio.props')" />
+  <Import Project="..\..\packages\xunit.core.2.3.0\build\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
   </ItemGroup>
   <ItemGroup>
     <Reference Include="FSharp.Core">
-      <HintPath>..\..\packages\FSharp.Core.4.2.1\lib\net45\FSharp.Core.dll</HintPath>
+      <HintPath>..\..\packages\FSharp.Core.4.2.3\lib\net45\FSharp.Core.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.ValueTuple">
-      <HintPath>..\..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
+      <HintPath>..\..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
     </Reference>
     <Reference Include="xunit.abstractions">
       <HintPath>..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
     </Reference>
     <Reference Include="xunit.assert">
-      <HintPath>..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
+      <HintPath>..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
     </Reference>
     <Reference Include="xunit.core">
-      <HintPath>..\..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll</HintPath>
+      <HintPath>..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll</HintPath>
     </Reference>
     <Reference Include="xunit.execution.desktop">
-      <HintPath>..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll</HintPath>
+      <HintPath>..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
     <PropertyGroup>
       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props'))" />
+    <Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.props'))" />
+    <Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.targets'))" />
+    <Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.3.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.3.0\build\net20\xunit.runner.visualstudio.props'))" />
   </Target>
+  <Import Project="..\..\packages\xunit.core.2.3.0\build\xunit.core.targets" Condition="Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
index 6d282b2..2921e92 100644 (file)
@@ -1,12 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="FSharp.Core" version="4.2.1" targetFramework="net452" />
-  <package id="System.ValueTuple" version="4.3.1" targetFramework="net452" />
-  <package id="xunit" version="2.2.0" targetFramework="net452" />
+  <package id="FSharp.Core" version="4.2.3" targetFramework="net452" />
+  <package id="System.ValueTuple" version="4.4.0" targetFramework="net452" />
+  <package id="xunit" version="2.3.0" targetFramework="net452" />
   <package id="xunit.abstractions" version="2.0.1" targetFramework="net452" />
-  <package id="xunit.assert" version="2.2.0" targetFramework="net452" />
-  <package id="xunit.core" version="2.2.0" targetFramework="net452" />
-  <package id="xunit.extensibility.core" version="2.2.0" targetFramework="net452" />
-  <package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net452" />
-  <package id="xunit.runner.visualstudio" version="2.2.0" targetFramework="net452" developmentDependency="true" />
+  <package id="xunit.analyzers" version="0.7.0" targetFramework="net452" />
+  <package id="xunit.assert" version="2.3.0" targetFramework="net452" />
+  <package id="xunit.core" version="2.3.0" targetFramework="net452" />
+  <package id="xunit.extensibility.core" version="2.3.0" targetFramework="net452" />
+  <package id="xunit.extensibility.execution" version="2.3.0" targetFramework="net452" />
+  <package id="xunit.runner.visualstudio" version="2.3.0" targetFramework="net452" developmentDependency="true" />
 </packages>
\ No newline at end of file