Giter Club home page Giter Club logo

Comments (7)

Windos avatar Windos commented on August 16, 2024 2

Hey @jeremytbrun! Good question, I don't think I I'd documented this anywhere (and it'd slipped my mind to look into again.)

Behind the scenes there are two options, replace and update.

Replace is what's currently being used, and as you've seen it redraws and displays the toast everyone.

Update would be the smoother experience, as it doesn't redraw (eg if the toast is in the action center it'll be quietly updated with the new info without retoasting the user)

Unfortunately update wasn't working back when this was released. My hope is when I finally get the next release of this out there it'll be working...

I personally want to be providing more frequent update toasts, so I have up to date info if I happen to check the action center. And maybe do a replace toast at 50% and 100%.

from burnttoast.

Windos avatar Windos commented on August 16, 2024

The New-BTProgressBar function is creating an object which you can later use as an input to a Toast notification. It looks like what you're seeing there is the "ToString" output of those objects.

It looks like what you may be looking for is the built in Write-Progress?

Otherwise, best thing to do is pop that BTProgressBar into a variable, then fire off a new Toast notification:

for ([double]$x = 0; $x -lt 100; $x++) {
    write-debug "Loop: $x"
    $Prog = New-BTProgressBar -Status 'Running'  -Value ([double]$x/100) -ValueDisplay ("$x of $TotalToProcess done") -Title "Test Title" -Verbose
    New-BurntToastNotification -ProgressBar $Prog -UniqueIdentifier 'TestLoop' -Text 'Test loop'
    Start-Sleep -Seconds 1
}

Of note here, the UniqueIdentifier tells Windows to replace the previous Toast(s) with that string attached (i.e. so that you can update the progress on the bar). I've also got a sleep in there, as if they all end up coming through at what is effectively the same moment in time, Windows will just hide them away in the Action Center.

If you run that you'll very quickly notice that you probably shouldn't show a new toast for every single percentage increase... as it triggers a full on toast every single time (complete with animation and sound.)

Hope all of that made sense; no morning coffee yet.

from burnttoast.

sheldonhull avatar sheldonhull commented on August 16, 2024

from burnttoast.

Windos avatar Windos commented on August 16, 2024

Ahh, my apologies. I put the "full" example for them in an help for New-BurntToastNotification... definitely need to change that.

Thanks for opening an issue, btw, it really helps me get a glimpse of what people are using this for and changes/tweaks that need to be made.

from burnttoast.

jeremytbrun avatar jeremytbrun commented on August 16, 2024

I'm likely restating some of the obvious, but when running the code snippet provided in this thread it does pop an entirely new toast notification every time. It updates the progress bar, but it makes the notification pop in and out every time the progress bar is updated since it is redrawing the whole thing as a brand new notification. Any way to make it be a smoother experience where the notification stays present and active and only the progress bar changes?

from burnttoast.

Windos avatar Windos commented on August 16, 2024

Just about to click go on v0.7.0.

Updatable toasts are in, expect a blog post over on https://toastit.dev in the next day or so.

Help still needs work, and that will be the focus of v0.7.1

from burnttoast.

HeedfulCrayon avatar HeedfulCrayon commented on August 16, 2024

@Windos That blog post doesn't cover how to update the progressbar. How do you do an update with the progressbar?

from burnttoast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.