Added context menu option to delete appointments
This commit is contained in:
parent
128a45b394
commit
776d7462bf
17
Outlook2013TodoAddIn/AppointmentsControl.Designer.cs
generated
17
Outlook2013TodoAddIn/AppointmentsControl.Designer.cs
generated
@ -41,6 +41,7 @@
|
|||||||
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.panelCalendar = new System.Windows.Forms.Panel();
|
this.panelCalendar = new System.Windows.Forms.Panel();
|
||||||
this.apptCalendar = new Outlook2013TodoAddIn.CustomCalendar();
|
this.apptCalendar = new Outlook2013TodoAddIn.CustomCalendar();
|
||||||
|
this.mnuItemDeleteAppointment = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ctxMenuAppointments.SuspendLayout();
|
this.ctxMenuAppointments.SuspendLayout();
|
||||||
this.panel1.SuspendLayout();
|
this.panel1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
@ -53,14 +54,15 @@
|
|||||||
// ctxMenuAppointments
|
// ctxMenuAppointments
|
||||||
//
|
//
|
||||||
this.ctxMenuAppointments.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.ctxMenuAppointments.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.mnuItemReplyAllEmail});
|
this.mnuItemReplyAllEmail,
|
||||||
|
this.mnuItemDeleteAppointment});
|
||||||
this.ctxMenuAppointments.Name = "ctxMenuAppointments";
|
this.ctxMenuAppointments.Name = "ctxMenuAppointments";
|
||||||
this.ctxMenuAppointments.Size = new System.Drawing.Size(214, 28);
|
this.ctxMenuAppointments.Size = new System.Drawing.Size(225, 80);
|
||||||
//
|
//
|
||||||
// mnuItemReplyAllEmail
|
// mnuItemReplyAllEmail
|
||||||
//
|
//
|
||||||
this.mnuItemReplyAllEmail.Name = "mnuItemReplyAllEmail";
|
this.mnuItemReplyAllEmail.Name = "mnuItemReplyAllEmail";
|
||||||
this.mnuItemReplyAllEmail.Size = new System.Drawing.Size(213, 24);
|
this.mnuItemReplyAllEmail.Size = new System.Drawing.Size(224, 24);
|
||||||
this.mnuItemReplyAllEmail.Text = "Reply All With Email";
|
this.mnuItemReplyAllEmail.Text = "Reply All With Email";
|
||||||
this.mnuItemReplyAllEmail.Click += new System.EventHandler(this.mnuItemReplyAllEmail_Click);
|
this.mnuItemReplyAllEmail.Click += new System.EventHandler(this.mnuItemReplyAllEmail_Click);
|
||||||
//
|
//
|
||||||
@ -181,6 +183,7 @@
|
|||||||
this.apptCalendar.SelectedBackColor = System.Drawing.Color.LightBlue;
|
this.apptCalendar.SelectedBackColor = System.Drawing.Color.LightBlue;
|
||||||
this.apptCalendar.SelectedDate = new System.DateTime(2013, 5, 2, 0, 0, 0, 0);
|
this.apptCalendar.SelectedDate = new System.DateTime(2013, 5, 2, 0, 0, 0, 0);
|
||||||
this.apptCalendar.SelectedForeColor = System.Drawing.Color.Blue;
|
this.apptCalendar.SelectedForeColor = System.Drawing.Color.Blue;
|
||||||
|
this.apptCalendar.ShowWeekNumbers = false;
|
||||||
this.apptCalendar.Size = new System.Drawing.Size(258, 230);
|
this.apptCalendar.Size = new System.Drawing.Size(258, 230);
|
||||||
this.apptCalendar.TabIndex = 1;
|
this.apptCalendar.TabIndex = 1;
|
||||||
this.apptCalendar.TodayBackColor = System.Drawing.Color.Blue;
|
this.apptCalendar.TodayBackColor = System.Drawing.Color.Blue;
|
||||||
@ -189,6 +192,13 @@
|
|||||||
this.apptCalendar.SelectedDateChanged += new System.EventHandler(this.apptCalendar_SelectedDateChanged);
|
this.apptCalendar.SelectedDateChanged += new System.EventHandler(this.apptCalendar_SelectedDateChanged);
|
||||||
this.apptCalendar.ConfigurationButtonClicked += new System.EventHandler(this.apptCalendar_ConfigurationButtonClicked);
|
this.apptCalendar.ConfigurationButtonClicked += new System.EventHandler(this.apptCalendar_ConfigurationButtonClicked);
|
||||||
//
|
//
|
||||||
|
// mnuItemDeleteAppointment
|
||||||
|
//
|
||||||
|
this.mnuItemDeleteAppointment.Name = "mnuItemDeleteAppointment";
|
||||||
|
this.mnuItemDeleteAppointment.Size = new System.Drawing.Size(224, 24);
|
||||||
|
this.mnuItemDeleteAppointment.Text = "Delete appointment/s";
|
||||||
|
this.mnuItemDeleteAppointment.Click += new System.EventHandler(this.mnuItemDeleteAppointment_Click);
|
||||||
|
//
|
||||||
// AppointmentsControl
|
// AppointmentsControl
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
@ -221,6 +231,7 @@
|
|||||||
private System.Windows.Forms.ColumnHeader columnHeader4;
|
private System.Windows.Forms.ColumnHeader columnHeader4;
|
||||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||||
private System.Windows.Forms.Panel panelCalendar;
|
private System.Windows.Forms.Panel panelCalendar;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuItemDeleteAppointment;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -400,6 +400,8 @@ namespace Outlook2013TodoAddIn
|
|||||||
if (appt.IsRecurring)
|
if (appt.IsRecurring)
|
||||||
{
|
{
|
||||||
FormRecurringOpen f = new FormRecurringOpen();
|
FormRecurringOpen f = new FormRecurringOpen();
|
||||||
|
f.Title = "Open Recurring Item";
|
||||||
|
f.Message = "This is one appointment in a series. What do you want to open?";
|
||||||
if (f.ShowDialog() == DialogResult.OK)
|
if (f.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (f.OpenRecurring)
|
if (f.OpenRecurring)
|
||||||
@ -457,6 +459,49 @@ namespace Outlook2013TodoAddIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows to delete the selected appointment (whether it's a recurring one or not)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">Sender</param>
|
||||||
|
/// <param name="e">EventArgs</param>
|
||||||
|
private void mnuItemDeleteAppointment_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.lstAppointments.SelectedIndices.Count != 0)
|
||||||
|
{
|
||||||
|
Outlook.AppointmentItem appt = this.lstAppointments.SelectedItems[0].Tag as Outlook.AppointmentItem;
|
||||||
|
if (appt != null)
|
||||||
|
{
|
||||||
|
if (appt.IsRecurring)
|
||||||
|
{
|
||||||
|
FormRecurringOpen f = new FormRecurringOpen();
|
||||||
|
f.Title = "Warning: Delete Recurring Item";
|
||||||
|
f.Message = "This is one appointment in a series. What do you want to delete?";
|
||||||
|
if (f.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (f.OpenRecurring)
|
||||||
|
{
|
||||||
|
Outlook.AppointmentItem masterAppt = appt.Parent; // Get the master appointment item
|
||||||
|
masterAppt.Delete(); // Will delete ALL instances
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appt.Delete(); // Delete just this instance
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Are you sure you want to delete this appointment?", "Delete appointment", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
appt.Delete(); // Delete just this instance
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// At the end, synchronously "refresh" appointments in case they have changed
|
||||||
|
this.RetrieveAppointments();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Switch to the calendar view when double-clicking a date
|
/// Switch to the calendar view when double-clicking a date
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -106,6 +106,7 @@
|
|||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "Open Recurring Item";
|
this.Text = "Open Recurring Item";
|
||||||
|
this.Load += new System.EventHandler(this.FormRecurringOpen_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
@ -17,18 +17,40 @@ namespace Outlook2013TodoAddIn.Forms
|
|||||||
get { return this.rbtnAll.Checked; }
|
get { return this.rbtnAll.Checked; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To reuse the form, gets/sets the title
|
||||||
|
/// </summary>
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To reuse the form, gets/sets the message
|
||||||
|
/// </summary>
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
#endregion "Properties"
|
#endregion "Properties"
|
||||||
|
|
||||||
#region "Methods"
|
#region "Methods"
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Open the form
|
/// Load the form
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormRecurringOpen()
|
public FormRecurringOpen()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load the form
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">Sender</param>
|
||||||
|
/// <param name="e">EventArgs</param>
|
||||||
|
private void FormRecurringOpen_Load(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
this.Text = this.Title;
|
||||||
|
this.textBox1.Text = this.Message;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion "Methods"
|
#endregion "Methods"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user