private void FindPlayer_ActionForm(SkinFrmFindPlayer frmFind, string data) { if (data.Equals("")) { this.pnl_Notify.SendToBack(); return; } foreach (Control ctr in flp_ShowTableGame.Controls) { if (ctr is Button) { if (ctr.Text.Equals(data) || ctr.Tag.Equals(data)) { (ctr as Button).PerformClick(); frmFind.Dispose(); this.pnl_Notify.SendToBack(); return; } } } client.RequestSession(data, (senderClient, args) => { if (args.IsConfirmed) { Status("Session started with " + data); InvokeUI(() => { Debug.WriteLine("Session started with " + data); //TODO: Create table and come to the game. frmFind.Dispose(); this.pnl_Notify.SendToBack(); this.pnl_GamePlay.Visible = true; this.pnl_GamePlay.BringToFront(); this.btn_Already.Visible = true; this.pnl_PlayerArea_2.Visible = true; }); } else { this.InvokeUI(() => { if (args.Exception.Message.Contains("exist")) { frmFind.Message = "notExist"; } else { frmFind.Message = "decline"; } Debug.WriteLine(args.Exception); }); } }); }
private void btn_ConnectToPlayer_Click(object sender, EventArgs e) { SkinFrmFindPlayer findPlayer = new SkinFrmFindPlayer(); findPlayer.ActionForm += FindPlayer_ActionForm; this.pnl_Notify.Controls.Add(findPlayer); findPlayer.BringToFront(); this.pnl_Notify.BringToFront(); }