2 SmoulderingBeachBall's Flow
Craig Oates edited this page 4 years ago

To help you get up to speed on the way Smouldering Beach Ball works, please consider the following image:

sbb general flow

The way it works is you construct a "spec" using the code in "Domain.fs" and pass it to an appropriate function in "Services.fs". From there, "Services.fs" hands it off to "InternalServices.fs". This is after doing some preliminarty checks first. After that, "InternalServices.fs" creates the placeholder image based on the "spec". It then reports it status to Services.fs which, in-turn, forwards that on to the consumer of the NuGet package. It is important to note, the output will either be an expection or unit (()). If it is unit, that means the image was created successfully and is saved in the location specified. In other words, no news is good news.

As an aside, I have tried to keep "Domain.fs" and "Services.fs" small. This is because they are the public facing part of the library/NuGet. And, I want to keep S.B.B. easy to integrate into other people's projects. If you do decide to work on this project, please keep this in mind. With that said, I will acknowledge most of the code now resides in "InternalServices.fs" because of it.

Typical Flow of the System in Code

I though it would would help if I included some code examples with the information above. If all goes well, it should help improve your intution for the project.

// Note the Async.RunSynchronously.
let synchronousFunction width height =
    try
        makeSpec width height
        |> makeImage
        |> Async.RunSynchronously
    with
    | :? ArgumentException as ex -> ex.Message
    | _ as ex -> ex.Message

// Note the Async.Start and one-way of building a spec type.
let asynchronousFunction width height =
    try
        let oSpec =
            { colour = Brushes.Black
            overlayType = Full }
        let spec =
            { width = iWidth
            height = iHeight
            colour = Brushes.AntiqueWhite
            filePath = getDesktopPath
            overlay = Some }
        spec
        |> makeImage
        |> Async.Start
    with
    | :? ArgumentException as ex -> ex.Message
    | _ as ex -> ex.Message