public void Handle(object sender, EventArgs e) { if (form.NewChat != null) { form.NewChat.Dispose(); form.NewChat = null; } int b = 0; foreach (var c in form.ConversationList) { if (c.Cvst.memberList.Count == 2) { if (account.id == c.Cvst.memberList[0].id || account.id == c.Cvst.memberList[1].id) { form.DisplayConversations(); form.SelectConversation(c.Cvst); form.AddChatBox(c.Cvst); b = 1; break; } } } if (b == 0) { Conversation cvst = new Conversation(); cvst.memberList = new List <Account>(); cvst.memberList.Add(account); cvst.memberList.Add(form.User); cvst.title = account.firstName + " " + account.lastName; cvst.creatorId = form.User.id; cvst.avatar = account.avatar; cvst.senderId = form.User.id; form.AddChatBox(cvst); form.ResetCurrentConversation(); form.DisplayConversations(); } }
public void Handle(object sender, EventArgs e) { ReferenceData.Entity.Conversation cvst = new ReferenceData.Entity.Conversation(); cvst.memberList = new List <ReferenceData.Entity.Account>(); cvst.memberList.Add(form.User); foreach (var mb in form.NewGroup.MemberList) { cvst.memberList.Add(mb.Acc); } cvst.title = form.NewGroup.GroupName; cvst.title2 = form.NewGroup.GroupName; cvst.creatorId = form.User.id; cvst.avatar = form.NewGroup.Avatar; cvst.avatar2 = form.NewGroup.AvatarName; cvst.senderId = form.User.id; form.AddChatBox(cvst); form.ResetCurrentConversation(); if (form.NewGroup != null) { form.NewGroup.Dispose(); form.NewGroup = null; } }