public IPictureDisp GetImage(IRibbonControl control) { IPictureDisp result; switch (control.Id) { case "btnSendAndArchive": result = RibbonImageHelper.Convert(Resources.SendAndArchive); break; case "btnSettings": result = RibbonImageHelper.Convert(Resources.Settings); break; case "btnAddressBook": result = RibbonImageHelper.Convert(Resources.AddressBook); break; default: result = RibbonImageHelper.Convert(Resources.Archive); break; } return(result); }
private void ConstructOutlook2007MenuBar() { objSuiteCRMMenuBar2007.Caption = "SuiteCRM"; this.btnArchive = (Office.CommandBarButton) this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnArchive.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; this.btnArchive.Caption = catalogue.GetString("Archive"); this.btnArchive.Picture = RibbonImageHelper.Convert(Resources.SuiteCRMLogo); this.btnArchive.Enabled &= this.HasCrmUserSession; this.btnArchive.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnArchive_Click); this.btnArchive.Visible = true; this.btnArchive.BeginGroup = true; this.btnArchive.TooltipText = catalogue.GetString("Archive selected emails to SuiteCRM"); this.btnArchive.Enabled = true; this.btnSettings = (Office.CommandBarButton) this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnSettings.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; this.btnSettings.Caption = catalogue.GetString("Settings"); this.btnSettings.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnSettings_Click); this.btnSettings.Visible = true; this.btnSettings.BeginGroup = true; this.btnSettings.TooltipText = catalogue.GetString("SuiteCRM Settings"); this.btnSettings.Enabled = true; this.btnSettings.Picture = RibbonImageHelper.Convert(Resources.Settings); objSuiteCRMMenuBar2007.Visible = true; }
private void Application_ItemContextMenuDisplay(Office.CommandBar CommandBar, Outlook.Selection Selection) { Outlook.Selection selection = Selection; Outlook.MailItem item1 = (Outlook.MailItem)selection[1]; Office.CommandBarButton objMainMenu = (Office.CommandBarButton)CommandBar.Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlButton, this.missing, this.missing, this.missing, this.missing); objMainMenu.Caption = "SuiteCRM Archive"; objMainMenu.Visible = true; objMainMenu.Picture = RibbonImageHelper.Convert(Resources.SuiteCRM1); objMainMenu.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.contextMenuArchiveButton_Click); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { CurrentVersion = Convert.ToInt32(Globals.ThisAddIn.Application.Version.Split('.')[0]); this.objExplorer = Globals.ThisAddIn.Application.ActiveExplorer(); SuiteCRMClient.clsSuiteCRMHelper.InstallationPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SuiteCRMOutlookAddIn"; this.settings = new clsSettings(); if (this.settings.AutoArchive) { this.objExplorer.Application.NewMailEx += new Outlook.ApplicationEvents_11_NewMailExEventHandler(this.Application_NewMail); this.objExplorer.Application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(this.Application_ItemSend); } if (CurrentVersion < 14) { this.Application.ItemContextMenuDisplay += new Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(this.Application_ItemContextMenuDisplay); var menuBar = this.Application.ActiveExplorer().CommandBars.ActiveMenuBar; objSuiteCRMMenuBar2007 = (Office.CommandBarPopup)menuBar.Controls.Add(Office.MsoControlType.msoControlPopup, missing, missing, missing, true); if (objSuiteCRMMenuBar2007 != null) { objSuiteCRMMenuBar2007.Caption = "SuiteCRM"; this.btnArvive = (Office.CommandBarButton) this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnArvive.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; this.btnArvive.Caption = "Archive"; this.btnArvive.Picture = RibbonImageHelper.Convert(Resources.SuiteCRM1); this.btnArvive.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnArchive_Click); this.btnArvive.Visible = true; this.btnArvive.BeginGroup = true; this.btnArvive.TooltipText = "Archive selected emails to SuiteCRM"; this.btnArvive.Enabled = true; this.btnSettings = (Office.CommandBarButton) this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnSettings.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; this.btnSettings.Caption = "Settings"; this.btnSettings.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnSettings_Click); this.btnSettings.Visible = true; this.btnSettings.BeginGroup = true; this.btnSettings.TooltipText = "SuiteCRM Settings"; this.btnSettings.Enabled = true; this.btnSettings.Picture = RibbonImageHelper.Convert(Resources.Settings); objSuiteCRMMenuBar2007.Visible = true; } } else { //For Outlook version 2010 and greater //var app = this.Application; //app.FolderContextMenuDisplay += new Outlook.ApplicationEvents_11_FolderContextMenuDisplayEventHander(this.app_FolderContextMenuDisplay); } SuiteCRMAuthenticate(); }
public IPictureDisp GetImage(IRibbonControl control) { switch (control.Id) { case "btnArchive": case "btnArchive1": case "btnArchive2": case "btnAddressBook": return(RibbonImageHelper.Convert(Resources.SuiteCRM1)); case "btnSettings": return(RibbonImageHelper.Convert(Resources.Settings)); } return(null); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { try { var outlookApp = this.Application; OutlookVersion = (OutlookMajorVersion)Convert.ToInt32(outlookApp.Version.Split('.')[0]); this.settings = new clsSettings(); StartLogging(settings); _syncContext = new SyncContext(outlookApp, settings); _contactSyncing = new ContactSyncing(_syncContext); _taskSyncing = new TaskSyncing(_syncContext); _appointmentSyncing = new AppointmentSyncing(_syncContext); var outlookExplorer = outlookApp.ActiveExplorer(); this.objExplorer = outlookExplorer; outlookExplorer.FolderSwitch -= objExplorer_FolderSwitch; outlookExplorer.FolderSwitch += objExplorer_FolderSwitch; // TODO: install/remove these event handlers when settings.AutoArchive changes: outlookApp.NewMailEx += new Outlook.ApplicationEvents_11_NewMailExEventHandler(this.Application_NewMail); outlookApp.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(this.Application_ItemSend); if (OutlookVersion < OutlookMajorVersion.Outlook2010) { outlookApp.ItemContextMenuDisplay += new Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(this.Application_ItemContextMenuDisplay); var menuBar = outlookExplorer.CommandBars.ActiveMenuBar; objSuiteCRMMenuBar2007 = (Office.CommandBarPopup)menuBar.Controls.Add(Office.MsoControlType.msoControlPopup, missing, missing, missing, true); if (objSuiteCRMMenuBar2007 != null) { objSuiteCRMMenuBar2007.Caption = "SuiteCRM"; this.btnArvive = (Office.CommandBarButton) this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnArvive.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; this.btnArvive.Caption = "Archive"; this.btnArvive.Picture = RibbonImageHelper.Convert(Resources.SuiteCRM1); this.btnArvive.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnArchive_Click); this.btnArvive.Visible = true; this.btnArvive.BeginGroup = true; this.btnArvive.TooltipText = "Archive selected emails to SuiteCRM"; this.btnArvive.Enabled = true; this.btnSettings = (Office.CommandBarButton) this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnSettings.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; this.btnSettings.Caption = "Settings"; this.btnSettings.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnSettings_Click); this.btnSettings.Visible = true; this.btnSettings.BeginGroup = true; this.btnSettings.TooltipText = "SuiteCRM Settings"; this.btnSettings.Enabled = true; this.btnSettings.Picture = RibbonImageHelper.Convert(Resources.Settings); objSuiteCRMMenuBar2007.Visible = true; } } else { //For Outlook version 2010 and greater //var app = this.Application; //app.FolderContextMenuDisplay += new Outlook.ApplicationEvents_11_FolderContextMenuDisplayEventHander(this.app_FolderContextMenuDisplay); } while (!this.VerifyLicenceKey()) { /* if licence key does not validate, show the settings form to allow the user to enter * a (new) key, and retry. */ this.ShowSettingsForm(); } SuiteCRMAuthenticate(); new Thread(() => SyncAndAutoArchive()).Start(); } catch (Exception ex) { log.Error("ThisAddIn.ThisAddIn_Startup", ex); } }