private void BindInput() { var txtGameName = gui.GetChild <TextBlock>("txtGameName"); var btnCreate = gui.GetChild <Button>("btnCreate"); var creatingMessage = gui.GetChild <TextBlock>("creatingMessage"); if (creatingMessage != null) { creatingMessage.Enabled = false; } if (txtGameName != null) { defaultText = txtGameName.Text; txtGameName.Triggered += (b) => Guide.BeginShowKeyboardInput(PlayerIndex.One, "Game Name", "Enter the name for the game.", gameName, KBCallback, null); } if (btnCreate != null) { btnCreate.Triggered += (b) => { if (!string.IsNullOrWhiteSpace(gameName)) { if (creatingMessage != null) { creatingMessage.Enabled = true; } btnCreate.Enabled = false; api.CreateGameAndJoin(gameName, player.Id, new Action <CreateGameAndJoinResponse, Exception>( (r, e) => { if (e == null && r.Ok) { api.GetMap(r.Game.MapId, new Action <GetMapResponse, Exception>( (mr, me) => { if (me == null && mr.Ok) { var scr = Manager.GetOrCreateScreen <GameScreen>(); scr.Init(api, player, r.Game, Map.FromStringRepresentation(r.Game.MapId, mr.Map)); Manager.TransitionTo <GameScreen>(); } else { Guide.BeginShowMessageBox("Error", me == null ? mr.Message : me.Message, new string[] { "Ok" }, 0, MessageBoxIcon.Error, null, null); } btnCreate.Enabled = true; if (creatingMessage != null) { creatingMessage.Enabled = false; } })); } else { Guide.BeginShowMessageBox("Error", e == null ? r.Message : e.Message, new string[] { "Ok" }, 0, MessageBoxIcon.Error, null, null); btnCreate.Enabled = true; if (creatingMessage != null) { creatingMessage.Enabled = false; } } })); } }; } }