I agree with Jim.
It is up to you to create and restore the window content. The approach that I use in such a case is to store the code to create the content as an expression, then evaluate the expression to create the initial window and evaluate it again when the button is clicked.