private void client_SessionRequest(DCN.TicTacToe.Client.Client client, TicTacToe.Client.EventArguments.SessionRequestEventArguments args) { this.InvokeUI(() => { SkinRequestSession frmRequestSession = new SkinRequestSession(); this.pnl_Notify.Controls.Add(frmRequestSession); frmRequestSession.BringToFront(); this.pnl_Notify.BringToFront(); frmRequestSession.ActionForm += (option) => { if (option == Options.YES) { //TODO: Send to table game this.pnl_GamePlay.Visible = true; this.pnl_GamePlay.BringToFront(); this.btn_Already.Visible = true; this.pnl_PlayerArea_2.Visible = true; Debug.WriteLine("Yes"); args.Confirm(); } else { Debug.WriteLine("No"); args.Refuse(); } this.pnl_Notify.SendToBack(); }; //wait client choose action //while (!frmRequestSession.IsAction) { System.Threading.Thread.Sleep(100); } }); }
public Frm_Index() { client = new DCN.TicTacToe.Client.Client(); InitializeComponent(); this.pnl_Index.BringToFront(); this.pnl_MsgChat_1.Visible = false; this.pnl_MsgChat_2.Visible = false; this.btn_Already.Visible = false; ConnectToServer(); client.SessionRequest += client_SessionRequest; client.SessionEndedByTheRemoteClient += Client_SessionEndedByTheRemoteClient; client.TextMessageReceived += Client_TextMessageReceived; client.UpdateTablesInProcess += Client_UpdateTablesInProcess; client.EnablePlayRequest += Client_EnablePlayRequest; client.UpdateCountDown += Client_UpdateCountDown; client.InitGame += Client_InitGame; client.GameRequest += Client_GameRequest; client.TimeOutRequest += Client_TimeOutRequest; client.GameResponse += Client_GameResponse; client.AutoAccepInvite += Client_AutoAccepInvite; this.timerReqMesgChat = new Timer(); this.timerReqMesgChat.Interval = 3000; this.timerReqMesgChat.Tick += timerReqMesgChat_Tick; this.timerReceMesgChat = new Timer(); this.timerReceMesgChat.Interval = 3000; this.timerReceMesgChat.Tick += timerReceMesgChat_Tick; this.pnl_GameBoard.Enabled = false; InitShowForStart(); }