private void Run(string officeAppName) { try { _wait = true; ShowWaitPanel(true); treeViewOfficeUI.Nodes.Clear(); _officeApplication = new ApplicationWrapper(officeAppName); buttonCloseOfficeApp.Enabled = true; foreach (OfficeApi.CommandBar commandBar in _officeApplication.CommandBars) { string itemName = commandBar.Name; TreeNode node = treeViewOfficeUI.Nodes.Add(itemName); _waitControl.ReportProgress(itemName); node.ImageIndex = 0; node.Tag = commandBar; node.Nodes.Add("#stub"); } } catch (Exception exception) { throw exception; } finally { HideWaitPanel(); _wait = false; } }
private void DisposeCurrentOpenOfficeApplication() { if (null != _officeApplication) { _officeApplication.Quit(); _officeApplication.Dispose(); _officeApplication = null; } buttonCloseOfficeApp.Enabled = false; propertyGridItems.SelectedObject = null; treeViewOfficeUI.Nodes.Clear(); }