You could subscribe to some events in SW that will tell you when something changes with your document but it will probably take some in depth programming to get them working the way you want. Each document type has its own event list. You'll have to figure out what type of document is open and then subscribe to the events that tell you when something has updated in such a way that you need to refresh your task pane.
A list of document events is below. You should be able to find these classes in the API metadata as your program.
Thank you. Alex.
I found I can initialize these data in the function ConnectToSW(xxxx), as long as the command LoadAddIn(xxx) is after opening a document.