Skip to content

Instantly share code, notes, and snippets.

private void ClearViewport()
{
ModelVisual3D m;
for (int i = mainViewport.Children.Count - 1; i >= 0; i--)
{
m = (ModelVisual3D)mainViewport.Children[i];
if (m.Content is DirectionalLight == false)
mainViewport.Children.Remove(m);
}
}
<!-- ... -->
<Viewport3D.Camera>
<PerspectiveCamera FarPlaneDistance="100" LookDirection="-11,-10,-9"
UpDirection="0,1,0" NearPlaneDistance="1"
Position="11,10,9" FieldOfView="70" />
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<DirectionalLight Color="White" Direction="-2,-3,-1" />
</ModelVisual3D.Content>
/// the C# solution identifies the baseline members by checking on their type;
/// it may be preferable to identify the baseline / removable children via hash codes
/// (in this specific case, there is only one baseline child)
let viewportBaseline =
[0 .. (!vp).Children.Count-1] // [0 .. -1] = []
|> List.map (fun i -> (!vp).Children.[i].GetHashCode())
|> Set.ofList
/// keep baseline while removing 'window.mainViewport' descendants;
/// using updated 3DTools library found here:
/// -> https://github.com/kindohm/wpf3dtutorial
type MainWindow = XAML<"MainWindow.xaml">
let window = MainWindow()
let vp = ref window.mainViewport
/// original comment:
// Normal wires are not models, so we can't
// add them to the normal group. Just add them
// to the 'viewport' for now...
/// -> using side effects!
/// -> different life cycle scope of cube and normals!
(!vp).Children.Add normal0Wire
(!vp).Children.Add normal1Wire
(!vp).Children.Add normal2Wire
/// cannot access a TextBox by name (unlike Button);
/// is this a XAML TypeProvider error?
/// WORKAROUND: use the FindName method
let getTextBoxValue name =
try
((!vp).FindName(name) :?> TextBox).Text
with
| ex -> ex.ToString() |> System.Windows.MessageBox.Show |> ignore; ""
fb@MacBook:~/projects/FSharp.Formatting $ ./build.sh
fsharpi build.fsx
Building project with version: LocalBuild
Shortened DependencyGraph for Target All:
<== All
<== GenerateDocs
<== RunTests
<== Build
<== AssemblyInfo
<== RestorePackages
fb@MacBook:~/projects/FSharp.Data $ ./build.sh All
fsharpi -d:MONO build.fsx
Building project with version: LocalBuild
Shortened DependencyGraph for Target All:
<== All
<== Build
<== AssemblyInfo
<== Clean
<== BuildTests
<== RunTests
Processing 'ja/tutorials/JsonToXml.fsx'
***** FSharp.Data.Tests.Experimental.DesignTime.SignatureTests.Validate signature didn't change (Apiary,themoviedb)
***** FSharp.Data.Tests.Experimental.DesignTime.SignatureTests.Validate signature didn't change (Apiary,fssnip)
Tests run: 228, Errors: 2, Failures: 0, Inconclusive: 0, Time: 4,1741957 seconds
Not run: 1, Invalid: 0, Ignored: 0, Skipped: 1
Errors and Failures:
1) Test Error : FSharp.Data.Tests.Experimental.DesignTime.SignatureTests.Validate signature didn't change (Apiary,themoviedb)
System.Net.WebException : The remote server returned an error: (503) Service Unavailable.
@fbmnds
fbmnds / gist:8749840
Last active August 29, 2015 13:55 — forked from forki/gist:8740980
<?xml version="1.0" encoding="utf-8"?>
<doc>
<assembly><name>FakeLib</name></assembly>
<members>
<member name="M:Fake.AdditionalSyntax.op_EqualsQmarkGreater(System.String,System.String,System.Boolean)">
<summary>
Defines a conditional dependency - y is dependent on x if the condition is true
</summary>
</member>
<member name="M:Fake.AdditionalSyntax.op_LessEqualsGreater(System.String,System.String)">