From b8396ca2f9247a5e577e031a4490d5f4bdb6265f Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Sat, 7 Nov 2026 17:17:22 +0000 Subject: [PATCH] Keep a delayed book chooser hidden after Companion window closure --- PlotDirector.NativeCompanion/Agent/TrayApplication.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);