Mercurial > pub > ImplabNet
comparison Implab.Diagnostics.Interactive/InteractiveListener.cs @ 192:f1da3afc3521 release v2.1
Слияние с v2
author | cin |
---|---|
date | Fri, 22 Apr 2016 13:10:34 +0300 |
parents | 04d4c92d0f28 |
children | cbb0bd8fc0d1 |
comparison
equal
deleted
inserted
replaced
71:1714fd8678ef | 192:f1da3afc3521 |
---|---|
7 using System.Threading.Tasks; | 7 using System.Threading.Tasks; |
8 using System.Windows.Forms; | 8 using System.Windows.Forms; |
9 | 9 |
10 namespace Implab.Diagnostics.Interactive | 10 namespace Implab.Diagnostics.Interactive |
11 { | 11 { |
12 public class InteractiveListener: TextListenerBase | 12 public class InteractiveListener: ListenerBase |
13 { | 13 { |
14 TraceForm m_form; | 14 TraceForm m_form; |
15 | 15 |
16 SynchronizationContext m_syncGuiThread; | 16 SynchronizationContext m_syncGuiThread; |
17 readonly Promise<object> m_guiStarted = new Promise<object>(); | 17 readonly Promise m_guiStarted = new Promise(); |
18 | 18 |
19 readonly IPromise m_guiFinished; | 19 readonly IPromise m_guiFinished; |
20 readonly IPromise m_workerFinished = new Promise<object>(); | 20 // readonly IPromise m_workerFinished = new Promise<object>(); |
21 | 21 |
22 readonly MTQueue<TraceViewItem> m_queue = new MTQueue<TraceViewItem>(); | 22 readonly MTQueue<TraceViewItem> m_queue = new MTQueue<TraceViewItem>(); |
23 readonly AutoResetEvent m_queueEvent = new AutoResetEvent(false); | 23 readonly AutoResetEvent m_queueEvent = new AutoResetEvent(false); |
24 | 24 |
25 int m_queueLength; | 25 int m_queueLength; |
27 | 27 |
28 readonly object m_pauseLock = new object(); | 28 readonly object m_pauseLock = new object(); |
29 bool m_paused; | 29 bool m_paused; |
30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true); | 30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true); |
31 | 31 |
32 public InteractiveListener(bool global) : base(global) { | 32 public InteractiveListener() { |
33 m_guiFinished = AsyncPool.InvokeNewThread(GuiThread); | 33 m_guiFinished = AsyncPool.RunThread(GuiThread); |
34 m_workerFinished = AsyncPool.InvokeNewThread(QueueThread); | 34 /*m_workerFinished = */AsyncPool.RunThread(QueueThread); |
35 | 35 |
36 m_guiStarted.Join(); | 36 m_guiStarted.Join(); |
37 } | 37 } |
38 | 38 |
39 void GuiThread() { | 39 void GuiThread() { |
105 m_guiFinished.Join(); | 105 m_guiFinished.Join(); |
106 } | 106 } |
107 base.Dispose(disposing); | 107 base.Dispose(disposing); |
108 } | 108 } |
109 | 109 |
110 protected override void WriteEntry(TraceContext context, EventText text, string channel) { | 110 public override void Write(LogEventArgs args, object entry) { |
111 var item = new TraceViewItem { | 111 var item = new TraceViewItem { |
112 Indent = text.indent, | 112 Indent = args.Operation.Level, |
113 Message = text.content, | 113 Message = entry.ToString(), |
114 Thread = context.ThreadId, | 114 Thread = args.ThreadId, |
115 Channel = channel, | 115 Channel = args.ChannelName, |
116 Timestamp = Environment.TickCount | 116 Timestamp = Environment.TickCount |
117 }; | 117 }; |
118 | 118 |
119 Enqueue(item); | 119 Enqueue(item); |
120 } | 120 } |