Skip to content

Commit

Permalink
Neo4j server management - first draft
Browse files Browse the repository at this point in the history
  • Loading branch information
kkokosa committed Dec 16, 2016
1 parent a925924 commit 15c99b6
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
32 changes: 32 additions & 0 deletions src/MemoryVisualizer.UI/Functions/Neo4j.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Neo4j

open System.Diagnostics

type Neo4jState =
| Starting
| Started of int
| Stopping
| Stopped

type Neo4j = {
Name : string
State : Neo4jState
}

let Create name =
{ Name = name; State = Stopped }

let start (instance : Neo4j) =
printfn "Starting"
let pi = new ProcessStartInfo("""..\..\..\..\paket-files\neo4j.com\neo4j-community-3.0.1\bin\neo4j.bat""", "console")
let process = Process.Start(pi)
{ instance with State = Started(process.Id) }

let stop (instance : Neo4j) =
match instance.State with
| Started id -> printf "Stopping"
let process = Process.GetProcessById(id)
process.CloseMainWindow()
{ instance with State = Stopped }
| _ -> printf "Error"
instance
1 change: 1 addition & 0 deletions src/MemoryVisualizer.UI/MemoryVisualizer.UI.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<Paket>True</Paket>
<Link>paket-files/neo4j.zip</Link>
</Content>
<Compile Include="Functions\Neo4j.fs" />
<Compile Include="Model\MemoryDump.fs" />
<Compile Include="ViewModels\MainViewModel.fs" />
<Resource Include="MainWindow.xaml" />
Expand Down
8 changes: 7 additions & 1 deletion src/MemoryVisualizer.UI/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ open System.Windows
open FsXaml

open ViewModels
open Neo4j

type MainWindow = XAML<"MainWindow.xaml", true>

[<STAThread>]
[<EntryPoint>]
let main argv =
let neo4j = start (Neo4j.Create "Main")

let window = new MainWindow()
window.Root.DataContext <- new MainViewModel()
(new Application()).Run(window.Root)
let result = (new Application()).Run(window.Root)

stop neo4j
result
3 changes: 1 addition & 2 deletions src/Settings.FSharpLint
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FSharpLintSettings xmlns="https://github.com/fsprojects/FSharpLint/blob/master/ConfigurationSchema.xsd">
<IgnoreFiles Update="Overwrite"><![CDATA[assemblyinfo.*
]]></IgnoreFiles>
<IgnoreFiles Update="Overwrite"><![CDATA[assemblyinfo.*]]></IgnoreFiles>
<Analysers />
</FSharpLintSettings>

0 comments on commit 15c99b6

Please sign in to comment.