0

大きな xps ドキュメントの読み込み中に UI の応答性を維持するための新しいアプローチを試みています。ボタンをクリックすると、プログレス バー (loadStatus) が開始されます。次に、新しいスレッドを開始し、「ドキュメントを開いて表示する」メソッドを呼び出します。UI が実行され、プログレス バーは機能しますが、xps ドキュメントは表示されません。以下のコードを試す前に、ボタン クリック イベントで独自にメソッドを実行したところ、問題なく動作しました。しかし、ご存知のように、プログレス バーは、ドキュメントが読み込まれて表示されるまで何もしません。だから、ここに私のコードスニペットがあります.私が間違っているかもしれないことについてのアイデアはありますか? 質問の投稿に抜けがありましたら、あらかじめお詫び申し上げます。ここに私のコードスニペットがあります:

private void maintBtn_TouchDown(object sender, TouchEventArgs e) // load and view maint manual
{
    loadStatus.IsIndeterminate = true;
    Thread thread = new Thread(getMaintDocument);
    thread.Start();  
}

private void getMaintDocument() // get and view the document
{
   XpsDocument xpsDocument = new XpsDocument(@"Resources\maintManual.xps", FileAccess.Read); 
   documentViewer1.Dispatcher.Invoke(new Action(()=> xpsDocument.GetFixedDocumentSequence()) ,DispatcherPriority.Normal);  
}
4

0 に答える 0