private void UI_FileList_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode selected = UI_FileList.SelectedNode; if (selected != null) { // Clean up previous excursions. TerminateRunners(); // Terminate runners that be running. if (canvas != null) canvas.Dispose(); canvas = null; overlay.ClearPoints(); UI_PreviewStatus.Hide(); UI_Map.Invalidate(); UI_ExportButton.Enabled = true; UI_ExportImageButton.Enabled = true; drawOffsetX = lastOffsetX = 0; drawOffsetY = lastOffsetY = 0; // Detatch mouse control (this shouldn't ever be an issue, really). isMovingMap = false; string mapName = selected.Text; selectedMapName = mapName; tileTotal = maps[mapName].Count; tileDone = 0; UI_TileDisplay.Text = string.Format(Constants.MAP_VIEWER_TILE_STATUS, 0, 0); UI_TileDisplay.Show(); UI_ExportTip.Hide(); buildRunner = new RunnerBuildMinimap(maps[mapName].ToArray()); buildRunnerIndex = buildRunner.Index; buildRunner.Begin(); } }
private void TerminateRunners() { if (buildRunner != null) { buildRunner.Kill(); buildRunner = null; } }