コード例 #1
0
        public buble(string name, string message, string time, MessageType messageType, ChatClientControl chatClient)
        {
            InitializeComponent();
            lblUser.Text    = name;
            lblMessage.Text = message;
            lblTime.Text    = time;
            this.chatClient = chatClient;

            if (messageType.ToString() == "Out")
            {
                this.BackColor = Color.FromArgb(38, 166, 154);
            }
            else if (messageType.ToString() == "In")
            {
                this.BackColor = Color.Gray;
            }

            else if (messageType.ToString() == "OutFile")
            {
                lblMessage.ContextMenuStrip = cmsDownload;
                lblMessage.Font             = new Font(lblMessage.Font.Name, lblMessage.Font.Size, FontStyle.Underline);
                lblMessage.ForeColor        = Color.FromArgb(0, 96, 100);
                this.BackColor = Color.LightGray;
            }
            else
            {
                lblMessage.ContextMenuStrip = cmsDownload;
                lblMessage.Font             = new Font(lblMessage.Font.Name, lblMessage.Font.Size, FontStyle.Underline);
                lblMessage.ForeColor        = Color.FromArgb(0, 96, 100);
                this.BackColor = Color.LightGray;
            }
            SetHeight();
        }
コード例 #2
0
ファイル: frmCreateRoom.cs プロジェクト: SinJunior/ChatsApp
 public frmCreateRoom(ChatClientControl chatClient, string fullname, string username, List <string> users)
 {
     InitializeComponent();
     this.chatClient = chatClient;
     this.fullname   = fullname;
     this.username   = username;
     this.listUser   = users;
     addListBox      = new AddListBox(AddListBoxMethod);
 }
コード例 #3
0
ファイル: chatbox.cs プロジェクト: SinJunior/ChatsApp
 public chatbox(ChatClientControl chatClient, string username, string messageType, string fullname, string toUser)
 {
     InitializeComponent();
     _box             = this;
     this.chatClient  = chatClient;
     this.username    = username;
     this.messageType = messageType;
     this.fullname    = fullname;
     this.toUser      = toUser;
     oldBuble.Top     = 0 - oldBuble.Height + 10;
     buble1.Visible   = false;
     buble2.Visible   = false;
     getRoomName();
     addMessage    = new AddMessage(AddMessageMethod);
     addOneMessage = new AddOneMessage(AddOneMessageMethod);
 }
コード例 #4
0
ファイル: Register.cs プロジェクト: SinJunior/ChatsApp
        public void connect(string hostAddress, int iPort)
        {
            try
            {
                this.chatClient = new ChatClientControl();
                if (this.chatClient.connect(hostAddress, iPort))
                {
                    ChatJoinObject chatJoin = new ChatJoinObject();

                    chatJoin.Username = this.user;
                    this.chatClient.sendDataObject(chatJoin);
                }
            }
            catch (Exception)
            {
                lblWarning.Text = "Kết nối tới máy chủ thất bại!";
                isConnect       = false;
            }
        }
コード例 #5
0
        public void connect(string hostAddress, int iPort)
        {
            try
            {
                this.chatClient = new ChatClientControl();
                if (this.chatClient.connect(hostAddress, iPort))
                {
                    ChatJoinObject chatJoin = new ChatJoinObject();

                    chatJoin.Username = this.username;
                    this.chatClient.sendDataObject(chatJoin);

                    ThreadStart threadStart = new ThreadStart(runRecvData);
                    Thread      thread      = new Thread(threadStart);

                    thread.IsBackground = true;
                    thread.Start();

                    threadStart = new ThreadStart(sendRefresh);
                    thread      = new Thread(threadStart);

                    thread.IsBackground = true;
                    thread.Start();

                    threadStart = new ThreadStart(sendLoadMessage);
                    thread      = new Thread(threadStart);

                    thread.IsBackground = true;
                    thread.Start();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }