Keep a delayed book chooser hidden after Companion window closure

This commit is contained in:
Nick Beckley 2026-11-07 17:17:22 +00:00
parent a0cee0d1f0
commit b8396ca2f9

View File

@ -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);