Winify – Blame information for rev 13

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