private void Server_ForwardedPortAdded(object sender, ForwardedPortEventArgs e) { if (InvokeRequired) { Invoke(new EventHandler <ForwardedPortEventArgs>(Server_ForwardedPortAdded), new[] { sender, e }); return; } forwardedPortsListBox.Items.Add(e.ForwardedPort); sourceTextBox.Text = string.Empty; destinationTextBox.Text = string.Empty; }
private void Server_ForwardedPortRemoved(object sender, ForwardedPortEventArgs e) { if (InvokeRequired) { Invoke(new EventHandler <ForwardedPortEventArgs>(Server_ForwardedPortRemoved), new[] { sender, e }); return; } forwardedPortsListBox.Items.Remove(e.ForwardedPort); sourceTextBox.Text = e.ForwardedPort.ListenEndPoint; destinationTextBox.Text = e.ForwardedPort.ConnectEndPoint; (e.ForwardedPort.Direction == ForwardDirection.Local ? localRadioButton : remoteRadioButton).Checked = true; if (CloseInProgress && forwardedPortsListBox.Items.Count == 0) { Close(); } }