Esempio n. 1
0
        public MainWindow(int m_type)
        {
            InitializeComponent();

            ChessBoardMain.m_TypePlay = m_type;

            ChatMain.m_TypePlay = m_type;

            ChessBoardMain.m_NameHuman = ChatMain.m_NameHuman;

            m_TypePlay = m_type;

            if (StartGame != null)
            {
                StartGame(m_TypePlay);
            }

            ChatMain.ChatWeCome(m_TypePlay);
            ChessBoardMain.message_changed   += OnShowMessage; // Sự kiện Nhận nt online
            ChatMain.ChangeName_changed      += OnChangeName;  // Sự kiện thay đổi tên
            ChatMain.SenMessageSever_changed += OnSentMessage; // sự kiện gởi tn online
            ChessBoardMain.Exit_changed      += OnExitGame;    // Thoát khi kết thúc màn chơi

            FrmPause.exitGame += OnExitGame;                   // sự kiện thoát game
            FrmPause.newGame  += OnNewGame;                    // sự kiện new game
        }
Esempio n. 2
0
        //=========================================

        public BlindChat(uint _UserID, ref ChatMain UI, MainForm form)
        {
            this.form = form;

            this._UserID = _UserID;
            UI.BlindChat = this;
            UI.UserID    = _UserID;
            UI._RoomControl.SetBlindChat(this);

            this.UI = UI;
            DB      = new BlindChatDB(this._UserID);
        }
Esempio n. 3
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            VPNClass = new VPN_Class();
            //클라이언트 cid 서버로부터 받아오기
            //ClientID = "test1";
            string SendMsg = ClientID + "," + isInner;                             //아이디 + 내부 외부 보내서 외부면 vpn로그남김 (isInner bool형. 디버그했을때 실질적인 값 : true -> "True" | false -> "False")

            byte[] SendStringToByteGender = Encoding.UTF8.GetBytes(SendMsg);       // String -> bytes 변환
            mainSocket.CryptoSend(SendStringToByteGender, PacketType.Response);    //서버로 클라이언트 id 보냄
            blindClientCidPacket = mainSocket.CryptoReceive();                     // 서버로부터 cid받아옴
            byte[] data = BlindNetUtil.ByteTrimEndNull(blindClientCidPacket.data); // 넑값 지움
            byte[] tmp  = new byte[4];
            Array.Copy(data, 0, tmp, 0, data.Length);
            uint ClintCID = BitConverter.ToUInt32(tmp, 0);

            if (ClintCID == 0) //서버에서 아이디를 조회못했을때 0반환
            {
                MessageBox.Show("서버로부터 id를 받지 못하였거나 등록되지 않은 아이디입니다." + Environment.NewLine + "\t           관리자에게 문의하십시요.");
                mainSocket.Close();
                Application.Exit();
                return;
            }

            //각 기능 객체 및 Task 생성
            TaskScheduler scheduler = TaskScheduler.Default;

            token = new CancellationTokenSource();

            documentCenter = new Doc_Center(document_Center, isInner);
            documentCenter.Run();
            document_Center.docCenter = documentCenter;

            _ChatMain      = new ChatMain(ClintCID);
            _ChatMain.Dock = DockStyle.Fill;
            MainControlPanel.Controls.Add(_ChatMain);

            //Func
            chat  = new BlindChat(ClintCID, ref _ChatMain, this);
            tChat = Task.Factory.StartNew(() => chat.Run(), token.Token, TaskCreationOptions.LongRunning, scheduler);

            //ScreenLocking
            lockForm = new LockForm(isInner, ClientID);
            lockForm.connect();
            MessageBox.Show("락 연결!");

            deviceDriver  = new DeviceDriverHelper();
            tDeviceDriver = Task.Factory.StartNew(() => deviceDriver.Run(), token.Token, TaskCreationOptions.LongRunning, scheduler);
        }
Esempio n. 4
0
 private void OnShowMessage(string message, string namePlayer2)
 {
     ChatMain.ShowChat(message, namePlayer2);
 }