Winify – Blame information for rev 11

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