public void SetPort(int port) { MyPort = port; Invoke(new Action( () => { Text = $"Port: {port}"; SetLabel($"Port: {port}"); listeningForDataToolStripMenuItem.Checked = true; })); WaitHandle?.Dispose(); WaitHandle = CommunicationHelper.LetDudeKnowWereListeningOnSomePort(Process.GetCurrentProcess().Id); }