Author Topic: Adding available comm port to popuplist programatically  (Read 2785 times)

tacticz03@gmail.co

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Adding available comm port to popuplist programatically
« on: January 01, 2015, 07:42:52 AM »
Hi! I have a popuplist and I want to add available comm port to the list.

All I have is this,
  1. string[] ports = SerialPort.GetPortNames();
  2.                 foreach(string port in ports)
  3.                 {
  4.                         print(port);
  5.                 }
  6.  

Thanks
« Last Edit: January 01, 2015, 09:13:51 AM by tacticz03@gmail.co »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adding available comm port to popuplist programatically
« Reply #1 on: January 01, 2015, 07:20:36 PM »
Replace print(port) with "popup.items.Add(port)".

tacticz03@gmail.co

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Adding available comm port to popuplist programatically
« Reply #2 on: January 02, 2015, 03:00:42 AM »
Hi Arren! I've tried your code and it seems okay but I have some problem, when I unplug/plug my device it doesn't update the popuplist.
Need some help. Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adding available comm port to popuplist programatically
« Reply #3 on: January 02, 2015, 09:58:55 PM »
That has nothing to do with NGUI. You will need to do your own research into what kind of notification you get when you plug/unplug the device and repopulate the list accordingly.

tacticz03@gmail.co

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Adding available comm port to popuplist programatically
« Reply #4 on: January 03, 2015, 05:41:24 AM »
Okay I'll do some research and later on, if I succeed, I will jsut share it. Thanks BTW.