Wednesday, May 15, 2024
HomePowershellLastly, Introducing the First Preview of BurntToast v1

Lastly, Introducing the First Preview of BurntToast v1


Evidently, this final 12 months has passed by very quick. I introduced that I used to be beginning to work on the re-write of BurntToast that might be launched as v1 again in April of 2021 after which promptly… did not get round to engaged on it. With a job change and customarily being busy, BurntToast took a again seat for some time there.

However I am glad to say that the primary preview launch is up on the PowerShell Gallery: BurntToast 1.0.0-Preview1.

What’s New?

As I’ve mentioned earlier than, that is going to be an virtually full re-write of the module. The way it’s used goes to alter, each as a result of the upstream .NET sources have enabled slicker experiences and likewise the good thing about having made my very own UX errors in earlier variations that I’ve at all times wished a do-over on.

To that finish, this primary preview launch could be very restricted, that includes solely a small handful of capabilities:

If you happen to’ve used the present variations of BurntToast, you will discover an absence of capabilities with the New verb. Nearly all the things in v0.8.5, and earlier, ends in an object, be {that a} “textual content” object or an “picture” object. The entire thing relied on you realizing how and the place to make use of these objects.

That is all nicely and good when you’ve acquired understanding of the underlying XML, however arcane when you do not. The place, for instance, does the “binding” object match? How is it totally different to the “visible” object?

The distinction with v1 is that all of it revolves round a single object, the “Toast Content material Builder” which you create with the New-BTContentBuilder perform. You’re taking that and construct your toast on high of it by including components to it.

A Story of Two Utilization Fashions

This primary set of capabilities had been chosen as present case for the brand new utilization of the BurntToast module. With them you may create visually fascinating toasts rapidly, with out getting slowed down with too many superior choices (for now.)

For instance, this toast was created utilizing the obtainable instructions and simply 5 strains of code:

Example toast using BurntToast v1.0.0-Preview1

The primary methodology for doing this with BurntToast v1 is to retailer the Toast Content material Builder in a variable and cross it into every command in flip till you are able to show it utilizing the Present-BTNotification perform.

$Builder = New-BTContentBuilder
$Builder | Add-BTAppLogo
$Builder | Add-BTText "BurntToast v1 is within the works!", "It took some time, however progress is being made"
$Builder | Add-BTImage "https://uncooked.githubusercontent.com/Windos/BurntToast/fundamental/Media/BurntToast-Vast.png"
$Builder | Present-BTNotification

Having to specify the Toast Content material Builder on a regular basis is a little bit of a drag, proper? That is why every of the capabilities with the Add verb helps a PassThru parameter that outputs the up to date builder object.

You can add this to every command, and pipe by way of every command.

New-BTContentBuilder |
    Add-BTAppLogo -PassThru |
    Add-BTText "BurntToast v1 is within the works!", "It took some time, however progress is being made" -PassThru |
    Add-BTImage "https://uncooked.githubusercontent.com/Windos/BurntToast/fundamental/Media/BurntToast-Vast.png" -PassThru |
    Present-BTNotification

That is higher, however having to specify -PassThru on a regular basis is a little bit of a drag. As a substitute, you should use a default parameter worth to say it ought to at all times be used for any perform beginning with Add-BT.

$PSDefaultParameterValues = @{
    "Add-BT*:PassThru" = $true
}

New-BTContentBuilder |
    Add-BTAppLogo |
    Add-BTText "BurntToast v1 is within the works!", "It took some time, however progress is being made" |
    Add-BTImage "https://uncooked.githubusercontent.com/Windos/BurntToast/fundamental/Media/BurntToast-Vast.png" |
    Present-BTNotification

You Suggestions Wanted

You will word that there is three capabilities included on this preview that take care of several types of photographs:

  • Common photographs that present within the physique of a notification, below any textual content.
  • Hero photographs that present as massive, daring, banners throughout the highest of a notification.
  • App logos, that are typically the icon for the app producing a notification or presumably a consumer avatar for chat notifications (for instance)

These capabilities are all very related and might be a single command, like they’re within the pre v1 BurntToast variations.

Chances are high Preview2 will roll these into one perform. You probably have opinions for both possibility, I wish to hear from you. Please do drop your ideas into this dialogue.

Your suggestions on another situation can be very a lot appreciated, so do not hesitate to get in contact outdoors of that specific dialogue too!

For now, please check out the present preview and preserve your eye out for the following one.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments