Esempio n. 1
0
        private void Frame_Load(object sender, EventArgs e)
        {
            this.lbUserName.Text    = User.firstName + " " + User.lastName;
            this.pbUserAvatar.Image = ChatAppUtils.ByteToImage(User.avatar);

            PnlConversation1.AutoScroll    = false;
            PnlConversation2.AutoScroll    = false;
            PnlConversation1.WrapContents  = false;
            PnlConversation2.WrapContents  = false;
            PnlConversation1.AutoSize      = true;
            PnlConversation2.AutoSize      = true;
            PnlConversation1.FlowDirection = FlowDirection.TopDown;
            PnlConversation2.FlowDirection = FlowDirection.BottomUp;
            pnlConversations.flowLayoutPanel.Controls.Add(PnlConversation2);
            pnlConversations.flowLayoutPanel.Controls.Add(PnlConversation1);
            pnlConversations.UpdateUi();

            this.pnlPages.Controls.Clear();
            WelcomeBox welcomeBox = new WelcomeBox(User);

            this.pnlPages.Controls.Add(welcomeBox);
            welcomeBox.BtnconversationClick(btnAddNewChat_Click);
            welcomeBox.Location = new Point(0, 0);
            Client.startReadResponse(new ReadResponseHandler(this));
        }
Esempio n. 2
0
        private void initUi()
        {
            unReadMessage.Visible = false;
            if (!Cvst.state && Cvst.memberList.Count == 2)
            {
                this.btnState.FillColor = System.Drawing.Color.LightSteelBlue;
            }
            if (Cvst.creatorId != Acc.id && Cvst.memberList.Count == 2)
            {
                foreach (var mb in Cvst.memberList)
                {
                    if (mb.id == Cvst.creatorId)
                    {
                        this.lbTitle.Text   = mb.firstName + " " + mb.lastName;
                        this.pbAvatar.Image = ChatAppUtils.ByteToImage(mb.avatar);
                        break;
                    }
                }
            }
            else
            {
                this.lbTitle.Text = Cvst.title;
                if (Cvst.avatar != null)
                {
                    this.pbAvatar.Image = ChatAppUtils.ByteToImage(Cvst.avatar);
                }
            }
            DateTime time = (DateTime)Cvst.createdAt;

            this.lbDate.Text = time.ToString("HH:mm dd/MM/yyyy");
        }
Esempio n. 3
0
 public SearchResult(Account acc)
 {
     InitializeComponent();
     Account             = acc;
     this.pbAvatar.Image = ChatAppUtils.ByteToImage(acc.avatar);
     this.lbInfo.Text    = acc.email;
     this.lbTitle.Text   = acc.firstName + " " + acc.lastName;
 }
 public IncomingMessage(byte[] avatar, int userId, string userName, DateTime time)
 {
     InitializeComponent();
     UList  = new List <UserControl>();
     Time   = time;
     UserId = userId;
     this.userAvatar.Image = ChatAppUtils.ByteToImage(avatar);
     this.info.Text        = userName + " - " + Time.ToString("HH:mm dd/MM/yyyy");
 }
Esempio n. 5
0
 private void Setting_Load(object sender, EventArgs e)
 {
     this.pbAvatar.Image  = ChatAppUtils.ByteToImage(form.User.avatar);
     this.lbFullName.Text = form.User.firstName + " " + form.User.lastName;
     this.lbEmail.Text    = form.User.email;
     if (form.User.birthday != null)
     {
         DateTime birthday = (DateTime)form.User.birthday;
         this.lbBirthday.Text = birthday.ToString("dd/MM/yyyy");
     }
     else
     {
         this.lbBirthday.Text = "Thêm ngày sinh";
     }
 }
Esempio n. 6
0
 public void SuccessUpdate(Account acc)
 {
     if (Setting != null)
     {
         Setting.lbEmail.Text    = acc.email;
         Setting.lbFullName.Text = acc.firstName + " " + acc.lastName;
         if (acc.birthday != null)
         {
             DateTime birthday = (DateTime)acc.birthday;
             Setting.lbBirthday.Text = birthday.ToString("dd/MM/yyyy");
         }
         Setting.pbAvatar.Image = ChatAppUtils.ByteToImage(acc.avatar);
     }
     this.pbUserAvatar.Image = ChatAppUtils.ByteToImage(acc.avatar);
     this.lbUserName.Text    = acc.firstName + " " + acc.lastName;
 }
Esempio n. 7
0
        private void btnChangeAvatar_Click(object sender, EventArgs e)
        {
            OpenFileDialog choosePictureDialog = new OpenFileDialog()
            {
                Filter = "Image files (*.png;*.jpg;*.jpeg;*.gif) | *.png;*.jpg;*.jpeg;*.gif",
                Title  = "Chọn một file ảnh"
            };

            choosePictureDialog.ShowDialog();
            if (!choosePictureDialog.FileName.Equals(""))
            {
                Avatar = ChatAppUtils.ConvertFileToByte(choosePictureDialog.FileName);
                string[] arrFileName = choosePictureDialog.FileName.Split('\\');
                AvatarName          = arrFileName[arrFileName.Length - 1];
                pbGroupAvatar.Image = ChatAppUtils.ByteToImage(Avatar);
            }
        }
Esempio n. 8
0
        public FileItem(string fileName, byte[] file)
        {
            File     = file;
            FileName = fileName;
            InitializeComponent();
            string[] arrFileName = fileName.Split('.');
            string   ex          = arrFileName[arrFileName.Length - 1].ToUpper();

            if (ex.Equals("JPG") || ex.Equals("JPEG") || ex.Equals("PNG") || ex.Equals("GIF"))
            {
                this.file.Size     = new Size(120, 90);
                this.file.Location = new Point(5, 5);
                this.file.Image    = ChatAppUtils.ByteToImage(File);
                this.file.SendToBack();
                this.lbFileName.Visible = false;
                this.lbFileSize.Visible = false;
            }
            else
            {
                this.lbFileName.Text = FileName;
                this.lbFileSize.Text = getFileSize(File);
            }
        }
Esempio n. 9
0
 public FileBubble(string fileName, byte[] file, msgType type)
 {
     InitializeComponent();
     string[] fileInfo = getFileInfo(fileName);
     FileName = fileInfo[0] + fileInfo[1].ToLower();
     Files    = file;
     if (type.ToString() == "Out")
     {
         this.pnlBubble.Location = new Point(457 - (pnlBubble.Width + 20), 0);
     }
     if (fileInfo[1].Equals(".JPG") || fileInfo[1].Equals(".JPEG") || fileInfo[1].Equals(".PNG") || fileInfo[1].Equals(".GIF"))
     {
         this.picture.Size     = new Size(230, 130);
         this.picture.Location = new Point(10, 10);
         this.picture.Image    = ChatAppUtils.ByteToImage(Files);
         this.fileName.Visible = false;
         this.fileSize.Visible = false;
     }
     else
     {
         this.fileName.Text = FileName;
         this.fileSize.Text = getFileSize(Files);
     }
 }
Esempio n. 10
0
 private void genarate()
 {
     this.lbWelcome.Text   = "Xin chào " + user.lastName;
     this.userAvatar.Image = ChatAppUtils.ByteToImage(user.avatar);
 }
Esempio n. 11
0
 private void GroupMember_Load(object sender, EventArgs e)
 {
     lbUserName.Text = Acc.lastName;
     pbAvatar.Image  = ChatAppUtils.ByteToImage(Acc.avatar);
 }