23 lines
808 B
C#
23 lines
808 B
C#
using System;
|
|
using System.Windows.Forms;
|
|
using Office = Microsoft.Office.Core;
|
|
|
|
namespace PlotDirector.WordAddIn
|
|
{
|
|
public sealed partial class ThisAddIn
|
|
{
|
|
private WordAdapter adapter;
|
|
private NativeRibbon ribbon;
|
|
private void InternalStartup()
|
|
{
|
|
Startup += (_, __) => {
|
|
try { adapter = new WordAdapter(Application, () => ribbon?.Invalidate()); }
|
|
catch (Exception) { /* Companion failure must not prevent Word startup. Diagnostics remains available. */ }
|
|
};
|
|
Shutdown += (_, __) => { try { adapter?.Dispose(); } catch (Exception) { } };
|
|
}
|
|
protected override Office.IRibbonExtensibility CreateRibbonExtensibilityObject()
|
|
=> ribbon = new NativeRibbon(() => adapter);
|
|
}
|
|
}
|