Example #1
0
        /// <summary>
        /// 选择要转发的聊天室
        /// </summary>
        /// <param name="obj"></param>
        private void SelectedChatItemChanged(object obj)
        {
            var tempChatInfo     = obj as ChatInfo;
            var tempSelectedItem = SelectedChatList.FirstOrDefault(m => m.ChatID == tempChatInfo.ChatID && m.IsGroup == tempChatInfo.IsGroup);
            var tempChatItems    = ChatItems.Where(m => m.ChatID == tempChatInfo.ChatID && m.IsGroup == tempChatInfo.IsGroup)?.ToList();

            if (tempSelectedItem == null)
            {
                if (SelectedChatList.Count == 9)
                {
                    //IsMsgExist = true;
                    //FowardTips = "最多只能选择9个联系人";

                    IsMoreContact  = true;
                    timer.Tick    += new EventHandler(Timer_Tick);
                    timer.Interval = new TimeSpan(0, 0, 1);
                    timer.Start();

                    return;
                }
                SelectedChatList.Add(tempChatInfo);
                if (tempChatItems?.Count > 0)
                {
                    foreach (var chatItem in tempChatItems)
                    {
                        chatItem.IsChatSelected = true;
                    }
                }
            }
            else
            {
                SelectedChatList.Remove(tempSelectedItem);
                if (tempChatItems?.Count > 0)
                {
                    foreach (var chatItem in tempChatItems)
                    {
                        chatItem.IsChatSelected = false;
                    }
                }
            }
            if (SelectedChatList.Count > 0)
            {
                IsEnabled = true;
            }
            else
            {
                IsEnabled = false;
            }
        }
Example #2
0
        /// <summary>
        /// 选择要转发的聊天室
        /// </summary>
        /// <param name="obj"></param>
        private void SelectedChatItemChanged(object obj)
        {
            ChatInfo currentSelectItem = obj as ChatInfo;//当前选择的聊天条目

            ChatItems.ToList().ForEach(x => x.IsChatSelected = false);
            List <ChatInfo> tempChatInfos = ChatItems.Where(x => x.ChatID == currentSelectItem.ChatID && x.IsGroup == currentSelectItem.IsGroup).ToList();

            SelectedChatList.Clear();
            currentSelectItem.IsChatSelected = true;
            SelectedChatList.Add(currentSelectItem);
            if (tempChatInfos?.Count > 0)
            {
                tempChatInfos.ForEach(x => x.IsChatSelected = true);
            }
            if (SelectedChatList.Count > 0)
            {
                IsEnabled = true;
            }
            else
            {
                IsEnabled = false;
            }
        }