public void startExecuteMessageTask(long vkId, string message) { if (ch.debug) { Task.Factory.StartNew(() => { Thread.Sleep(500); }); return; } Task.Factory.StartNew(() => { long code = ChatCoreHelper.WriteMessage(vkId, message); //long code = 900; if (VKERROR.isError(code)) { if (VKERROR.banned(code)) { Render.DoAction(() => { ch.ban(vkId, code); }); } ErrorMessage errorMessage = new ErrorMessage(); errorMessage.time = DateTime.Now; errorMessage.message = VKERROR.getErrorString(code); errorMessage.reason = "Send message to " + vkId; ch.log.errMess.Add(errorMessage); ch.addConsoleMsg(code + " : " + VKERROR.getErrorString(code), true); } }); }
//получили бан от чата public void ban(long vkId, long code) { foreach (KeyValuePair <string, PersonChat> kvp in personWindows) { PersonChat pc = kvp.Value; if (pc.personId == vkId) { pc.banned = true; pc.isActive = false; pc.bannedString = VKERROR.getErrorString(code); pc.UpdateUi(); } } }