Exemplo n.º 1
0
        private bool AddLayer(LayerBuilder oNewBuilder, int iInsertIndex)
        {
            if (m_oLayers.Contains(oNewBuilder)) return false;

            if (!m_blLoadingFromView)
                oNewBuilder.Reset();

             m_oLayers.Insert(iInsertIndex, oNewBuilder);
             c_lvLayers.Items.Insert(iInsertIndex, oNewBuilder.Title);
             c_lvLayers.Items[iInsertIndex].Checked = m_oLayers[iInsertIndex].Visible;
             {
            c_lvLayers.Items[iInsertIndex].ImageIndex = c_lvLayers.SmallImageList.Images.IndexOfKey(m_oLayers[iInsertIndex].DisplayIconKey);
             }

             if (!AddLayerToGlobe(m_oLayers[iInsertIndex]))
             {
            c_lvLayers.Items[iInsertIndex].ImageIndex = c_lvLayers.SmallImageList.Images.IndexOfKey("error");
             }

             bool blSupressed = m_blSupressSelectedChanged;
             m_blSupressSelectedChanged = true;

             c_lvLayers.SelectedIndices.Clear();
             c_lvLayers.Items[iInsertIndex].Selected = true;

             m_blSupressSelectedChanged = blSupressed;
             cLayerList_SelectedIndexChanged(this, new EventArgs());

             if (ActiveLayersChanged != null) ActiveLayersChanged();

            ResizeColumn();
             CheckIsValid();

            return true;
        }