示例#1
0
        public MainForm()
        {
            InitializeComponent();
            CheckForIllegalCrossThreadCalls = false;

            client    = new Client();
            auth      = new Authorization(client);
            lobby     = new Lobby(client);
            handShake = new HandShake(client);
            game      = new Game(client);



            auth.LogIn += LogInHandler;

            lobby.RefreshClients += RefreshClientsHandler;
            lobby.Notification   += ShowNotificationHandler;

            handShake.Answer += AnswerFormHandler;
            handShake.Cancle += CancleHandler;
            handShake.Wait   += WaitHandler;

            game.Close += WaitFormClose;
            game.roomdialog.FormClosed += CloseFormHandler;
            game.Enabled += EnabledHandler;

            this.btn_refresh.Click += lobby.SendRefreshClients;
            this.btn_log_out.Click += auth.SendLogout;
            this.FormClosed        += auth.SendLogout;
        }
示例#2
0
 public AnswerForm(HandShake handShake, object arg)
 {
     InitializeComponent();
     this.handShake = handShake;
     object[] args = JsonConvert.DeserializeObject <object[]>(arg.ToString());
     label1.Text = args[0] + " приглашает вас поиграть в " + args[1];
     this.args   = args;
 }
示例#3
0
        public Listener(Client client, Authorization auth, Lobby lobby, HandShake handShake, Game game)
        {
            this.client    = client;
            this.auth      = auth;
            this.lobby     = lobby;
            this.handShake = handShake;
            this.game      = game;

            Thread listenthread = new Thread(new ThreadStart(Listen));

            listenthread.Start();
        }