internal void UpdateMapData(MapData mapData) { this.mapData = mapData; DrawNet(); curProp = null; foreach (var item in layerList) { Children.Remove(item); } layerList.Clear(); Layer l; foreach (var item in mapData.LayerDataList) { l = new Layer() { Name = item.Name}; layerList.Add(l); Children.Add(l); } }
private void OnListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = (sender as ListBox).SelectedItem; if (item != null) { if (prop != null) { canvas.Children.Remove(prop); prop.MouseLeftButtonDown -= Prop_MouseDown; prop.MouseMove -= Prop_MouseMove; prop.MouseLeftButtonUp -= Prop_MouseUp; prop = null; } if (item is FloorTypeData) { prop = new Floor(item as FloorTypeData); } else if (item is BuildingTypeData) { prop = new Building(item as BuildingTypeData); } if (prop != null) { canvas.Children.Add(prop); prop.MouseLeftButtonDown += Prop_MouseDown; prop.MouseMove += Prop_MouseMove; prop.MouseLeftButtonUp += Prop_MouseUp; offsetXNumericUpDown.Value = prop.GetData().OffsetX; offsetYNumericUpDown.Value = prop.GetData().OffsetY; prop.SetRowAndCol(0, 0, coordinateHelper); DrawUndersideNet(); } } }