private void UnsubscribeEvent_IPathFinderWithPathScoring(IPathFinderWithPathScoring PathFinder) { if (PathFinder != null) { PathFinder.OpenNodeListItemAdded -= HandleEvent_PathFinderOpenNodeListItemAdded; PathFinder.OpenNodeListItemRemoved -= HandleEvent_PathFinderOpenNodeListItemRemoved; PathFinder.CloseNodeListItemAdded -= HandleEvent_PathFinderCloseNodeListItemAdded; PathFinder.CloseNodeListItemRemoved -= HandleEvent_PathFinderCloseNodeListItemRemoved; } }
private void rdoAlgorithm_CheckedChanged(object sender, EventArgs e) { Draw_BuildImageOfIMap(); UnsubscribeEvent_IPathFinderWithPathScoring(PathFinder); if (rdoAStar.Checked) { PathFinder = PathFinderUsingAStar.Instance; } else if (rdoJPS.Checked) { PathFinder = PathFinderUsingJumpPointSearch.Instance; } SubscribeEvent_IPathFinderWithPathScoring(PathFinder); }