create Using S.B.B. in Your Proj. page.

master
Craig Oates 5 years ago
parent
commit
de1404649e
  1. 3
      Home.md
  2. 43
      Using-Smouldering-Beach-Ball-in-Your-Project.md
  3. 3
      _sidebar.md

3
Home.md

@ -41,10 +41,11 @@ Before continuing, I recommend you are familiar with the following;
### As a Command-Line Interface (C.L.I)
#### As a NuGet
### As a NuGet
- [NuGet Home](NuGet-Home)
- [Add Smouldering Beach Ball to Your Project](Add-Smouldering-Beach-Ball-to-Your-Project)
- [Using Smouldering Beach Ball in Your Project](Using-Smouldering-Beach-Ball-in-Your-Project)
### Extra Resources

43
Using-Smouldering-Beach-Ball-in-Your-Project.md

@ -0,0 +1,43 @@
Although there are slight variations, you will use SmoulderingBeachBall (S.B.B.) as a three-step process. They are as follows;
1. Construct a specification, declaring how you want your image to look.
2. Pass the specification to S.B.B. so it knows how you want the final image to look.
3. Tell S.B.B. to make the image -- either synchronously or asynchronously.
For now, I will not go into detail on what the specifications look like. Instead, I will provide an example of the steps above in code. You can ignore the `try-with` block and the function definition for now -- I kept it in for extra context.
```f#
let ``draw-image`` imgWidth imgHeight mainColour oColour oType path =
try
// Assume "buildSpec" is the abstracted version of step 1 above.
buildSpec imgWidth imgHeight mainColour oColour oType path
|> makeImage
|> Async.RunSynchronously
with
| :? ArgumentException as ex -> ex.Message
| _ as ex -> ex.Message
```
For more in-depth examples, have a look at "ConsoleCommands.fs". In here, you will find "real world" examples of this library in use. You can, also, check out the "Snippets" section for more examples. Links to those places are as follows;
- ["ConsoleCommands.fs"](https://gitlab.com/craig.oates/Smouldering-Beach-Ball/blob/master/SmoulderingBeachBallCLI/ConsoleCommands.fs)
- ["Snippets" Section](https://gitlab.com/craig.oates/Smouldering-Beach-Ball/snippets)
You can view the code for the various specifications using the following link;
- [Domain.fs](https://gitlab.com/craig.oates/Smouldering-Beach-Ball/blob/master/SmoulderingBeachBall/Domain.fs)
## The Pieces you will be Working With
As a consumer of S.B.B., you will not have access to every part it. Instead, you will work within two name-spaces: `SmoulderingBeachBall.Domain` and `SmoulderingBeachBall`. With that said, the module in `Domain` utilises the `AutoOpen` attribute. This means you only need to add `open SmoulderingBeachBall.Service` to start using it (`Service` is the module you use which resides in `SmoulderingBeachBall`).
IMAGE OF PARTS YOU USE.
Because `SmoulderingBeachBall.Domain` automatically opens, you might get a false impression about the main component you will use. You might think the `ServicesSmoulderingBeachBall.Service` module is where you will spend most of your time. This is a red herring. The reason why is because `Service` does only one thing: make the Image. Granted, it is a two-step process, which is "make image" and "save/commit/write image". But, they are practically two sides of the same coin. To help demonstrate that, please consider the following code;
```f#
makeImage yourSpec
|> Async.Run // Or, Async.RunSynchronously
```
Once you have those two lines in the memory bank, you will spend most of your time in `Domain`. This is because, to put it simply, there is more to work with.

3
_sidebar.md

@ -16,10 +16,11 @@
### As a Command-Line Interface (C.L.I)
#### As a NuGet
### As a NuGet
- [NuGet Home](NuGet-Home)
- [Add Smouldering Beach Ball to Your Project](Add-Smouldering-Beach-Ball-to-Your-Project)
- [Using Smouldering Beach Ball in Your Project](Using-Smouldering-Beach-Ball-in-Your-Project)
### Extra Resources

Loading…
Cancel
Save