Example #1
0
        private async void startBtn_Click(object sender, EventArgs e)
        {
            IPAddress iPAddress;

            if (ipAddressInput.Text.Trim() == String.Empty || !IPAddress.TryParse(ipAddressInput.Text, out iPAddress))
            {
                MessageBox.Show("Please enter valid ip4 address");
                return;
            }

            _server          = new ServerInstance(ipAddressInput.Text);
            startBtn.Enabled = false;
            stopBtn.Enabled  = true;

            try
            {
                statusLabel.Text = "Started listenning";
                await _server.StartListeningAsync(_notifyIcon);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }