private void button1_Click(object sender, EventArgs e) { if (!_server.IsRunning) { if (_server.Connect()) { button1.Text = "Stop Server"; button1.ForeColor = Color.Red; button1.Image = Image.FromFile(Environment.CurrentDirectory + "\\assets\\stop.png"); } else { MessageBox.Show("We cannot start server right now, it seems there is a technical error check the error logs", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (_server.Abort()) { button1.Text = "Start Server"; button1.ForeColor = Color.Green; button1.Image = Image.FromFile(Environment.CurrentDirectory + "\\assets\\start.png"); } else { MessageBox.Show("Server abort error, it may be possible that it is already stoped or you can check the logs if some thing really went wrong!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }