Пример #1
0
 /// <summary>
 /// 聊天记录点击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void fListView1_ItemClick(object sender, WinForm.UI.Events.ItemClickEventArgs e)
 {
     API.Message msg = e.ViewHolder.UserData as API.Message;
     if (msg.MsgType == 3)//图片消息
     {
         string path = string.Empty;
         if (!msg.IsSend)
         {
             string fileName = msg.MsgId + ".bmp";
             path = Path.Combine(App.PATH_CACHE, fileName);
         }
         else
         {
             path = msg.fileName;
         }
         ImageForm form = new ImageForm();
         form.Show(path);
     }
     else if (msg.MsgType == 34) //语音消息
     {
         string path = msg.fileName;
         musicForm.Player(path);
         adapter.Play();
         AsyncTask.StartNew(() =>
         {
             Thread.Sleep((int)msg.VoiceLength / 1000);
             adapter.Stop();
         });
     }
 }
Пример #2
0
        /// <summary>
        /// 聊天记录点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void fListView1_ItemClick(object sender, WinForm.UI.Events.ItemClickEventArgs e)
        {
            WeChatMessage msg = e.ViewHolder.UserData as WeChatMessage;

            if (msg.MsgType == 3)//图片消息
            {
                string path = string.Empty;
                //TODO 获取图片
                ImageForm form = new ImageForm();
                form.Show(path);
            }
            else if (msg.MsgType == 34)//语音消息
            {
                string path = msg.fileName;
                adapter.Play();
                AsyncTask.StartNew(() =>
                {
                    Thread.Sleep((int)msg.VoiceLength / 1000);
                    adapter.Stop();
                });
            }
        }