Winify – Diff between revs 43 and 44

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