Craig Oates
6 years ago
3 changed files with 28 additions and 39 deletions
@ -1,37 +1,15 @@ |
|||||||
// Learn more about F# at http://fsharp.org |
// Learn more about F# at http://fsharp.org |
||||||
// See the 'F# Tutorial' project for more help. |
// See the 'F# Tutorial' project for more help. |
||||||
|
open System.IO |
||||||
|
|
||||||
#load "ConsoleTests.fs" |
let saveLocation = __SOURCE_DIRECTORY__ + "/SavingTestArea/" |
||||||
#load "LibraryTests.fs" |
|
||||||
|
|
||||||
open ConsoleTests |
let resetSavingTestArea () = |
||||||
open LibraryTests |
let files = Directory.GetFileSystemEntries(saveLocation) |
||||||
open System.Drawing |
match files.Length with |
||||||
open System.Reflection |
| 0 -> () |
||||||
open System |
| _ -> |
||||||
|
files |
||||||
|
|> Array.iter (fun f -> File.Delete(f)) |
||||||
|
|
||||||
// Define your library scripting code here |
resetSavingTestArea () |
||||||
|
|
||||||
let allBrushColours = |
|
||||||
let properties = |
|
||||||
Color().GetType().GetProperties() |
|
||||||
let names = |
|
||||||
seq { for prop in properties do |
|
||||||
yield prop.Name } |
|
||||||
|> Seq.toList |
|
||||||
names |
|
||||||
|
|
||||||
let allBrushes = |
|
||||||
let properties = |
|
||||||
typeof<Brushes>.GetProperties(BindingFlags.Public|||BindingFlags.Static) |
|
||||||
let colours = |
|
||||||
seq { for prop in properties -> prop} |
|
||||||
|> Seq.toArray |
|
||||||
colours |
|
||||||
|
|
||||||
let randomColour () = |
|
||||||
let item = allBrushes.[Random().Next (allBrushes.Length)] |
|
||||||
item.GetValue(null, null) |
|
||||||
|
|
||||||
printfn "%A" allBrushes |
|
||||||
printfn "%A" (randomColour ()) |
|
Loading…
Reference in new issue