Complete refactor, reasync, rebuild listener

This commit is contained in:
Alexander Horner
2022-12-06 22:34:32 +00:00
parent 5a4dfc01b6
commit ed5a43a0e8
8 changed files with 234 additions and 206 deletions

View File

@@ -6,6 +6,16 @@ namespace ntfysh_client
public partial class SubscribeDialog : Form
{
private readonly ListBox _notificationTopics;
public string TopicId => topicId.Text;
public string ServerUrl => serverUrl.Text;
public string Username => username.Text;
public string Password => password.Text;
public string Unique => $"{topicId.Text}@{serverUrl.Text}";
public SubscribeDialog(ListBox notificationTopics)
{
@@ -13,31 +23,6 @@ namespace ntfysh_client
InitializeComponent();
}
public string getTopicId()
{
return topicId.Text;
}
public string getServerUrl()
{
return serverUrl.Text;
}
public string getUsername()
{
return username.Text;
}
public string getPassword()
{
return password.Text;
}
public string getUniqueString()
{
return $"{topicId.Text}@{serverUrl.Text}";
}
private void button1_Click(object sender, EventArgs e)
{
if (topicId.Text.Length < 1)
@@ -72,7 +57,7 @@ namespace ntfysh_client
return;
}
if (_notificationTopics.Items.Contains(getUniqueString()))
if (_notificationTopics.Items.Contains(Unique))
{
MessageBox.Show($"The specified topic '{topicId.Text}' on the server '{serverUrl.Text}' is already subscribed", "Topic already subscribed", MessageBoxButtons.OK, MessageBoxIcon.Error);
DialogResult = DialogResult.None;