diff --git a/PlotDirector.NativeCompanion/Agent/TrayApplication.cs b/PlotDirector.NativeCompanion/Agent/TrayApplication.cs index 5cae37ef..45d9b954 100644 --- a/PlotDirector.NativeCompanion/Agent/TrayApplication.cs +++ b/PlotDirector.NativeCompanion/Agent/TrayApplication.cs @@ -71,7 +71,7 @@ internal sealed class CompanionWindow:Form if(choosingBook)return;choosingBook=true; try{ if(Current==null){error="Open a manuscript in Word before choosing a book.";return;} - var session=selected;await cloud.CheckConnection();if(IsDisposed)return; + var session=selected;await cloud.CheckConnection();if(IsDisposed||!Visible)return; var current=control.PresentationDocuments.FirstOrDefault(d=>d.Session==session);if(current==null)throw new InvalidOperationException("That Word document closed while books were refreshing."); using var dialog=new Form{Text="Choose a PlotDirector book",Icon=brand,Font=Font,AutoScaleMode=AutoScaleMode.Dpi,MinimumSize=new(440,260),Size=new(540,300),StartPosition=FormStartPosition.CenterParent}; var stack=Stack(20);dialogNotice=Label();stack.Controls.Add(Label("Associate this manuscript with a book in your account. Manuscript text is not sent or changed."));books.DataSource=cloud.Status().Books;books.SelectedItem=cloud.Status().Books.FirstOrDefault(b=>b.BookId==current.Book);stack.Controls.Add(books);