TextBoxMsgManager ClassCleanCode C# Libraries v1.2.03 API
Enhances a OnlineTextBox used for message output.
Inheritance Hierarchy

OnlineSystem Object
  CleanCode.Forms AbstractMsgManager
    CleanCode.Forms TextBoxMsgManager

Namespace: CleanCode.Forms
Assembly: CleanCode (in CleanCode.dll) Version: 1.2.3.0 (1.2.03)
Syntax

public class TextBoxMsgManager : AbstractMsgManager
Remarks

This provides a couple simple but useful mechanisms. First, line breaks are automatically added after each message, saving the caller from continually adding + Environment.NewLine or equivalent.

Second, it provides a queuing mechanism to start and stop updating of the underlying TextBox. This allows background tasks to add messages, since background tasks should not attempt to be updating visual controls on a form. The main task could activate queuing, start the background task, and once the background task completes, deactivate queuing and then show all the collected messages. I am not suggesting this is an optimal approach, but for certain simple scenarios it is a handy one.

A second reason for queuing is when there are a lot of messages to display at one time. Without queuing, there will be a noticeable time lag to output 100 messages, for instance. It will be almost instantaneous if queuing is enabled while adding the 100 messages, then disabled when complete to render them on screen.

This subclass of AbstractMsgManager requires defining the Refresher property.

Since CleanCode 0.9.10.

See Also