using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using System.Windows.Forms;
using Microsoft.Office.Core;
namespace TapiClient
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
// Custom context menu item event managed
this.
Application.
ItemContextMenuDisplay += new Microsoft.
Office.
Interop.
Outlook.
ApplicationEvents_11_ItemContextMenuDisplayEventHandler(PacktMenuItem_ItemContextMenuDisplay
); }
// Context menu item adding procedure
public void PacktMenuItem_ItemContextMenuDisplay(Microsoft.Office.Core.CommandBar PacktCommandBar, Microsoft.Office.Interop.Outlook.Selection Selection)
{
// Commadbarpopup control to context menu item
Office.CommandBarPopup pulsanteChiama1 = (Office.CommandBarPopup)PacktCommandBar.Controls.Add(Office.MsoControlType.msoControlPopup, Type.Missing,"Custom Menu Item 1", PacktCommandBar.Controls.Count + 1, Type.Missing);
// Set the tag value for the menu
pulsanteChiama1.Tag = "PacktCustomMenuItem1";
// Caption for the context menu item
pulsanteChiama1.Caption = "TAPI Chiama 1";
// Set it to visible
pulsanteChiama1.Visible = true;
Office.CommandBarButton pulsanteChiama2 = (Office.CommandBarButton)pulsanteChiama1.Controls.Add(1, missing, missing, missing, true);
pulsanteChiama2.Caption = "Chiama Dio!";
pulsanteChiama2.
Click += new Office._CommandBarButtonEvents_ClickEventHandler
(ChiamaDio
); }
public void ChiamaDio(CommandBarButton Ctrl, ref bool CancelDefault)
{
MessageBox.Show("Dio è impegnatooo!");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.
Startup += new System.
EventHandler(ThisAddIn_Startup
); this.
Shutdown += new System.
EventHandler(ThisAddIn_Shutdown
); }
#endregion
}
}