Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void UpdateGUI()
        {
            #region Check size

            int i, imax = m_Scanner.deviceList.Count;
            if (imax != m_NumBtnCnnsUsed)           // Size is changed...
            {
                if (imax > m_NumBtnCnnsUsed)
                {
                    //  i-> begin of unused items.
                    for (i = m_NumBtnCnnsUsed; i < m_NumBtnCnnsInsted; ++i)              // Show the hidden items.
                    {
                        m_BtnCnns[i].Show();
                    }
                    //  i-> end of m_BtnCnns.
                    for (i = m_NumBtnCnnsInsted; i < imax; ++i)              // Instantiate the new items.
                    {
                        m_BtnCnns.Add(m_PrefabCnn.Clone(m_LayoutCnns).StartGUI(this));
                    }
                    // Update the UI layout.
                    if (m_NumBtnCnnsInsted < i)
                    {
                        if (m_UILayout != null)
                        {
                            m_UILayout.Refresh();
                        }
                    }
                    //
                    m_NumBtnCnnsInsted = i;
                }
                else
                {
                    for (i = m_NumBtnCnnsUsed - 1; i >= imax; --i)            // Hide the unused items.
                    {
                        m_BtnCnns[i].Hide();
                    }
                }
                //
                m_NumBtnCnnsUsed = imax;
            }

            #endregion Check size

            i = 0;
            for (; i < m_NumBtnCnnsUsed; ++i)
            {
                m_BtnCnns[i].UpdateGUI(m_Scanner.deviceList[i]);
            }
        }