private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var grid = sender as Grid; if (grid == null) { return; } var position = e.GetPosition(grid); var msg = new ClickedNotification() { RelativeX = position.X / grid.ActualWidth, RelativeY = position.Y / grid.ActualHeight }; Messenger.Default.Send(msg); }
private async void LocationClicked(ClickedNotification clickedLocation) { if (_Graph.Nodes.Any()) { var clickedNode = NodeFinder.FindLocation(_Graph.Nodes, clickedLocation.RelativeX, clickedLocation.RelativeY); if (clickedNode != null) { //await CalcShortestPaths(clickedNode.Id); if (_node1Clicked) { _node2Id = clickedNode.Id; await CalcShortestPaths(_node1Id, _node2Id); } else { _node1Id = clickedNode.Id; } _node1Clicked = !_node1Clicked; } } }