コード例 #1
0
 internal void Close()
 {
     logger.ConditionalDebug("Close");
     // since we handle the doc closing events, it is possible to close a window without having the
     // corresponding entry removed here (if the document is opened in multiple windows). In this case
     // I was once able to produce a situation where the corresponding configTaskPane was removed from
     // customTaskPanes in the background, and when we came here, it crashed. The pane was visible in the window that was closed
     // and was reused in a new window I created. So in order to avoid crashing in this strange
     // situation let's catch the exception.
     // The only way I can think of handlicng this cleanly would be with a window closing event, but I did not find out how to
     // get it (in word)...
     // I could also try to work on open events, but there is no window open event
     // Note that the Document.Close event does not fire at all in case of multiple windows on the same document
     // which is exactly the problem I am trying to address...
     try
     {
         configTaskPane.Visible = false;
         customTaskPanes.Remove(configTaskPane);
         configTaskPane.Dispose();
         confContr.Dispose();
     }
     catch   // I do not know which kind of exception is raised in my strange case... We assume it means that everything
             // was already cleaned up.
     {
         logger.Error("Exception when closing a ConfigTaskPane");
     }
 }
コード例 #2
0
        private void ClearMiddlePannel()
        {
            songlist.Enabled = false;
            songlist.Visible = false;

            artistGrid.Enabled = false;
            artistGrid.Visible = false;

            albumGrid.Enabled  = false;
            artistGrid.Visible = false;

            albumPresentation?.Dispose();
            albumPresentation = null;

            configControl?.Dispose();
            configControl = null;
        }