Ejemplo n.º 1
0
 private void UpdatePropertySheet(IMapLayer layer)
 {
     if (!_layerPropertySheets.TryGetValue(layer, out UserControl sheet))
     {
         sheet = layer.GetPropertySheet();
         if (sheet == null)
         {
             foreach (var child in pnlPropertiesHolder.Controls)
             {
                 if (child is UserControl c)
                 {
                     c.Visible = false;
                 }
             }
             return;
         }
         if (!(sheet is IMapLayerPropertySheet sheet1))
         {
             MessageBox.Show($"layer returned an object that isn't an IMapLayerPropertySheet");
             return;
         }
         _layerPropertySheets.Add(layer, sheet);
         sheet1.Layer = layer;
     }
     if (pnlPropertiesHolder != sheet.Parent)
     {
         pnlPropertiesHolder.Controls.Add(sheet);
     }
     foreach (var child in pnlPropertiesHolder.Controls)
     {
         if (child is UserControl c)
         {
             c.Visible = c == sheet;
         }
     }
 }