RobotStudio event

How to display ListView (Logs) from DotNet (C#) Method

Hi!

I am trying to develop a Screenmaker application for the flexpendant. One requirement is to display all errors in a ListView, which the user is able to modify (delete, deleteAll etc.) The default LogView from the flexpendant is not an option, since it should display only the errors by default (and it should be accessible from our custom application).

I am using a button, which will trigger a DotNet Method. This method should display a ListView on the flexpendant.
Here is my current DotNet method, which should display a ListView on the Flexpendant:

        public static void ShowErrors()
        {           
            NetworkScanner ns = new NetworkScanner();
            ns.Scan();
            ControllerInfo[] listofcontrollerInfos = ns.GetControllers();
            m_Controller = ControllerFactory.CreateFrom(listofcontrollerInfos[0]);
            EventLogCategory[] _cats = m_Controller.EventLog.GetCategories();
            ListView listView = new ListView();

            ListViewItem _item = null;
            foreach (EventLogCategory _cat in _cats)
            {
                foreach (EventLogMessage _msg in _cat.Messages)
                {
                    _item = new ListViewItem(_msg.SequenceNumber.ToString());
                    _item.SubItems.Add(_msg.Number.ToString());
                    _item.SubItems.Add(_msg.Title);
                    listView.Items.Add(_item);

                }
            }
            listView.Show();
        }<br>
  1.  Is this the correct way on how to connect to the local controller? I didn't want to use the PC SDK but I saw no other option.
  2. The listView.Show(); does nothing. I know that some logs where found but the listVIew is not shown on the flexpendant.


Here are some other issues I found while devolping the application:
  1. Is there a way to add a linebreak in a button without modifing it's size? didn't work.
  2. Why is the SelectedIndexChaned event for a combobox not triggered with the most recent index, but the previous one? We had to use an ActionTrigger to get the current index.

Thank you very much!!

Answers