Zzz – Diff between revs 1 and 2
?pathlinks?
Rev 1 | Rev 2 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | using System.Collections.Specialized; |
1 | using System.Collections.Specialized; |
|
- | 2 | using System.Linq; |
||
2 | using System.Threading; |
3 | using System.Threading; |
|
3 | using System.Windows.Forms; |
4 | using System.Windows.Forms; |
|
4 | using Zzz.Utilities; |
5 | using Zzz.Utilities; |
|
5 | using Zzz; |
- | ||
Line 6... | Line 6... | |||
6 | |
6 | |
|
7 | namespace Zzz |
7 | namespace Zzz |
|
8 | { |
8 | { |
|
9 | public partial class LogViewForm : Form |
9 | public partial class LogViewForm : Form |
|
- | 10 | { |
||
- | 11 | private readonly CancellationToken _cancellationToken; |
||
10 | { |
12 | |
|
Line 11... | Line 13... | |||
11 | private readonly MainForm _mainForm; |
13 | private readonly MainForm _mainForm; |
|
12 | |
- | ||
Line 13... | Line 14... | |||
13 | private readonly LogMemorySink _memorySink; |
14 | |
|
14 | private readonly object _memorySinkLock; |
15 | private readonly LogMemorySink _memorySink; |
|
15 | |
16 | |
|
16 | public LogViewForm() |
17 | public LogViewForm() |
|
Line 17... | Line 18... | |||
17 | { |
18 | { |
|
18 | InitializeComponent(); |
19 | InitializeComponent(); |
|
19 | } |
20 | } |
|
20 | |
- | ||
21 | public LogViewForm(MainForm mainForm) : this() |
21 | |
|
Line 22... | Line 22... | |||
22 | { |
22 | public LogViewForm(MainForm mainForm) : this() |
|
23 | _mainForm = mainForm; |
23 | { |
|
24 | _mainForm.MemorySinkEnabled = true; |
24 | _mainForm = mainForm; |
|
25 | } |
25 | } |
|
26 | |
- | ||
27 | public LogViewForm(MainForm mainForm, LogMemorySink memorySink, object memorySinkLock) : |
26 | |
|
- | 27 | public LogViewForm(MainForm mainForm, LogMemorySink memorySink, CancellationToken cancellationToken) : |
||
- | 28 | this(mainForm) |
||
28 | this(mainForm) |
29 | { |
|
Line 29... | Line 30... | |||
29 | { |
30 | _memorySink = memorySink; |
|
30 | _memorySink = memorySink; |
31 | _memorySink.Events.CollectionChanged += Events_CollectionChanged; |
|
31 | _memorySinkLock = memorySinkLock; |
32 | |
|
32 | _memorySink.Events.CollectionChanged += Events_CollectionChanged; |
33 | _cancellationToken = cancellationToken; |
|
33 | } |
34 | } |
|
34 | |
35 | |
|
35 | /// <summary> |
36 | /// <summary> |
|
36 | /// Clean up any resources being used. |
- | ||
37 | /// </summary> |
- | ||
38 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
- | ||
39 | protected override void Dispose(bool disposing) |
- | ||
40 | { |
- | ||
Line 41... | Line -... | |||
41 | if (disposing && components != null) |
- | ||
42 | { |
- | ||
43 | components.Dispose(); |
37 | /// Clean up any resources being used. |
|
44 | } |
- | ||
45 | |
- | ||
Line 46... | Line 38... | |||
46 | _mainForm.MemorySinkEnabled = false; |
38 | /// </summary> |
|
47 | |
39 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
|
Line 48... | Line 40... | |||
48 | lock (_memorySinkLock) |
40 | protected override void Dispose(bool disposing) |
|
Line 71... | Line 63... | |||
71 | } |
63 | } |
|
Line 72... | Line 64... | |||
72 | |
64 | |
|
73 | private void LogViewForm_Load(object sender, System.EventArgs e) |
65 | private void LogViewForm_Load(object sender, System.EventArgs e) |
|
74 | { |
66 | { |
|
- | 67 | Utilities.WindowState.FormTracker.Track(this); |
||
- | 68 | |
||
- | 69 | foreach (var @event in _memorySink.Events) |
||
- | 70 | { |
||
- | 71 | textBox1.AppendText(@event); |
||
75 | Utilities.WindowState.FormTracker.Track(this); |
72 | } |
|
76 | } |
73 | } |
|
77 | } |
74 | } |
|
78 | } |
75 | } |