public void CanvasClicked(MouseButtonEventArgs e) { /* TODO: SOME HOW CHECK WHAT WAS CLICKED ON */ /* CHECK TO SEE IF A SHAPE HAS BEEN CLICKED ON OR THE CANVAS ITS SELF */ if (e.Source.GetType() != typeof(Canvas)) { CanvasElementType selectedCanvasType = MainData.GetShapeType((Shape)e.Source); if (oldSelectedCanvasElement != null) { switch (oldSelectedCanvasElementType) { case CanvasElementType.CLUSTER: { oldSelectedCanvasElement.Stroke = Brushes.Black; Canvas.SetZIndex(oldSelectedCanvasElement, 0); break; } } } switch (selectedCanvasType) { case CanvasElementType.CLUSTER: { Galaxy galaxy = MainData.GetGalaxyMap(); Cluster selectedCluster = ((List<Cluster>)galaxy.Clusters).Find(s => s.UId == (Guid)((Polygon)e.Source).Tag); oldSelectedCanvasElement = selectedCluster.Polygon; oldSelectedCanvasElementType = CanvasElementType.CLUSTER; /* SHOW A HIGHLIGHT AROUND THE SELECTED CLUSTER */ selectedCluster.Polygon.Stroke = Brushes.Yellow; Canvas.SetZIndex(selectedCluster.Polygon, 1); //MainData.UpdateCanvas(); RightHandViewModel = new SectorEditViewModel(selectedCluster); break; } } } else { RightHandViewModel = new GalaxyEditViewModel(galaxy); } }