Hi, using Terminal Emulation .NET 2.0 and 4.0 and trivial coding: first load ~20KB data with VirtualTerminal.Screen.Write and then retrieve columnar data with VirtualTerminal.Screen.GetRegions. I notice that the function used in this way is slow, around 1 sec to load (write) and it blocks the processing of other threads. I am new to C# so i.e.,

this.Invoke(new ProcessDataDelegate(_terminal.Screen.Write), onePage);

does not change behavior of the function call as it is not bind to a windows control. I am grasping Lambda's but my target is .NET 2.0. Also, I saw there is support for threading with InvokeRequired. What is the suggested solution in case of threading a call to VirtualTerminal?

Thank you

asked 06 Aug '11, 00:30

tebee's gravatar image

tebee
15
accept rate: 0%


Unfortunately, the VirtualTerminal class have no asynchronous API yet, so I suggest you to use standard .NET patterns. You can learn it at e.g. Calling Synchronous Methods Asynchronously or Making Asynchronous Method Calls. I found this StackOverflow post also helpful.

In your case the code can look like this:

private delegate void WriteDelegate(string value);

...

WriteDelegate runner = new WriteDelegate(_terminal.Screen.Write);
runner.BeginInvoke(onePage, null, null);

Actually, I recognize in your sample code a part of my code I've sent you earlier. If you send your project to support@rebex.net, I can suggest you a solution specific to your needs.

link

answered 08 Aug '11, 13:37

Lukas%20Matyska's gravatar image

Lukas Matyska ♦♦
90117
accept rate: 28%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×9
×5

Asked: 06 Aug '11, 00:30

Seen: 266 times

Last updated: 08 Aug '11, 13:37