Example #1
0
        /// <summary>
        /// 发送文件
        /// </summary>
        /// <param name="p_files"></param>
        public async void SendFiles(List <FileData> p_files)
        {
            Letter l = new Letter
            {
                OtherID    = OtherID,
                OtherName  = _other.Name,
                IsReceived = false,
                Unread     = false,
                LetterType = GetLetterType(p_files),
                STime      = Kit.Now,
                Photo      = Kit.UserPhoto,
            };

            _lv.Data.Add(l);

            FileList fl;
            var      elem = _lv.GetRowUI(_lv.Data.Count - 1);

            if (elem == null || (fl = elem.FindChildByType <FileList>()) == null)
            {
                _lv.Data.Remove(l);
                return;
            }

            bool suc = await fl.UploadFiles(p_files);

            if (suc)
            {
                var nl = await LetterManager.SendLetter(OtherID, _other.Name, fl.Data, l.LetterType);

                l.ID      = nl.ID;
                l.MsgID   = nl.MsgID;
                l.Content = nl.Content;
            }
            else
            {
                _lv.Data.Remove(l);
            }
        }
Example #2
0
 /// <summary>
 /// 发送普通消息
 /// </summary>
 /// <param name="p_msg"></param>
 public async void SendMsg(string p_msg)
 {
     await LetterManager.SendLetter(OtherID, _other.Name, p_msg, LetterType.Text);
 }