Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to load all tabs in the background
    text
    copied!<p>I'm new to WPF (and computer science in general) and I was given a small project from my boss where there are 5 tabs, each that go to a different site. After logging in, the user is directed to the website of the 1st tab. In the background, the 4 other tabs should be loading in the background. </p> <p>Each has the following name: "tabItem1", "tabItem2", "tabItem3", "tabItem4" up to "tabItem5" Inside each there is a up to "webBrowser5".</p> <p>I think that I have to use threading to load the pages in the background, but I'm not sure how to implement it. I tried creating 4 different threads in the MainWindow such as:</p> <pre><code>public MainWindow() { InitializeComponent(); Thread thread1 = new Thread(Update1); thread1.SetApartmentState(ApartmentState.STA); thread1.Start(); Thread thread2 = new Thread(Update2); thread2.SetApartmentState(ApartmentState.STA); thread2.Start(); Thread thread3 = new Thread(Update3); thread3.SetApartmentState(ApartmentState.STA); thread3.Start(); Thread thread4 = new Thread(Update4); thread4.SetApartmentState(ApartmentState.STA); thread4.Start(); } private void Update1() { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate() { tabItem2.Focus(); } ); } private void Update2() { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate() { tabItem3.Focus(); } ); } //...Goes up to Update4 </code></pre> <p>This seems to only focus on the last thread and also it doesn't do it the background. I appreciate any guidance and help. Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload