Winify – Diff between revs 11 and 12

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 11 Rev 12
1 using System; 1 using System;
2 using System.Diagnostics; 2 using System.Diagnostics;
3 using System.Drawing; 3 using System.Drawing;
-   4 using System.IO;
-   5 using System.Media;
4 using System.Threading.Tasks; 6 using System.Threading.Tasks;
5 using System.Windows.Forms; 7 using System.Windows.Forms;
6 using Winify.Utilities; 8 using Winify.Utilities;
7   9  
8 namespace Winify 10 namespace Winify
9 { 11 {
10 public partial class NotificationForm : Form 12 public partial class NotificationForm : Form
11 { 13 {
12 #region Public Enums, Properties and Fields 14 #region Public Enums, Properties and Fields
13   15  
14 public int Index { get; } 16 public int Index { get; }
15   17  
16 #endregion 18 #endregion
17   19  
18 #region Private Delegates, Events, Enums, Properties, Indexers and Fields 20 #region Private Delegates, Events, Enums, Properties, Indexers and Fields
19   21  
20 private Point _displayLocation; 22 private Point _displayLocation;
21   23  
22 private Image _image; 24 private Image _image;
23   25  
24 #endregion 26 #endregion
25   27  
26 #region Constructors, Destructors and Finalizers 28 #region Constructors, Destructors and Finalizers
27   29  
28 public NotificationForm() 30 public NotificationForm()
29 { 31 {
30 InitializeComponent(); 32 InitializeComponent();
31 } 33 }
32   34  
-   35 public NotificationForm(int index, Image image, Stream sound, string title, string text, int milliseconds) :
33 public NotificationForm(int i, Image image, string title, string text, int milliseconds) : this() 36 this()
34 { 37 {
35 Index = i; -  
36   38 Index = index;
37 _image = image; 39 _image = image;
38   40  
39 pictureBox1.InvokeIfRequired(pictureBox => { pictureBox.Image = image; }); 41 pictureBox1.InvokeIfRequired(pictureBox => { pictureBox.Image = image; });
40   42  
41 richTextBox2.InvokeIfRequired(richTextBox => { richTextBox.Text = title; }); 43 richTextBox2.InvokeIfRequired(richTextBox => { richTextBox.Text = title; });
42 richTextBox1.InvokeIfRequired(richTextBox => { richTextBox.Text = text; }); 44 richTextBox1.InvokeIfRequired(richTextBox => { richTextBox.Text = text; });
-   45  
-   46 using (var soundPlayer = new SoundPlayer(sound))
-   47 {
-   48 soundPlayer.Play();
-   49 }
43   50  
44 Task.Delay(milliseconds).ContinueWith(task => 51 Task.Delay(milliseconds).ContinueWith(task =>
45 this.InvokeIfRequired(form => { form.Close(); })); 52 this.InvokeIfRequired(form => { form.Close(); }));
46 } 53 }
47   54  
48 /// <summary> 55 /// <summary>
49 /// Clean up any resources being used. 56 /// Clean up any resources being used.
50 /// </summary> 57 /// </summary>
51 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 58 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
52 protected override void Dispose(bool disposing) 59 protected override void Dispose(bool disposing)
53 { 60 {
54 if (disposing && components != null) 61 if (disposing && components != null)
55 { 62 {
56 if (_image != null) 63 if (_image != null)
57 { 64 {
58 _image.Dispose(); 65 _image.Dispose();
59 _image = null; 66 _image = null;
60 } 67 }
61   68  
62 components.Dispose(); 69 components.Dispose();
63 } 70 }
64   71  
65 base.Dispose(disposing); 72 base.Dispose(disposing);
66 } 73 }
67   74  
68 #endregion 75 #endregion
69   76  
70 #region Private Overrides 77 #region Private Overrides
71   78  
72 protected override bool ShowWithoutActivation => true; 79 protected override bool ShowWithoutActivation => true;
73   80  
74 protected override void OnLoad(EventArgs e) 81 protected override void OnLoad(EventArgs e)
75 { 82 {
76 Location = _displayLocation; 83 Location = _displayLocation;
77 base.OnLoad(e); 84 base.OnLoad(e);
78 } 85 }
79   86  
80 #endregion 87 #endregion
81   88  
82 #region Event Handlers 89 #region Event Handlers
83   90  
84 private void PictureBox2_Click(object sender, EventArgs e) 91 private void PictureBox2_Click(object sender, EventArgs e)
85 { 92 {
86 this.InvokeIfRequired(form => { form.Close(); }); 93 this.InvokeIfRequired(form => { form.Close(); });
87 } 94 }
88   95  
89 private void NotificationForm_FormClosing(object sender, FormClosingEventArgs e) 96 private void NotificationForm_FormClosing(object sender, FormClosingEventArgs e)
90 { 97 {
91 if (_image != null) 98 if (_image != null)
92 { 99 {
93 _image.Dispose(); 100 _image.Dispose();
94 _image = null; 101 _image = null;
95 } 102 }
96 } 103 }
97   104  
98 private void RichTextBox1_LinkClicked(object sender, LinkClickedEventArgs e) 105 private void RichTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)
99 { 106 {
100 Process.Start(e.LinkText); 107 Process.Start(e.LinkText);
101 } 108 }
102   109  
103 private void RichTextBox2_LinkClicked(object sender, LinkClickedEventArgs e) 110 private void RichTextBox2_LinkClicked(object sender, LinkClickedEventArgs e)
104 { 111 {
105 Process.Start(e.LinkText); 112 Process.Start(e.LinkText);
106 } 113 }
107   114  
108 #endregion 115 #endregion
109   116  
110 #region Public Methods 117 #region Public Methods
111   118  
112 public void UpdateLocation(int x, int y) 119 public void UpdateLocation(int x, int y)
113 { 120 {
114 _displayLocation = new Point(x, y); 121 _displayLocation = new Point(x, y);
115 } 122 }
116   123  
117 #endregion 124 #endregion
118 } 125 }
119 } 126 }
120   127  
121
Generated by GNU Enscript 1.6.5.90.
128
Generated by GNU Enscript 1.6.5.90.
122   129  
123   130  
124   131