private void menuLayer_Click(object sender, RoutedEventArgs e) { frmLayerForm ld = new frmLayerForm(DrawArea.TheLayers); ld.ShowDialog(); bool Visible = false; for (int i = 0; i < ld.layerList.Count; i++) { if (ld.layerList[i].LayerNew) { Layer layer = new Layer(); layer.LayerName = ld.layerList[i].LayerName; layer.Graphics = new GraphicsList(); DrawArea.TheLayers.Add(layer); } } DrawArea.TheLayers.InactivateAllLayers(); string ActiveLayerName = ""; for (int i = 0; i < ld.layerList.Count; i++) { if (ld.layerList[i].LayerActive) { DrawArea.TheLayers.SetActiveLayer(i); ActiveLayerName = ld.layerList[i].LayerName; if (ld.layerList[i].LayerVisible) { Visible = true; } else { Visible = false; } } if (ld.layerList[i].LayerVisible) { DrawArea.TheLayers.MakeLayerVisible(i); } else { DrawArea.TheLayers.MakeLayerInvisible(i); } DrawArea.TheLayers[i].LayerName = ld.layerList[i].LayerName; } for (int i = 0; i < ld.layerList.Count; i++) { if (ld.layerList[i].LayerDelete) { DrawArea.TheLayers.RemoveLayer(i); } } DrawArea.Invalidate(); menuLayer.Header = ActiveLayerName; if (Visible) { menuLayer.Icon = new System.Windows.Controls.Image { Source = new BitmapImage(new Uri("../../Resources/Images/Visible.png", UriKind.Relative)) }; } else { menuLayer.Icon = new System.Windows.Controls.Image { Source = new BitmapImage(new Uri("../../Resources/Images/InVisible.png", UriKind.Relative)) }; } }