public InspectorWrapper(MSOutlook.Inspector Inspector, InstantLookup<MSOutlook.Inspector> InstantLookup) { inspector = Inspector; ((MSOutlook.InspectorEvents_Event)inspector).Activate += InspectorWrapper_Activate; ((MSOutlook.InspectorEvents_Event)inspector).Deactivate += InspectorWrapper_Deactivate; ((MSOutlook.InspectorEvents_Event)inspector).Close += InspectorWrapper_Close; instantLookup = InstantLookup; instantLookup.OnLemmaFound += InstantLookup_OnLemmaFound; taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new LookupPane(), "German Grammar", inspector); taskPane.Visible = Properties.Settings.Default.LookupPaneVisible; taskPane.Width = Properties.Settings.Default.LookupPaneWidth; taskPane.Control.Tag = taskPane; taskPane.Control.SizeChanged += Control_SizeChanged; }
public InspectorWrapper(MSOutlook.Inspector Inspector, InstantLookup <MSOutlook.Inspector> InstantLookup) { inspector = Inspector; ((MSOutlook.InspectorEvents_Event)inspector).Activate += InspectorWrapper_Activate; ((MSOutlook.InspectorEvents_Event)inspector).Deactivate += InspectorWrapper_Deactivate; ((MSOutlook.InspectorEvents_Event)inspector).Close += InspectorWrapper_Close; instantLookup = InstantLookup; instantLookup.OnLemmaFound += InstantLookup_OnLemmaFound; taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new LookupPane(), "German Grammar", inspector); taskPane.Visible = Properties.Settings.Default.LookupPaneVisible; taskPane.Width = Properties.Settings.Default.LookupPaneWidth; taskPane.Control.Tag = taskPane; taskPane.Control.SizeChanged += Control_SizeChanged; }
private void ThisAddIn_Startup(object sender, EventArgs e) { db = LemmaDatabase.CreateDefaultInstance(); repo = new NounRepository(db); instantLookup = new InstantLookup <MSOutlook.Inspector>(new OutlookActiveTextStrategy(Application), 250, repo); instantLookup.Paused = true; // pause it, opening a window will unpause it... instantLookup.Enabled = Properties.Settings.Default.InstantLookupEnabled; inspectors = Application.Inspectors; inspectors.NewInspector += Inspectors_NewInspector; foreach (MSOutlook.Inspector inspector in inspectors) { Inspectors_NewInspector(inspector); } }
private void ThisAddIn_Startup(object sender, EventArgs e) { db = LemmaDatabase.CreateDefaultInstance(); repo = new NounRepository(db); instantLookup = new InstantLookup <MSWord.Document>(new WordActiveTextStrategy(Application), 250, repo); instantLookup.OnLemmaFound += InstantLookup_OnLemmaFound; if (taskPaneVisible) { AddAllTaskPanes(); } ((MSWord.ApplicationEvents4_Event)Application).NewDocument += ThisAddIn_NewDocument; Application.DocumentOpen += Application_DocumentOpen; Application.DocumentChange += Application_DocumentChange; ToggleInstantLookup(this, instantLookupEnabled, null); }
private void InspectorWrapper_Close() { taskPane.Control.SizeChanged -= Control_SizeChanged; Globals.ThisAddIn.CustomTaskPanes.Remove(taskPane); taskPane = null; instantLookup.Paused = true; instantLookup.OnLemmaFound -= InstantLookup_OnLemmaFound; instantLookup = null; Globals.ThisAddIn.InspectorWrappers.Remove(inspector); ((MSOutlook.InspectorEvents_Event)inspector).Close -= InspectorWrapper_Close; ((MSOutlook.InspectorEvents_Event)inspector).Deactivate -= InspectorWrapper_Deactivate; ((MSOutlook.InspectorEvents_Event)inspector).Activate -= InspectorWrapper_Activate; inspector = null; Properties.Settings.Default.Save(); //need to do this here, as I can't do it in the shutdown of the addon... }
private void ThisAddIn_Startup(object sender, EventArgs e) { db = LemmaDatabase.CreateDefaultInstance(); repo = new NounRepository(db); instantLookup = new InstantLookup<MSWord.Document>(new WordActiveTextStrategy(Application), 250, repo); instantLookup.OnLemmaFound += InstantLookup_OnLemmaFound; if (taskPaneVisible) { AddAllTaskPanes(); } ((MSWord.ApplicationEvents4_Event)Application).NewDocument += ThisAddIn_NewDocument; Application.DocumentOpen += Application_DocumentOpen; Application.DocumentChange += Application_DocumentChange; ToggleInstantLookup(this, instantLookupEnabled, null); }