Winify – Rev
?pathlinks?
using System;
using System.Drawing;
using System.IO;
using System.Media;
using System.Threading.Tasks;
using System.Windows.Forms;
using Winify.Utilities;
namespace Winify
{
public partial class NotificationForm : Form
{
#region Constructors, Destructors and Finalizers
public NotificationForm()
{
InitializeComponent();
}
public NotificationForm(Image image, string title, string text, int milliseconds) : this()
{
pictureBox1.InvokeIfRequired(pictureBox => { pictureBox.Image = image; });
richTextBox2.InvokeIfRequired(richTextBox => { richTextBox.Text = title; });
richTextBox1.InvokeIfRequired(richTextBox => { richTextBox.Text = text; });
Task.Delay(milliseconds).ContinueWith(task =>
this.InvokeIfRequired(form => form.Close()));
}
public NotificationForm(Image image, string title, string text, Stream sound, int milliseconds) : this(image,
title, text,
milliseconds)
{
using (var soundPlayer = new SoundPlayer(sound))
{
soundPlayer.Play();
}
}
#endregion
#region Private Overrides
protected override void OnLoad(EventArgs e)
{
var screen = Screen.FromPoint(Location);
Location = new Point(screen.WorkingArea.Right - Width, screen.WorkingArea.Bottom - Height);
base.OnLoad(e);
}
#endregion
#region Event Handlers
private void PictureBox2_Click(object sender, EventArgs e)
{
this.InvokeIfRequired(form => { form.Close(); });
}
#endregion
}
}
Generated by GNU Enscript 1.6.5.90.