private CustomTaskPane FindTaskPane(_Document document, UserControl content) { if (document == null) { return(null); } return(CustomTaskPanes.FirstOrDefault(pane => (pane.Control == content) && (pane.Window == document.ActiveWindow))); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { var container = new UnityContainer(); container.RegisterSingleton <IHashTagsViewModel, HashTagsViewModel>(); container.RegisterInstance <IAddIn>(this); vm = container.Resolve <IHashTagsViewModel>(); this.Application.DocumentBeforeSave += Application_DocumentBeforeSave; CustomTaskPane pane = CustomTaskPanes.FirstOrDefault(p => p.Title == paneName) ?? this.CustomTaskPanes.Add(container.Resolve <HashTagsForm>(), paneName); //pane.Visible = true; Panes.HashTags = pane; }