private void BuildConnectionManagerToDos(Package package, ListView lvwConnMgrs, bool bIncremental, bool bRescan, ConnectionManager oIncrementalConnectionManager)
 {
     foreach (ListViewItem lviConn in lvwConnMgrs.Items)
     {
         ConnectionManager conn = lviConn.GetType().InvokeMember("Component", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty, null, lviConn, null) as ConnectionManager;
         if (conn == null) continue;
         ConnectionManagerHighlightingToDo todo;
         lock (highlightingToDos)
         {
             if (highlightingToDos.ContainsKey(conn))
                 todo = (ConnectionManagerHighlightingToDo)highlightingToDos[conn];
             else
                 highlightingToDos.Add(conn, todo = new ConnectionManagerHighlightingToDo());
             todo.package = package;
             todo.connection = conn;
             todo.listConnectionLVIs.Add(lviConn);
             todo.BackgroundOnly = false;
             todo.Rescan = (conn == oIncrementalConnectionManager) || bRescan;
         }
     }
     if (lvwConnMgrs.Tag == null)
     {
         lvwConnMgrs.DrawItem += new DrawListViewItemEventHandler(lvwConnMgrs_DrawItem);
         lvwConnMgrs.OwnerDraw = true; //forces the DrawItem event to fire so that we can detect when we need to fix the icon
         lvwConnMgrs.Tag = true;
     }
 }
        private void BuildConnectionManagerToDos(Package package, Control lvwConnMgrs, bool bIncremental, bool bRescan, ConnectionManager oIncrementalConnectionManager)
        {
            ConnectionManagerUserControl cmControl = (ConnectionManagerUserControl)lvwConnMgrs.GetType().InvokeMember("m_connectionManagerUserControl", System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, lvwConnMgrs, null);
            ConnectionManagersModelElement conns = (ConnectionManagersModelElement)lvwConnMgrs.GetType().InvokeMember("m_connectionsElement", System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, lvwConnMgrs, null);

            if (cmControl != null && conns != null)
            {
                foreach (ConnectionManagerModelElement lviConn in conns)
                {
                    System.Windows.FrameworkElement fe = (System.Windows.FrameworkElement)cmControl.GetViewFromViewModel(lviConn);
                    if (fe == null) continue; //guess the framework element isn't loaded yet?
                    ConnectionManager conn = lviConn.ConnectionManager;
                    if (conn == null) continue;
                    ConnectionManagerHighlightingToDo todo;
                    lock (highlightingToDos)
                    {
                        if (highlightingToDos.ContainsKey(conn))
                            todo = (ConnectionManagerHighlightingToDo)highlightingToDos[conn];
                        else
                            highlightingToDos.Add(conn, todo = new ConnectionManagerHighlightingToDo());
                        todo.package = package;
                        todo.connection = conn;
                        todo.listConnectionLVIs.Add((System.Windows.FrameworkElement)cmControl.GetViewFromViewModel(lviConn));
                        todo.BackgroundOnly = false;
                        todo.Rescan = (conn == oIncrementalConnectionManager) || bRescan;
                    }
                }
            }
        }