diff --git a/Outlook2013TodoAddIn/Delete.png b/Outlook2013TodoAddIn/Delete.png new file mode 100644 index 0000000..d94c9e9 Binary files /dev/null and b/Outlook2013TodoAddIn/Delete.png differ diff --git a/Outlook2013TodoAddIn/Envelope.png b/Outlook2013TodoAddIn/Envelope.png new file mode 100644 index 0000000..e066b93 Binary files /dev/null and b/Outlook2013TodoAddIn/Envelope.png differ diff --git a/Outlook2013TodoAddIn/Flag.png b/Outlook2013TodoAddIn/Flag.png new file mode 100644 index 0000000..2bcdb54 Binary files /dev/null and b/Outlook2013TodoAddIn/Flag.png differ diff --git a/Outlook2013TodoAddIn/NewMailAlert.Designer.cs b/Outlook2013TodoAddIn/NewMailAlert.Designer.cs new file mode 100644 index 0000000..9be16f2 --- /dev/null +++ b/Outlook2013TodoAddIn/NewMailAlert.Designer.cs @@ -0,0 +1,146 @@ +namespace Outlook2013TodoAddIn +{ + partial class NewMailAlert + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblSender = new System.Windows.Forms.Label(); + this.lblSubject = new System.Windows.Forms.Label(); + 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.SuspendLayout(); + // + // lblSender + // + this.lblSender.AutoSize = true; + this.lblSender.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblSender.Location = new System.Drawing.Point(85, 11); + this.lblSender.Name = "lblSender"; + this.lblSender.Size = new System.Drawing.Size(52, 17); + this.lblSender.TabIndex = 0; + this.lblSender.Text = "label1"; + // + // lblSubject + // + this.lblSubject.AutoSize = true; + this.lblSubject.Location = new System.Drawing.Point(85, 28); + this.lblSubject.Name = "lblSubject"; + this.lblSubject.Size = new System.Drawing.Size(46, 17); + this.lblSubject.TabIndex = 1; + this.lblSubject.Text = "label1"; + // + // txtBody + // + this.txtBody.Location = new System.Drawing.Point(88, 49); + this.txtBody.Multiline = true; + this.txtBody.Name = "txtBody"; + this.txtBody.ReadOnly = true; + this.txtBody.Size = new System.Drawing.Size(214, 77); + this.txtBody.TabIndex = 2; + // + // btnDelete + // + this.btnDelete.BackgroundImage = global::Outlook2013TodoAddIn.Properties.Resources.Delete; + this.btnDelete.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnDelete.Location = new System.Drawing.Point(50, 94); + 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.Location = new System.Drawing.Point(12, 94); + 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.Location = new System.Drawing.Point(16, 17); + 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(282, 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); + // + // NewMailAlert + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(314, 140); + 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.Controls.Add(this.lblSubject); + this.Controls.Add(this.lblSender); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "NewMailAlert"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "NewMailAlert"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lblSender; + private System.Windows.Forms.Label lblSubject; + 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; + } +} \ No newline at end of file diff --git a/Outlook2013TodoAddIn/NewMailAlert.cs b/Outlook2013TodoAddIn/NewMailAlert.cs new file mode 100644 index 0000000..e664393 --- /dev/null +++ b/Outlook2013TodoAddIn/NewMailAlert.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Outlook2013TodoAddIn +{ + public partial class NewMailAlert : Form + { + public Microsoft.Office.Interop.Outlook.MailItem Email { get; set; } + + public NewMailAlert(string sender, string subject, string body) + { + InitializeComponent(); + this.lblSender.Text = sender; + this.lblSubject.Text = subject; + this.txtBody.Text = body; + } + + private void btnDelete_Click(object sender, EventArgs e) + { + this.Email.Delete(); + this.Close(); + } + + private void btnFlag_Click(object sender, EventArgs e) + { + //Microsoft.Office.Interop.Outlook.OlFlagIcon.olYellowFlagIcon + this.Email.FlagRequest = "Follow up"; + this.Email.Save(); + this.Close(); + } + + private void btnEnvelope_Click(object sender, EventArgs e) + { + this.Email.Display(); + this.Close(); + } + + private void btnClose_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} \ No newline at end of file diff --git a/Outlook2013TodoAddIn/NewMailAlert.resx b/Outlook2013TodoAddIn/NewMailAlert.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/Outlook2013TodoAddIn/NewMailAlert.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj b/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj index 1ecb855..bf4795d 100644 --- a/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj +++ b/Outlook2013TodoAddIn/Outlook2013TodoAddIn.csproj @@ -185,6 +185,12 @@ FormRecurringOpen.cs + + Form + + + NewMailAlert.cs + Code @@ -203,6 +209,9 @@ FormRecurringOpen.cs + + NewMailAlert.cs + ResXFileCodeGenerator Resources.Designer.cs @@ -244,6 +253,15 @@ + + + + + + + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/Outlook2013TodoAddIn/Properties/Resources.Designer.cs b/Outlook2013TodoAddIn/Properties/Resources.Designer.cs index 4e6f799..96756e2 100644 --- a/Outlook2013TodoAddIn/Properties/Resources.Designer.cs +++ b/Outlook2013TodoAddIn/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18010 +// Runtime Version:4.0.30319.18033 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -60,6 +60,36 @@ namespace Outlook2013TodoAddIn.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Delete { + get { + object obj = ResourceManager.GetObject("Delete", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Envelope { + get { + object obj = ResourceManager.GetObject("Envelope", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Flag { + get { + object obj = ResourceManager.GetObject("Flag", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Outlook2013TodoAddIn/Properties/Resources.resx b/Outlook2013TodoAddIn/Properties/Resources.resx index 6641111..286d282 100644 --- a/Outlook2013TodoAddIn/Properties/Resources.resx +++ b/Outlook2013TodoAddIn/Properties/Resources.resx @@ -118,6 +118,15 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Envelope.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Flag.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\2012-11-20_1546.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Outlook2013TodoAddIn/ThisAddIn.cs b/Outlook2013TodoAddIn/ThisAddIn.cs index 1f1e098..b123443 100644 --- a/Outlook2013TodoAddIn/ThisAddIn.cs +++ b/Outlook2013TodoAddIn/ThisAddIn.cs @@ -1,6 +1,7 @@ using Microsoft.Win32; using System; using System.Linq; +using System.Windows.Forms; using Office = Microsoft.Office.Core; namespace Outlook2013TodoAddIn @@ -33,6 +34,7 @@ namespace Outlook2013TodoAddIn /// EventArgs private void ThisAddIn_Startup(object sender, System.EventArgs e) { + Globals.ThisAddIn.Application.NewMailEx += Application_NewMailEx; this.AddRegistryNotification(); this.AppControl = new AppointmentsControl(); @@ -52,6 +54,29 @@ namespace Outlook2013TodoAddIn // TODO: Make sure there are no memory leaks (dispose COM objects) } + private void Application_NewMailEx(string EntryIDCollection) + { + Microsoft.Office.Interop.Outlook.MailItem newMail = Globals.ThisAddIn.Application.Session.GetItemFromID(EntryIDCollection) as Microsoft.Office.Interop.Outlook.MailItem; + if (newMail != null) + { + string sender = newMail.Sender.Name; + string subject = newMail.Subject; + string body = newMail.Body; + NewMailAlert nm = new NewMailAlert(sender, subject, body); + nm.Email = newMail; + nm.Top = 0; + nm.Left = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - nm.Width; + // this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; + nm.Show(); + if (nm.WindowState == FormWindowState.Minimized) + { + nm.WindowState = FormWindowState.Normal; + } + nm.Focus(); + nm.BringToFront(); + } + } + /// /// Store the new size setting upon resizing ///