private void ChangeButton_Click(object sender, EventArgs e)
{
if (isAnalysed)
return;
// KFreon: Change trees
int whichgame = -1;
switch (WhichGame)
{
case 1:
whichgame = 2;
break;
case 2:
whichgame = 3;
break;
case 3:
whichgame = 1;
break;
}
ChangeTrees(whichgame);
System.Threading.Thread.Sleep(400);
if (Tree != null)
backbone.AddToBackBone(b =>
{
// KFreon: If analysed OR previous analysis failed, undo analysis and do it again
if (isAnalysed || AttemptedAnalyse)
{
for (int i = 0; i < LoadedTexes.Count; i++)
{
TPFTexInfo tex = LoadedTexes[i];
tex.UndoAnalysis(whichgame);
LoadedTexes[i] = tex;
}
// KFreon: Wait for tree changing task to begin, then analyse again.
AnalyseButton_Click(null, null);
}
return true;
});
}