private void OpenReceiver(ushort port) { // Update port list if (!receivePorts.Contains(port)) { receivePorts.Add(port); receivePorts.Sort(); } toolStripMenuItemReceivePort.DropDownItems.Clear(); foreach (ushort p in receivePorts) { toolStripMenuItemReceivePort.DropDownItems.Add(p.ToString()); } toolStripMenuItemReceivePort.DropDownItems.Add("..."); // Check selected port foreach (ToolStripMenuItem toolStripMenuItem in toolStripMenuItemReceivePort.DropDownItems) { if (toolStripMenuItem.Text == port.ToString()) { toolStripMenuItem.Checked = true; } } // Open reciever if (m_Receiver != null) { m_Receiver.Close(); } if (m_Thread != null) { m_Thread.Join(); } m_Listener = new OscListenerManager(); m_Receiver = new OscReceiver(port); m_Thread = new Thread(new ThreadStart(ListenLoop)); m_Receiver.Connect(); m_Thread.Start(); }
private void OpenReceiver(ushort port) { // Update port list if (!receivePorts.Contains(port)) { receivePorts.Add(port); receivePorts.Sort(); } toolStripMenuItemReceivePort.DropDownItems.Clear(); foreach (ushort p in receivePorts) { toolStripMenuItemReceivePort.DropDownItems.Add(p.ToString()); } toolStripMenuItemReceivePort.DropDownItems.Add("..."); // Check selected port foreach (ToolStripMenuItem toolStripMenuItem in toolStripMenuItemReceivePort.DropDownItems) { if (toolStripMenuItem.Text == port.ToString()) { toolStripMenuItem.Checked = true; } } // Open reciever if (m_Receiver != null) { m_Receiver.Close(); } if (m_Thread != null) { m_Thread.Join(); } m_Listener = new OscListenerManager(); m_Receiver = new OscReceiver(port); m_Thread = new Thread(new ThreadStart(ListenLoop)); m_Receiver.Connect(); m_Thread.Start(); }