private void cONDITIONToolStripMenuItem_Click(object sender, EventArgs e) { var move = new UcTurn(this); move.Location = new Point(20, codeIndex); codeCore.Controls.Add(move); Codes.Add(move); codeIndex += UcTurn.Height; }
private void LoadPlayGame(PlayGameModel playGameModel) { try { //if (!Helper.Confirm("Do you need to load the game")) // return; ClearCode(); var gameCodes = playGameModel.GameCodes.OrderBy(p => p.Order).ToList(); for (var i = 0; i < gameCodes.Count; i++) { var item = gameCodes[i]; var movex = new UserControl(); if (item.CodeType == UcMoveForward.Identify) { movex = new UcMoveForward(this) .SetPayload(item.Payload.ToObject <Statement>()); codeIndex += UcMoveForward.Height; } else if (item.CodeType == UcTurn.Identify) { movex = new UcTurn(this).SetPayload(item.Payload.ToObject <Turn>()); codeIndex += UcTurn.Height; } else if (item.CodeType == UCLoop2.Identify) { movex = new UCLoop2(this).SetPayload(item.Payload.ToObject <Loop2>()); codeIndex += UCLoop2.Height; } else if (new List <int> { UcLoop.Identify, UcFunction.Identify }.Contains(item.CodeType)) { continue; } else { continue; } movex.Location = new Point(10, codeIndex); codeCore.Controls.Add(movex); Codes.Add(movex); } } catch (Exception exception) { new ExceptionHandler(exception); } }