Skip to content

Commit

Permalink
Issue 44: fixed. we swallow dataerror events that seem to arise from …
Browse files Browse the repository at this point in the history
…non-homoeneous collections
  • Loading branch information
stephen-swensen committed Jun 27, 2014
1 parent 555d0cd commit 5b8c795
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions Debug.FsEye/Debug.FsEye.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<Reference Include="System.Numerics" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FsEye.DataGridView.Plugin\FsEye.DataGridView.Plugin.fsproj">
Expand Down
29 changes: 27 additions & 2 deletions Debug.FsEye/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
open System
open System.Drawing
open System.Windows.Forms
open System.Xml

type Student = { mutable Name:string; Age:int }
type IHuman =
abstract member Name : string

type Student =
{ Name:string; Age:int }
interface IHuman with
member this.Name = this.Name

type Professor =
{ Name:string; Age:int; Rank: int }
interface IHuman with
member this.Name = this.Name

module Main =
let initEye() =
Expand All @@ -14,8 +26,21 @@ module Main =
eye.Watch("some null value", null, typeof<System.Collections.Generic.Dictionary<int,string>>)
let value = ([|3.2; 2.; 1.; -3.; 23.|],[|"a";"b";"c";"d";"e"|])
eye.Watch("series", value, value.GetType())
let value = [{Name="Tom"; Age=3};{Name="Jane"; Age=9}]
let value = [{Student.Name="Tom"; Age=3};{Name="Jane"; Age=9}]
eye.Watch("series2", value, value.GetType())

let value = [
{Professor.Name="Jane"; Age=9; Rank=23} :> IHuman;
{Student.Name="Tom"; Age=3} :> IHuman; ]
eye.Watch("series3", value, value.GetType())

let doc = new XmlDocument()
doc.AppendChild(doc.CreateProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\"")) |> ignore
let root = doc.CreateElement("Root")
root.AppendChild(doc.CreateElement("Apple"))|>ignore
doc.AppendChild(root)|>ignore
eye.Watch("xmldoc", doc)

eye.Watch("eye", eye, eye.GetType())
eye

Expand Down
2 changes: 2 additions & 0 deletions FsEye.DataGridView.Plugin/DataGridViewPlugin.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type DataGridViewWatchViewer() =

let dgv = new DataGridView(Dock=DockStyle.Fill)
do
//swallow dataerror events: these can happen when we have a non-homogeneous collection
dgv.DataError.Add(fun target -> ())
panel.Controls.Add(dgv)

let labelPanel = new FlowLayoutPanel(Dock=DockStyle.Top, AutoSize=true, Padding=Padding(0,3,3,5))
Expand Down

0 comments on commit 5b8c795

Please sign in to comment.