Example #1
0
        public ChatWindow(userPortData userPort)
        {
            InitializeComponent();
            m_userPort = userPort;
            MainWin mainWindow = (MainWin)WindowsMgr.Instance.GetWindow(Constants.MAIN_WINDOW);

            mainWindow.setChatSessionKeyEvnt += (sender, sessionRespons) =>
            {
                Dispatcher.Invoke(() => setChatSessionKey(sessionRespons));
            };

            this.setShowChatWindowEvnt += (sender, sessionRespons) =>
            {
                Dispatcher.Invoke(() => showChatWindow(sessionRespons));
            };

            this.addLineToChatEvnt += (sender, sessionRespons) =>
            {
                Dispatcher.Invoke(() => addLineToChat(sessionRespons));
            };

            partnerNamelabel.Content = "PARTNER NAME:  " + userPort.userName;


            threadDelegate = new ThreadStart(this.startChatHandshake);
            newThread      = new Thread(threadDelegate);
            newThread.SetApartmentState(ApartmentState.STA);
            newThread.Start();
        }
Example #2
0
        public void startChatSession(int remotePort, string remoteUserName, bool isMaster)
        {
            userPortData userPort = new userPortData();

            userPort.port     = remotePort;
            userPort.userName = remoteUserName;
            userPort.isMaster = isMaster;
            openChatWindowEvnt?.Invoke(this, userPort);
        }
Example #3
0
        public void openChatSession(userPortData remoteUserData)
        {
            session chatSession = new session(ClientAllData.Instance.getMyClient().m_localPort, remoteUserData.port);

            ClientAllData.Instance.addNewSession(chatSession, remoteUserData.userName);
            if (!remoteUserData.isMaster)
            {
                session retChatSession = ClientAllData.Instance.getSession(remoteUserData.userName);
                //retChatSession.startReceving();
            }
        }
Example #4
0
 public void openChatWindow(userPortData userPort)
 {
     WindowsMgr.Instance.addWindow(Constants.CHAT_MASSAGE_WINDOW + userPort.userName, new ChatWindow(userPort));
 }