219 |
|
|
220 |
private void autoscroll_timer_Tick(object sender, EventArgs e) |
private void autoscroll_timer_Tick(object sender, EventArgs e) |
221 |
{ |
{ |
222 |
if (this.DesignMode) { return; } |
try |
223 |
//txtLog.ScrollToEnd(); |
{ |
224 |
//txtLog.SelectionStart = txtLog.Text.Length-100; |
if (this.DesignMode) { return; } |
225 |
//txtLog.ScrollToCaret(); |
//txtLog.ScrollToEnd(); |
226 |
//txtLog.Refresh(); |
//txtLog.SelectionStart = txtLog.Text.Length-100; |
227 |
|
//txtLog.ScrollToCaret(); |
228 |
|
//txtLog.Refresh(); |
229 |
|
|
230 |
txtLog.SelectionStart = 0; |
txtLog.SelectionStart = 0; |
231 |
txtLog.ScrollToCaret(); |
txtLog.ScrollToCaret(); |
232 |
txtLog.Refresh(); |
txtLog.Refresh(); |
233 |
|
|
234 |
int last_line_position = -1; |
int last_line_position = -1; |
235 |
int position = -1; |
int position = -1; |
236 |
int len = txtLog.Text.Length; |
int len = txtLog.Text.Length; |
237 |
StringReader sr = new StringReader(this.StreamToString()); |
StringReader sr = new StringReader(this.StreamToString()); |
238 |
string line = ""; |
string line = ""; |
239 |
while ((line = sr.ReadLine()) != null) |
while ((line = sr.ReadLine()) != null) |
240 |
{ |
{ |
241 |
position += (line.Length); |
position += (line.Length); |
242 |
last_line_position = (line.Length*2); |
last_line_position = (line.Length * 2); |
243 |
//if (line.EndsWith("/n")) |
//if (line.EndsWith("/n")) |
244 |
//{ |
//{ |
245 |
// position++; |
// position++; |
246 |
//} |
//} |
247 |
//logger.VerboseDebug.WriteLine("current line: {0}", line); |
//logger.VerboseDebug.WriteLine("current line: {0}", line); |
248 |
|
} |
249 |
|
txtLog.SelectionStart = position; |
250 |
|
txtLog.ScrollToCaret(); |
251 |
|
txtLog.Refresh(); |
252 |
|
//autoscroll_timer.Enabled = false; |
253 |
} |
} |
254 |
txtLog.SelectionStart = position; |
catch { } |
|
txtLog.ScrollToCaret(); |
|
|
txtLog.Refresh(); |
|
|
//autoscroll_timer.Enabled = false; |
|
255 |
} |
} |
256 |
|
|
257 |
private void logupdater_DoWork(object sender, DoWorkEventArgs e) |
private void logupdater_DoWork(object sender, DoWorkEventArgs e) |