Horizon – Diff between revs 1 and 8

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 1 Rev 8
1 using System.Collections.Specialized; 1 using System.Collections.Specialized;
2 using System.Threading; 2 using System.Threading;
3 using System.Windows.Forms; 3 using System.Windows.Forms;
4 using Horizon.Utilities; 4 using Horizon.Utilities;
5   5  
6 namespace Horizon 6 namespace Horizon
7 { 7 {
8 public partial class LogViewForm : Form 8 public partial class LogViewForm : Form
9 { 9 {
10 private readonly CancellationToken _cancellationToken; 10 private readonly CancellationToken _cancellationToken;
11   11  
12 private readonly MainForm _mainForm; 12 private readonly MainForm _mainForm;
13   13  
14 private readonly LogMemorySink _memorySink; 14 private readonly LogMemorySink _memorySink;
15   15  
16 public LogViewForm() 16 public LogViewForm()
17 { 17 {
18 InitializeComponent(); 18 InitializeComponent();
19 Utilities.WindowState.FormTracker.Track(this); -  
20 } 19 }
21   20  
22 public LogViewForm(MainForm mainForm) : this() 21 public LogViewForm(MainForm mainForm) : this()
23 { 22 {
24 _mainForm = mainForm; 23 _mainForm = mainForm;
25 _mainForm.MemorySinkEnabled = true; 24 _mainForm.MemorySinkEnabled = true;
26 } 25 }
27   26  
28 public LogViewForm(MainForm mainForm, LogMemorySink memorySink, CancellationToken cancellationToken) : 27 public LogViewForm(MainForm mainForm, LogMemorySink memorySink, CancellationToken cancellationToken) :
29 this(mainForm) 28 this(mainForm)
30 { 29 {
31 _memorySink = memorySink; 30 _memorySink = memorySink;
32 _memorySink.Events.CollectionChanged += Events_CollectionChanged; 31 _memorySink.Events.CollectionChanged += Events_CollectionChanged;
33   32  
34 _cancellationToken = cancellationToken; 33 _cancellationToken = cancellationToken;
35 } 34 }
36   35  
37 /// <summary> 36 /// <summary>
38 /// Clean up any resources being used. 37 /// Clean up any resources being used.
39 /// </summary> 38 /// </summary>
40 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 39 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
41 protected override void Dispose(bool disposing) 40 protected override void Dispose(bool disposing)
42 { 41 {
43 if (disposing && components != null) 42 if (disposing && components != null)
44 { 43 {
45 components.Dispose(); 44 components.Dispose();
46 } 45 }
47   46  
48 _memorySink.Events.CollectionChanged -= Events_CollectionChanged; 47 _memorySink.Events.CollectionChanged -= Events_CollectionChanged;
49   48  
50 _mainForm.MemorySinkEnabled = false; 49 _mainForm.MemorySinkEnabled = false;
51 _memorySink.Clear(); 50 _memorySink.Clear();
52   51  
53 base.Dispose(disposing); 52 base.Dispose(disposing);
54 } 53 }
55   54  
56 private void Events_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 55 private void Events_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
57 { 56 {
58 switch (e.Action) 57 switch (e.Action)
59 { 58 {
60 case NotifyCollectionChangedAction.Add: 59 case NotifyCollectionChangedAction.Add:
61 foreach (var item in e.NewItems) 60 foreach (var item in e.NewItems)
62 { 61 {
63 var line = (string)item; 62 var line = (string)item;
64   63  
65 textBox1.InvokeIfRequired(textbox => { textbox.AppendText(line); }); 64 textBox1.InvokeIfRequired(textbox => { textbox.AppendText(line); });
66 } 65 }
67   66  
68 break; 67 break;
69 } 68 }
70 } 69 }
-   70  
-   71 private void LogViewForm_Load(object sender, System.EventArgs e)
-   72 {
-   73 Utilities.WindowState.FormTracker.Track(this);
-   74 }
71 } 75 }
72 } 76 }
73   77  
74
Generated by GNU Enscript 1.6.5.90.
78
Generated by GNU Enscript 1.6.5.90.
75   79  
76   80  
77   81