private void ProcessLog() { // 너무 이 작업만 할 수 없으므로 일정 작업 이상을 하면 일단 패스한다. int logWorkCount = 0; while (true) { string msg; if (UILog.GetLog(out msg)) { ++logWorkCount; if (listBoxLog.Items.Count > 512) { listBoxLog.Items.Clear(); } listBoxLog.Items.Add(msg); listBoxLog.SelectedIndex = listBoxLog.Items.Count - 1; } else { break; } if (logWorkCount > 8) { break; } } }
private void MainForm_Load(object sender, EventArgs e) { PacketBuffer.Init((8096 * 10), 12, 512); IsNetworkThreadRunning = true; NetworkReadThread = new System.Threading.Thread(this.NetworkReadProcess); NetworkReadThread.Start(); NetworkSendThread = new System.Threading.Thread(this.NetworkSendProcess); NetworkSendThread.Start(); dispatcherUITimer = new System.Windows.Threading.DispatcherTimer(); dispatcherUITimer.Tick += new EventHandler(ReadPacketQueueProcess); dispatcherUITimer.Interval = new TimeSpan(0, 0, 0, 0, 100); dispatcherUITimer.Start(); btnDisconnect.Enabled = false; UILog.Write("프로그램 시작 !!!", LOG_LEVEL.INFO); }