OneNote Add-in Development: How to navigate to certain page without getting stuck?

101 Views Asked by At

I am writing an add-in for OneNote with . It’s function is to navigate to certain page when double-click a node in treeview, which exhibits the structure of OneNote Notebook-Section-Pages hierarchy.

This is what I do:

        private void treeView_NodeDbClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode SelectedNode = e.Node;
            string SeletedNodeID = GetSeletedNodeID(SelectedNode).Last();
            try
            {
                _oneNoteApp.NavigateTo(SeletedNodeID);
                this.Dispose();
                this.Close();
            }
            catch
            {
                MessageBox.Show("Failed to navigate!");            
            }
            
        }

But when I double-click the node in the treeview. OneNote appears to get "stuck" whilst the OneNote process in Task Manager says:

not responding.

Any solution for this problem? It would be highly appreciated.

0

There are 0 best solutions below