public void startExecuteUpdateTask(ChatTask task) { if (ch.debug) { Task.Factory.StartNew(() => { Thread.Sleep(500); Render.DoAction(() => { ch.Title = "123123"; }); }); return; } Task.Factory.StartNew(() => { List <string[]> messages = ChatCoreHelper.GetMessagesFromUser(task.vkId); Task.Factory.StartNew(() => { Render.DoAction(() => { PersonChat pchat = ch.getPersonChat(task.personChatId); pchat.updateMessage(messages); }); }); }); }
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); } }); }
private void Chat_Loaded(object sender, RoutedEventArgs e) { CurrentUser = ChatCoreHelper.GetCurrentUserInfo(); console.ItemsSource = consoleMsg; resizeItems(); timerSync = new DispatcherTimer(); timerSync.Interval = System.TimeSpan.FromMilliseconds(1000); timerSync.Tick += timerSync_Tick; timerSync.Start(); te.wire(this); te.init(); log.wire(this); log.init(); bot = new Bot(); bot.wire(this); stage = StageEnum.LOADED; addConsoleMsg("Loaded"); }
private void Chat_Loaded(object sender, RoutedEventArgs e) { CurrentUser = ChatCoreHelper.GetCurrentUserInfo(); //console.ItemsSource = consoleMsg; resizeItems(); timerSync = new DispatcherTimer(); timerSync.Interval = System.TimeSpan.FromMilliseconds(1000); timerSync.Tick += timerSync_Tick; timerSync.Start(); te.wire(this); te.init(); log.wire(this); log.init(); bot = new Bot(); bot.wire(this); stage = StageEnum.LOADED; addConsoleMsg("Loaded"); List <int> ss = new List <int>() { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; for (int k = ss.Count - 1; k >= 0; k--) { //var p = Persons[i]; //if (p == null) //{ // continue; //} int j = ss.IndexOf(k); Console.WriteLine(k + " " + j + " " + (ss.Count - 1)); } //for (int i = 0; i < 100; i++) //{ // Thread.Sleep(1000); // Console.WriteLine(i); //} // writeMessage("sdfsdf", 0, null); }
private static void SetChatCoreInstance(object sender, KeyValuePair <string, string> e) { ChatCoreHelper.SetVkApiInstance(api); }