Skip to content

Commit 8f5021e

Browse files
committed
Hero Image and Attribution
1 parent 5c3a1fb commit 8f5021e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/Cmdlets/SendBurntToastCmdlet.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ public class SendBurntToastCommand : Cmdlet
1919
[ValidateSet("Circle", "Square")]
2020
public string? AppLogoCrop { get; set; }
2121

22+
[Parameter(Mandatory = false)]
23+
[ValidateNotNullOrEmpty]
24+
public string? HeroImage { get; set; }
25+
26+
[Parameter(Mandatory = false)]
27+
[ValidateNotNullOrEmpty]
28+
public string? Attribution { get; set; }
29+
2230
protected override void ProcessRecord()
2331
{
2432
WriteVerbose("Building toast notification...");
@@ -73,6 +81,24 @@ protected override void ProcessRecord()
7381

7482
builder.SetAppLogoOverride(appLogoUri, appLogoCrop);
7583

84+
if (HeroImage != null)
85+
{
86+
string fullHeroImagePath = Path.GetFullPath(HeroImage);
87+
88+
if (!File.Exists(fullHeroImagePath))
89+
{
90+
throw new FileNotFoundException($"Hero Image file not found at path: {fullHeroImagePath}");
91+
}
92+
93+
var heroImageUri = new Uri(fullHeroImagePath);
94+
builder.SetHeroImage(heroImageUri);
95+
}
96+
97+
if (Attribution != null)
98+
{
99+
builder.SetAttributionText(Attribution);
100+
}
101+
76102
var appNotification = builder.BuildNotification();
77103

78104
AppNotificationManager.Default.Show(appNotification);

0 commit comments

Comments
 (0)