From 41ccd3849d50d48c7777ad0117e72e397ec59d61 Mon Sep 17 00:00:00 2001
From: Patrick Simpson
Date: Wed, 15 Mar 2017 11:27:35 +0100
Subject: [PATCH] [KOE-87] Changed the event used to initialize the plugin. The
original event was sometimes invoked after the ribbon was initialised, which
meant buttons did not show up.
---
.../AcaciaZPushPlugin/ThisAddIn.cs | 34 +++++++------------
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs
index bc60279..c622f44 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs
@@ -29,6 +29,7 @@ using System.Globalization;
using Acacia.UI.Outlook;
using Acacia.Stubs;
using Acacia.Stubs.OutlookWrappers;
+using Microsoft.Office.Tools.Ribbon;
namespace Acacia
{
@@ -77,7 +78,16 @@ namespace Acacia
#region Startup / Shutdown
- private void ThisAddIn_Startup(object sender, System.EventArgs args)
+ private void InternalStartup()
+ {
+ // Do nothing
+ }
+
+ ///
+ /// [KOE-87] Use this event rather than Startup, as that is invoked after the ribbon UI is queried, which leads
+ /// to an empty - and therefore invisible - ribbon.
+ ///
+ public override void BeginInit()
{
try
{
@@ -145,7 +155,6 @@ namespace Acacia
Acacia.Features.DebugSupport.Statistics.StartupTime.Stop();
foreach (Feature feature in Features)
feature.AfterStartup();
-
}
catch (System.Exception e)
{
@@ -171,12 +180,6 @@ namespace Acacia
}
}
- private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
- {
- // Note: Outlook no longer raises this event. If you have code that
- // must run when Outlook shuts down, see http://go.microsoft.com/fwlink/?LinkId=506785
- }
-
#endregion
#region Ribbons
@@ -209,19 +212,6 @@ namespace Acacia
}
#endregion
-
- #region VSTO generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InternalStartup()
- {
- this.Startup += new System.EventHandler(ThisAddIn_Startup);
- this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
- }
-
- #endregion
+
}
}