Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't set button label with New-BTButton with Update-BTNotification #231

Open
1 task done
vorpalvorpal opened this issue Feb 7, 2024 · 2 comments
Open
1 task done
Assignees

Comments

@vorpalvorpal
Copy link

vorpalvorpal commented Feb 7, 2024

Steps to Reproduce

    $buttonSnooze = New-BTButton -Content "Snooze" -snooze -id 'SnoozeTime'
    $buttonAction = New-BTButton -Content "buttonName" -Arguments "buttonArgs"
    $progressBar = New-BTProgressBar -Title 'Time remaining' -Status "progressStatus" -Value "progressValue"
    $progressData = @{
            progressStatus = 'Waiting...'
            progressValue = 0
            buttonName = 'Ready, set, go!'
            buttonArgs = "http://google.com"
            message = "test message"
    }
    $action = New-BTAction -Buttons $buttonSnooze, $buttonAction
    $Text1 = New-BTText -Content "message"
    $Binding = New-BTBinding -Children $Text1, $progressBar
    $Visual = New-BTVisual -BindingGeneric $Binding
    $content = New-BTContent -Visual $Visual -Actions $action -Scenario 'Reminder'
    Submit-BTNotification -Content $content -UniqueIdentifier "pomodoro" -DataBinding $progressData

Expected Behavior

As expected the resulting toast uses the values defined in progressData to fill in the -Status and -Value parameters of the progress bar and the -Content parameter of New-BTText, however the -Content parameter of $buttonAction is displayed as the string "buttonName" rather than the value of 'buttonName' in $progressData.

Actual Behavior

The $buttonAction should display the text "Ready, set, go!" as defined in $progressData

Experience with Toast

Beginner

Environment data: PowerShell

Name                           Value
----                           -----
PSVersion                      5.1.18362.145
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.145
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Environment data: OS

OsName         : Microsoft Windows 10 Pro
OsVersion      : 10.0.18362
OsArchitecture : 64-bit

Environment data: BurntToast

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.8.5      BurntToast                          {Get-BTHistory, New-BTAction, New-BTAppId, New-BTAu...

Consent to Attribution

  • Please shout me out if I've inspired a blog post!
@vorpalvorpal
Copy link
Author

Digging into the code a bit, it looks like objects must be of class 'AdaptiveText' to be updated by the data binding, and buttons are not of this class. This appears to be a limitation of the windows toast system rather than an issue with BurntToast.

Nevertheless, I'll keep this issue open in case either someone has an idea of how to change the button content in some other way than by using data binding and also, because I think if would be good to flag in the documentation what the limitations of the data bindings are.

@PeterKW
Copy link

PeterKW commented Feb 17, 2024

Does the basic example of burnt toast work for you before this? #230 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants