private void node_PreviewMouseMove(object sender, MouseEventArgs e) { if (Mouse.LeftButton == MouseButtonState.Pressed) { Node node = (sender as UnweightedNodeControl).Node; if (node == lastChangedNode) { return; } lastChangedNode = node; if (node.IsStartNode || node.IsEndNode) { return; } else if (!node.IsWall) { node.MakeWall(); } else { node.RemoveWall(); } } }
private void Node_MouseDown(object sender, MouseButtonEventArgs e) { Node node = (sender as UnweightedNodeControl).Node; if (isEndNodeSelecting == true) { isEndNodeSelecting = false; EnableInteractiveButtons(); viewModel.SelectEndNode(node); } else if (isStartNodeSelecting == true) { isStartNodeSelecting = false; EnableInteractiveButtons(); viewModel.SelectStartNode(node); } else { if (node.IsWall) { node.RemoveWall(); } else if (node.IsEndNode || node.IsStartNode) { return; } else { node.MakeWall(); } } }