make tray pop up and make it work

This commit is contained in:
mshafer1
2024-12-20 11:29:22 -06:00
parent cb55d0148d
commit a7dcf3611c
4 changed files with 295 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ namespace ntfysh_client
private readonly NotificationListener _notificationListener;
private bool _startInTray;
private bool _trueExit;
private NotificationDialog notificationDialog;
public MainForm(NotificationListener notificationListener, bool startInTray = false)
{
@@ -32,6 +33,8 @@ namespace ntfysh_client
{
LoadSettings();
LoadTopics();
this.notificationDialog = new NotificationDialog();
}
protected override void SetVisibleCore(bool value)
@@ -70,7 +73,9 @@ namespace ntfysh_client
string finalTitle = string.IsNullOrWhiteSpace(e.Title) ? $"{e.Sender.TopicId}@{e.Sender.ServerUrl}" : e.Title;
notifyIcon.ShowBalloonTip((int)TimeSpan.FromSeconds((double)Program.Settings.Timeout).TotalMilliseconds, finalTitle, e.Message, priorityIcon);
//notifyIcon.ShowBalloonTip((int)TimeSpan.FromSeconds((double)Program.Settings.Timeout).TotalMilliseconds, finalTitle, e.Message, priorityIcon);
//this.notificationDialog.IsVisible = true;
this.notificationDialog.ShowNotification(finalTitle, e.Message);
}
private void OnConnectionMultiAttemptFailure(NotificationListener sender, SubscribedTopic topic)