forked from vsClojure/vsClojure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextBoxWriter.cs
More file actions
35 lines (32 loc) · 911 Bytes
/
Copy pathTextBoxWriter.cs
File metadata and controls
35 lines (32 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Windows.Controls;
using System.Windows.Threading;
using ClojureExtension.Utilities;
namespace ClojureExtension.Repl
{
public class TextBoxWriter
{
private readonly TextBox _interactiveTextBox;
private readonly Entity<ReplState> _replEntity;
public TextBoxWriter(TextBox interactiveTextBox, Entity<ReplState> replEntity)
{
_interactiveTextBox = interactiveTextBox;
_replEntity = replEntity;
}
public void WriteToTextBox(string output)
{
_interactiveTextBox.Dispatcher.Invoke(
DispatcherPriority.Normal,
new DispatcherOperationCallback(
delegate
{
_interactiveTextBox.AppendText(output);
_interactiveTextBox.ScrollToEnd();
_replEntity.CurrentState =
_replEntity.CurrentState.ChangePromptPosition(
_interactiveTextBox.Text.
Length);
return null;
}), null);
}
}
}