Tsunami-ide / public

21 stars 6 forks source link

Tsunami hangs trying to run OxyPlot in a WinForm #18

Closed jackfoxy closed 11 years ago

jackfoxy commented 11 years ago

Running the following works fine submitting to fsi from VS2012, but trying to run in Tsunami the WinForm window opens, but then hangs

I "C:\Packages"

r "OxyPlot.Core.2013.1.74.1/lib/portable-net4+sl4+wp71+win8/OxyPlot.dll"

r "OxyPlot.WindowsForms.2013.1.74.1/lib/NET45/OxyPlot.WindowsForms.dll"

r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Windows.Forms.dll"

r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Core.dll"

r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Drawing.dll"

open System.Windows.Forms open OxyPlot open OxyPlot.Series

type Form1() as this = inherit Form()

let plot1 = new WindowsForms.Plot() do this.Controls.Add plot1 do plot1.Dock <- System.Windows.Forms.DockStyle.Fill

let pm = new PlotModel("Trigonometric functions", "Example using the FunctionSeries")

let fs = new FunctionSeries(sin, 0.0, 6.28, 0.1, "sin(x)")

do pm.Series.Add(fs); do plot1.Model <- pm

let f = new Form1() f.Show()

moloneymb commented 11 years ago

G’day Jack, by default the Tsunami FSI runs in process which enables a number of cool features but causes some issues like this. It’s likely that running certain parts on the UI thread using (Tsunami.Utilities.Dispatcher.invoke) will fix it. Alternatively you could spin up a new FSI instance in the Consoles group in the ribbon. Then select the new FSI instance from the dropdown to send all Alt-Enter text to the new process.

jackfoxy commented 11 years ago

Dispatcher.invoke(fun _ -> f.Show())

Runs just fine.