Ejemplo n.º 1
0
        /// <summary>
        /// listView 事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void LastList_ItemClick(object sender, WinForm.UI.Events.ItemClickEventArgs e)
        {
            WeChatConcat rContact = e.ViewHolder.UserData as WeChatConcat;

            if (this.openContact == rContact)
            {
                return;
            }
            adapter.Clear();
            this.openContact            = rContact;
            this.lblOpUser.Text         = rContact.NickName;
            this.lblOpUser.Visible      = true;
            this.MessageContext.Visible = true;
            //加载聊天记录
            AsyncTask.StartNew(LoadMessageHistory);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新当前用户信息
        /// </summary>
        /// <param name="state"></param>
        private void UpdateUser(object state)
        {
            WeChatConcat Self = state as WeChatConcat;

            pbHead.Image = Self.HeadImage;
        }
Ejemplo n.º 3
0
        public override void GetView(int position, ViewHolder holder, Graphics g)
        {
            WeChatMessage obj = GetItem(position);

            holder.UserData = obj;
            Rectangle    rec  = Rectangle.Empty;
            WeChatConcat user = null;

            if (obj.IsSend)
            {
                user = obj.Mime;
            }
            else
            {
                user = obj.Remote;
            }
            if (user != null && user.HeadImage != null)
            {
                defaultImage = user.HeadImage;
            }
            if (obj.IsSend)
            {
                rec = new Rectangle(holder.bounds.Width - 65, holder.bounds.Y + 10, 40, 40);
            }
            else
            {
                rec = new Rectangle(20, holder.bounds.Y + 10, 40, 40);
            }
            g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.CompositingQuality = CompositingQuality.HighQuality;
            g.DrawImage(defaultImage, rec, new Rectangle(0, 0, defaultImage.Width, defaultImage.Height), GraphicsUnit.Pixel);
            switch (obj.MsgType)
            {
            case 1:
                TextHolder.DrawItem(obj, holder, g);
                break;

            case 34:
                VoiceHolder.DrawItem(obj, holder, g, owner);
                //TextHolder.DrawItem("【语音消息】MsgType=" + obj.MsgType, holder, g);
                break;

            case 3:
                ImageHolder.DrawItem(obj, holder, g);
                //TextHolder.DrawItem("【图片消息】MsgType=" + obj.MsgType, holder, g);
                break;

            case 47:
                ClownHolder.DrawItem(obj, holder, g);
                //TextHolder.DrawItem("【动画表情】MsgType=" + obj.MsgType, holder, g, obj.IsSend);
                break;

            case 49:
                TextHolder.DrawItem("【红包消息/文件消息/分享连接】MsgType=" + obj.MsgType, holder, g);
                break;

            case 42:
                TextHolder.DrawItem("【名片消息】MsgType=" + obj.MsgType, holder, g);
                break;

            case 43:
                TextHolder.DrawItem("【小视频消息】MsgType=" + obj.MsgType, holder, g);
                break;

            case 37:
                TextHolder.DrawItem("【添加好友 通知】MsgType=" + obj.MsgType, holder, g);
                break;

            case 8558:
                TextHolder.DrawItem("【位置信息】MsgType=" + obj.MsgType, holder, g);
                break;

            case 9000:
                TextHolder.DrawItem("【文件消息】MsgType=" + obj.MsgType, holder, g);
                break;

            case 10000:
                TextHolder.DrawItem("【系统消息】MsgType=" + obj.MsgType, holder, g);
                break;

            default:
                TextHolder.DrawItem("【未知消息类型】MsgType=" + obj.MsgType, holder, g);
                break;
            }
        }