Having a problem with my windows form. It's a very basic windows form, called from a seperate class. It has 1 button and 1 textfield. It takes 1 argument of a client
var form = new Form1(client);
form.Show();
Form1 code:
public partial class Form1 : Form
{
private DiscordClient client;
public Form1(DiscordClient client)
{
this.client = client;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var usernameToKick = username.Text;
var userToKick = client.Servers.FirstOrDefault().Users.Where(input => input.Name == usernameToKick).FirstOrDefault();
userToKick.Kick();
}
private void username_TextChanged(object sender, EventArgs e)
{
}
}
This freezes my form for about 30 seconds, before the form shuts down again. Why does this happen?