changed var to explicit type

changed title on SendMessageForm
handling error codes
added credentials handling
added icon to context menu item
This commit is contained in:
seba
2024-12-18 20:39:19 +01:00
parent c7e02655b0
commit 2c18f91d68
6 changed files with 106 additions and 18 deletions

View File

@@ -426,15 +426,19 @@ namespace ntfysh_client
{
if (notificationTopics.SelectedItem != null && string.IsNullOrEmpty(notificationTopics.SelectedItem as string) == false)
{
var dlg = new SendMessageForm();
var r = dlg.ShowDialog(this);
if (r == DialogResult.OK)
try
{
var topicAndHost = notificationTopics.SelectedItem.ToString()?.Split("@");
var topic = topicAndHost[0];
var host = topicAndHost[1].Replace("wss", "https");
var msg = dlg.Message;
await _notificationListener.SendNotification(host, new NtfyEvent { Topic = topic, Title = dlg.Title, Message = msg });
SendMessageForm dlg = new SendMessageForm();
DialogResult r = dlg.ShowDialog(this);
if (r == DialogResult.OK)
{
string key = notificationTopics.SelectedItem.ToString();
await _notificationListener.SendNotification(key, dlg.Title, dlg.Message);
}
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK);
}
}
}