Skip to content

Commit

Permalink
updated notification toast to include image
Browse files Browse the repository at this point in the history
  • Loading branch information
BitBaboonSteve committed Jan 18, 2022
1 parent 449a704 commit 5f66387
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
30 changes: 19 additions & 11 deletions EVEData/EveManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2788,17 +2788,25 @@ private void GameLogFileWatcher_Changed(object sender, FileSystemEventArgs e)

if(sendWindowsNotification)
{
// Requires Microsoft.Toolkit.Uwp.Notifications NuGet package version 7.0 or greater
ToastContentBuilder tb = new ToastContentBuilder();
tb.AddText("SMT Alert");
tb.AddText("Character : " + characterName + "(" + lc.Location + ")");
tb.AddText(line);
tb.AddArgument("character", characterName);
tb.SetToastScenario(ToastScenario.Alarm);
tb.SetToastDuration(ToastDuration.Long);
Uri woopUri = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"\Sounds\woop.mp3");
tb.AddAudio(woopUri);
tb.Show();

Application.Current.Dispatcher.Invoke((Action)(() =>
{
// Requires Microsoft.Toolkit.Uwp.Notifications NuGet package version 7.0 or greater
ToastContentBuilder tb = new ToastContentBuilder();
tb.AddText("SMT Alert");
tb.AddText("Character : " + characterName + "(" + lc.Location + ")");
tb.AddInlineImage(lc.Portrait.UriSource);
tb.AddText(line);
tb.AddArgument("character", characterName);
tb.SetToastScenario(ToastScenario.Alarm);
tb.SetToastDuration(ToastDuration.Long);
Uri woopUri = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"\Sounds\woop.mp3");
tb.AddAudio(woopUri);
tb.Show();


}), DispatcherPriority.Normal, null);

}
}
}
Expand Down
21 changes: 12 additions & 9 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1665,15 +1665,18 @@ private void TestMenuItem_Click(object sender, RoutedEventArgs e)

lc.GameLogWarningText = line;

new ToastContentBuilder()
.AddText("SMT Alert")
.AddText("Character : " + characterName + "(" + lc.Location + ")")
.AddText(line)
.AddInlineImage(lc.Portrait.UriSource)
.AddArgument("character", characterName)
.SetToastScenario(ToastScenario.Alarm)
.SetToastDuration(ToastDuration.Long)
.Show();
ToastContentBuilder tb = new ToastContentBuilder();
tb.AddText("SMT Alert");
tb.AddText("Character : " + characterName + "(" + lc.Location + ")");
tb.AddInlineImage(lc.Portrait.UriSource);
tb.AddText(line);
tb.AddArgument("character", characterName);
tb.SetToastScenario(ToastScenario.Alarm);
tb.SetToastDuration(ToastDuration.Long);
Uri woopUri = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"\Sounds\woop.mp3");
tb.AddAudio(woopUri);
tb.Show();

}
}

Expand Down

0 comments on commit 5f66387

Please sign in to comment.