private void SendMessage()
        {
            if ((String.IsNullOrWhiteSpace(MessageTextBox.Text) ||
                 MessageTextBox.Text == MessageTextBoxPlaceholder) &&
                _attachedFile == null)
            {
                return;
            }

            Message m = new Message
            {
                Text       = MessageTextBox.Text,
                ChatToID   = _chat.ID,
                UserFromID = Properties.Settings.Default.CurrentUser.ID
            };

            if (_attachedFile != null)
            {
                m.AttachType = _attachedFile.Type;
                m.Attach     = _attachedFile.File;
                m.AttachName = _attachedFile.Path.Split('\\').Last();
                AttachButton.BackgroundImage = Properties.Resources.attach;
                _attachedFile = null;
            }

            Message returned = ServiceClient.SendMessage(m);

            AddMessage(returned);

            if (_chat.TimeToLive > 0)
            {
                Dictionary <Guid, int> arg = new Dictionary <Guid, int>()
                {
                    {
                        returned.ID,
                        MessagesPanel.GetRow(MessagesPanel.Controls.Find(returned.ID.ToString(), true).First())
                    }
                };

                BackgroundWorker bgw = new BackgroundWorker();
                bgw.DoWork             += SelfDestroyMessage_DoWork;
                bgw.RunWorkerCompleted += SelfDestroyMessage_RunWorkerCompleted;
                bgw.RunWorkerAsync(arg);
            }

            MessageTextBox.Text = "";
        }
 private void RemoveAttachButton_Click(object sender, EventArgs e)
 {
     AttachButton.BackgroundImage = Properties.Resources.attach;
     _attachedFile = new Attach();
 }