Refactored code a bit.

Moved configuration to separate form.
Added option to show past appointments from the selected day (previous in time, that is).
Added some tooltips.
This commit is contained in:
gamosoft_cp
2013-06-27 18:30:15 +00:00
parent 9d7c1d840a
commit ef0f86d79d
22 changed files with 562 additions and 157 deletions
+148
View File
@@ -0,0 +1,148 @@
namespace Outlook2013TodoAddIn.Forms
{
partial class FormConfiguration
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.chkMailAlerts = new System.Windows.Forms.CheckBox();
this.lblRangeDays = new System.Windows.Forms.Label();
this.numRangeDays = new System.Windows.Forms.NumericUpDown();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.chkShowPastAppointments = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).BeginInit();
this.SuspendLayout();
//
// chkMailAlerts
//
this.chkMailAlerts.AutoSize = true;
this.chkMailAlerts.Location = new System.Drawing.Point(59, 134);
this.chkMailAlerts.Name = "chkMailAlerts";
this.chkMailAlerts.Size = new System.Drawing.Size(143, 21);
this.chkMailAlerts.TabIndex = 8;
this.chkMailAlerts.Text = "Enable Mail Alerts";
this.chkMailAlerts.UseVisualStyleBackColor = true;
//
// lblRangeDays
//
this.lblRangeDays.AutoSize = true;
this.lblRangeDays.Location = new System.Drawing.Point(55, 60);
this.lblRangeDays.Name = "lblRangeDays";
this.lblRangeDays.Size = new System.Drawing.Size(44, 17);
this.lblRangeDays.TabIndex = 7;
this.lblRangeDays.Text = "Days:";
//
// numRangeDays
//
this.numRangeDays.Location = new System.Drawing.Point(115, 58);
this.numRangeDays.Maximum = new decimal(new int[] {
30,
0,
0,
0});
this.numRangeDays.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numRangeDays.Name = "numRangeDays";
this.numRangeDays.Size = new System.Drawing.Size(55, 22);
this.numRangeDays.TabIndex = 6;
this.numRangeDays.Value = new decimal(new int[] {
3,
0,
0,
0});
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(169, 181);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(87, 37);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(27, 181);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(87, 37);
this.btnOK.TabIndex = 10;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// chkShowPastAppointments
//
this.chkShowPastAppointments.AutoSize = true;
this.chkShowPastAppointments.Location = new System.Drawing.Point(59, 98);
this.chkShowPastAppointments.Name = "chkShowPastAppointments";
this.chkShowPastAppointments.Size = new System.Drawing.Size(186, 21);
this.chkShowPastAppointments.TabIndex = 12;
this.chkShowPastAppointments.Text = "Show Past Appointments";
this.chkShowPastAppointments.UseVisualStyleBackColor = true;
//
// FormConfiguration
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(282, 253);
this.Controls.Add(this.chkShowPastAppointments);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.chkMailAlerts);
this.Controls.Add(this.lblRangeDays);
this.Controls.Add(this.numRangeDays);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormConfiguration";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Configuration";
this.Load += new System.EventHandler(this.FormConfiguration_Load);
((System.ComponentModel.ISupportInitialize)(this.numRangeDays)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox chkMailAlerts;
private System.Windows.Forms.Label lblRangeDays;
private System.Windows.Forms.NumericUpDown numRangeDays;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.CheckBox chkShowPastAppointments;
}
}
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Outlook2013TodoAddIn.Forms
{
public partial class FormConfiguration : Form
{
#region "Properties"
/// <summary>
/// Number of days (including today) to retrieve appointments from in the future
/// </summary>
public decimal NumDays
{
get { return this.numRangeDays.Value; }
set { this.numRangeDays.Value = value; }
}
/// <summary>
/// Gets/sets whether mail notifications are enabled or not
/// </summary>
public bool MailAlertsEnabled
{
get { return this.chkMailAlerts.Checked; }
set { this.chkMailAlerts.Checked = value; }
}
/// <summary>
/// Gets/sets whether to show past appointments in the current day or not
/// </summary>
public bool ShowPastAppointments
{
get { return this.chkShowPastAppointments.Checked; }
set { this.chkShowPastAppointments.Checked = value; }
}
#endregion "Properties"
#region "Methods"
/// <summary>
/// Default constructor
/// </summary>
public FormConfiguration()
{
InitializeComponent();
}
/// <summary>
/// On load, display saved configuration
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void FormConfiguration_Load(object sender, EventArgs e)
{
this.numRangeDays.Value = Properties.Settings.Default.NumDays;
this.chkMailAlerts.Checked = Properties.Settings.Default.MailAlertsEnabled;
this.chkShowPastAppointments.Checked = Properties.Settings.Default.ShowPastAppointments;
}
/// <summary>
/// Clicking the OK button
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void btnOK_Click(object sender, EventArgs e)
{
Properties.Settings.Default.NumDays = this.numRangeDays.Value;
Properties.Settings.Default.MailAlertsEnabled = this.chkMailAlerts.Checked;
Properties.Settings.Default.ShowPastAppointments = this.chkShowPastAppointments.Checked;
}
#endregion "Methods"
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+122
View File
@@ -0,0 +1,122 @@
namespace Outlook2013TodoAddIn.Forms
{
partial class FormRecurringOpen
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.rbtnOne = new System.Windows.Forms.RadioButton();
this.rbtnAll = new System.Windows.Forms.RadioButton();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(45, 181);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(87, 37);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(187, 181);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(87, 37);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// rbtnOne
//
this.rbtnOne.AutoSize = true;
this.rbtnOne.Checked = true;
this.rbtnOne.Location = new System.Drawing.Point(57, 91);
this.rbtnOne.Name = "rbtnOne";
this.rbtnOne.Size = new System.Drawing.Size(109, 21);
this.rbtnOne.TabIndex = 2;
this.rbtnOne.TabStop = true;
this.rbtnOne.Text = "Just this one";
this.rbtnOne.UseVisualStyleBackColor = true;
//
// rbtnAll
//
this.rbtnAll.AutoSize = true;
this.rbtnAll.Location = new System.Drawing.Point(57, 118);
this.rbtnAll.Name = "rbtnAll";
this.rbtnAll.Size = new System.Drawing.Size(136, 21);
this.rbtnAll.TabIndex = 3;
this.rbtnAll.Text = "The entire series";
this.rbtnAll.UseVisualStyleBackColor = true;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(57, 12);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(227, 62);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "This is one appointment in a series. What do you want to open?";
//
// FormRecurringOpen
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(312, 255);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.rbtnAll);
this.Controls.Add(this.rbtnOne);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormRecurringOpen";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Open Recurring Item";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.RadioButton rbtnOne;
private System.Windows.Forms.RadioButton rbtnAll;
private System.Windows.Forms.TextBox textBox1;
}
}
@@ -0,0 +1,34 @@
using System.Windows.Forms;
namespace Outlook2013TodoAddIn.Forms
{
/// <summary>
/// Mimic Outlook's popup to open one instance or the whole series
/// </summary>
public partial class FormRecurringOpen : Form
{
#region "Properties"
/// <summary>
/// Whether the user wants to retrieve all instances or not
/// </summary>
public bool OpenRecurring
{
get { return this.rbtnAll.Checked; }
}
#endregion "Properties"
#region "Methods"
/// <summary>
/// Open the form
/// </summary>
public FormRecurringOpen()
{
InitializeComponent();
}
#endregion "Methods"
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+156
View File
@@ -0,0 +1,156 @@
namespace Outlook2013TodoAddIn.Forms
{
partial class NewMailAlert
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtBody = new System.Windows.Forms.TextBox();
this.btnDelete = new System.Windows.Forms.Button();
this.btnFlag = new System.Windows.Forms.Button();
this.btnEnvelope = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.lnkSender = new System.Windows.Forms.LinkLabel();
this.lnkSubject = new System.Windows.Forms.LinkLabel();
this.SuspendLayout();
//
// txtBody
//
this.txtBody.Cursor = System.Windows.Forms.Cursors.Hand;
this.txtBody.Location = new System.Drawing.Point(88, 47);
this.txtBody.Multiline = true;
this.txtBody.Name = "txtBody";
this.txtBody.ReadOnly = true;
this.txtBody.Size = new System.Drawing.Size(285, 51);
this.txtBody.TabIndex = 2;
this.txtBody.Click += new System.EventHandler(this.txtBody_Click);
//
// btnDelete
//
this.btnDelete.BackgroundImage = global::Outlook2013TodoAddIn.Properties.Resources.Delete;
this.btnDelete.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnDelete.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDelete.Location = new System.Drawing.Point(50, 66);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(32, 32);
this.btnDelete.TabIndex = 6;
this.btnDelete.UseVisualStyleBackColor = true;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnFlag
//
this.btnFlag.BackgroundImage = global::Outlook2013TodoAddIn.Properties.Resources.Flag;
this.btnFlag.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnFlag.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnFlag.Location = new System.Drawing.Point(12, 66);
this.btnFlag.Name = "btnFlag";
this.btnFlag.Size = new System.Drawing.Size(32, 32);
this.btnFlag.TabIndex = 5;
this.btnFlag.UseVisualStyleBackColor = true;
this.btnFlag.Click += new System.EventHandler(this.btnFlag_Click);
//
// btnEnvelope
//
this.btnEnvelope.BackgroundImage = global::Outlook2013TodoAddIn.Properties.Resources.Envelope;
this.btnEnvelope.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnEnvelope.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnEnvelope.Location = new System.Drawing.Point(19, 5);
this.btnEnvelope.Name = "btnEnvelope";
this.btnEnvelope.Size = new System.Drawing.Size(60, 60);
this.btnEnvelope.TabIndex = 8;
this.btnEnvelope.UseVisualStyleBackColor = true;
this.btnEnvelope.Click += new System.EventHandler(this.btnEnvelope_Click);
//
// btnClose
//
this.btnClose.BackgroundImage = global::Outlook2013TodoAddIn.Properties.Resources.Delete;
this.btnClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnClose.Location = new System.Drawing.Point(353, 8);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(20, 20);
this.btnClose.TabIndex = 9;
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// lnkSender
//
this.lnkSender.AutoSize = true;
this.lnkSender.Location = new System.Drawing.Point(85, 5);
this.lnkSender.Name = "lnkSender";
this.lnkSender.Size = new System.Drawing.Size(82, 17);
this.lnkSender.TabIndex = 10;
this.lnkSender.TabStop = true;
this.lnkSender.Text = "linkLabel1";
this.lnkSender.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkSender_LinkClicked);
//
// lnkSubject
//
this.lnkSubject.AutoSize = true;
this.lnkSubject.Location = new System.Drawing.Point(85, 27);
this.lnkSubject.Name = "lnkSubject";
this.lnkSubject.Size = new System.Drawing.Size(72, 17);
this.lnkSubject.TabIndex = 11;
this.lnkSubject.TabStop = true;
this.lnkSubject.Text = "linkLabel2";
this.lnkSubject.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkSubject_LinkClicked);
//
// NewMailAlert
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(385, 100);
this.Controls.Add(this.lnkSubject);
this.Controls.Add(this.lnkSender);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnEnvelope);
this.Controls.Add(this.btnDelete);
this.Controls.Add(this.btnFlag);
this.Controls.Add(this.txtBody);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "NewMailAlert";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "NewMailAlert";
this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtBody;
private System.Windows.Forms.Button btnFlag;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnEnvelope;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.LinkLabel lnkSender;
private System.Windows.Forms.LinkLabel lnkSubject;
}
}
+234
View File
@@ -0,0 +1,234 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Outlook2013TodoAddIn.Forms
{
/// <summary>
/// New form to display new emai lnotifications
/// </summary>
public partial class NewMailAlert : Form
{
#region "Variables"
/// <summary>
/// To control how long the form displays
/// </summary>
private Timer timer;
/// <summary>
/// Don't close the for if the mouse is over it
/// </summary>
private bool mouseIsOver = false;
/// <summary>
/// Show form
/// </summary>
private const int SW_SHOW = 5;
/// <summary>
/// Fading effect
/// </summary>
private const uint AW_BLEND = 0x00080000;
#endregion "Variables"
#region "Properties"
/// <summary>
/// Attached email message to open or flag
/// </summary>
public Microsoft.Office.Interop.Outlook.MailItem Email { get; set; }
/// <summary>
/// Whether to show without the form activation
/// </summary>
protected override bool ShowWithoutActivation
{
get { return true; }
}
#endregion "Properties"
#region "Methods"
/// <summary>
/// Default constructor
/// </summary>
/// <param name="newMail">Mail item</param>
/// <param name="interval">Time in ms to keep the alert on</param>
public NewMailAlert(Microsoft.Office.Interop.Outlook.MailItem newMail, int interval)
{
InitializeComponent();
this.Email = newMail; // Assign it to open or flag later
this.lnkSender.Text = newMail.Sender.Name;
this.lnkSubject.Text = newMail.Subject;
this.txtBody.Text = newMail.Body;
this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width - 10;
this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height - 10;
this.timer = new Timer();
timer.Interval = interval;
timer.Tick += timer_Tick;
timer.Start();
}
/// <summary>
/// Load and bring to fron
/// </summary>
/// <param name="e">EventArgs</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
}
this.BringToFront();
}
[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
private static extern bool AnimateWindow(IntPtr hWnd, uint dwTime, uint dwFlags);
/// <summary>
/// Method to display the form and make it topmost
/// </summary>
/// <returns>True or false</returns>
public bool ShowPopup()
{
bool result = ShowWindow(this.Handle, SW_SHOW);
//bool result = AnimateWindow(this.Handle, 200, AW_BLEND);
return result;
}
/// <summary>
/// Button delete clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void btnDelete_Click(object sender, EventArgs e)
{
this.Email.Delete();
this.Close();
}
/// <summary>
/// Button flag clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void btnFlag_Click(object sender, EventArgs e)
{
//Microsoft.Office.Interop.Outlook.OlFlagIcon.olYellowFlagIcon
this.Email.FlagRequest = "Follow up";
this.Email.Save();
this.Close();
}
/// <summary>
/// Button envelope clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void btnEnvelope_Click(object sender, EventArgs e)
{
this.ShowEmail();
}
/// <summary>
/// Button close clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
/// <summary>
/// Sender hyperlink clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">LinkLabelLinkClickedEventArgs</param>
private void lnkSender_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
this.ShowEmail();
}
/// <summary>
/// Subject hyperlink clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">LinkLabelLinkClickedEventArgs</param>
private void lnkSubject_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
this.ShowEmail();
}
/// <summary>
/// Body textbox clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void txtBody_Click(object sender, EventArgs e)
{
this.ShowEmail();
}
/// <summary>
/// Show the email and close the form
/// </summary>
private void ShowEmail()
{
this.Email.Display();
this.Close();
}
/// <summary>
/// Process timer ticks
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
private void timer_Tick(object sender, EventArgs e)
{
if (!mouseIsOver)
{
timer.Stop();
this.Close();
}
}
/// <summary>
/// Processed when the mouse enters the form
/// </summary>
/// <param name="ea">EventArgs</param>
protected override void OnMouseEnter(EventArgs ea)
{
base.OnMouseEnter(ea);
Point mousePos = PointToClient(Cursor.Position);
mouseIsOver = ClientRectangle.Contains(mousePos);
}
/// <summary>
/// Processed when the mouse exits the form
/// </summary>
/// <param name="ea">EventArgs</param>
protected override void OnMouseLeave(EventArgs ea)
{
base.OnMouseLeave(ea);
Point mousePos = PointToClient(Cursor.Position);
mouseIsOver = ClientRectangle.Contains(mousePos);
}
#endregion "Methods"
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>