private void LoginCompletionMethod(PDAuthentificationResp resp, bool canceled, Exception e, AsyncOperation asyncOp)
 {
     LoginCompletedEventArgs args = new LoginCompletedEventArgs(resp,e, canceled, asyncOp.UserSuppliedState);
     args.Client = instance;
     asyncOp.PostOperationCompleted(onCompletedLoginDelegate, args);
 }
        void LoginTerminier(object o, LoginCompletedEventArgs arg)
        {
            Console.WriteLine(arg);
            try
            {
                if (arg.Reponse.Succeded)
                {
                    MainForm mainform = MainForm.GetInstance();
                    mainform.LocalPlayer = new Player();
                    mainform.LocalPlayer.Login = arg.Reponse.PlayerName;
                    mainform.LocalPlayer.Id = (int)arg.Reponse.PlayerID;
                    mainform.LocalPlayer.Score = arg.Reponse.PlayerScore;
                    mainform.SudokuClient = arg.Client;
                    mainform.SudokuClient.PDReceivedEvent += new PDReceivedEventHandler(PacketRecu);
                    mainform.SudokuClient.ClientResetConnectionEvent += new ClientResetConnectionEventHandler(SudokuClient_ClientResetConnectionEvent);
                    mainform.SudokuClient.waitForPD();
                    mainform.Phase = MainFormPhase.Starting;

                    mainform.SudokuClient.sendPacket(new PDListOfPlayerRequest((uint)mainform.LocalPlayer.Id));

                }
                else
                {
                    try
                    {
                        MainForm.GetInstance().SudokuClient.ClientSocket.Close();
                    }
                    catch { ;}

                    MessageBox.Show("Mauvais login ou password");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.InnerException.Message);
            }
        }