Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8442887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:57:47+00:00 2026-06-10T08:57:47+00:00

I have the following simple program that switches the context of a frame back

  • 0

I have the following simple program that switches the context of a frame back and forth between two different pages. The first page is just a picture and loads fine, but the second page is a frame that’s source is set to live weather radar.
http://www.wunderground.com/auto/wxmap/IN/Carmel.html. When the timer switches the context of my frame to the weather radar page, it only then begins it’s load and spends the first 3-4 seconds loading the page. I checked the .Navigated Event of the frame at it fires pretty much right after I create the page and assign it to _nextslide, so why is my frame waiting til the page is shown to render the website? It would be perfect if I could show the site fully loaded.

XAML:

<Page>
    <Viewbox Stretch="Fill" Margin="15">
        <Frame Height="800" Width="1280" Content="{Binding SlideFrame}"/>
    </Viewbox>
</Page>

C#:

private Page _slideFrame;
private Page _nextFrame;
private DispatcherTimer _slideChangeTimer;
private int currentSlide = 1;

// Property
public Page SlideFrame
{
    get { return _slideFrame; }
    set
    {
        _slideFrame = value;
        NotifyPropertyChanged("SlideFrame");
    }
}

// ViewModel Constructor
public Page1ViewModel()
{
    this.SlideFrame = new Slide1();
    _nextFrame = new Slide2();

    _slideChangeTimer = new DispatcherTimer();
    _slideChangeTimer.Interval = TimeSpan.FromSeconds(8);
    _slideChangeTimer.Tick += new EventHandler(SlideChange_Tick);
    _slideChangeTimer.Start();
}

// 8 second timer event handler
private void SlideChange_Tick(object sender, EventArgs e)
{
    if (currentSlide == 1)
    {
        this.SlideFrame = _nextFrame;
        _nextFrame = new Slide1(false);
        currentSlide = 2;
    }
    else
    {
        this.SlideFrame = _nextFrame;
        _nextFrame = new Slide2();
        currentSlide = 1;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:57:49+00:00Added an answer on June 10, 2026 at 8:57 am

    Does not use frame or web pages but it shows how to fetch data in the background to not block the UI in a timer. You should add logic to wait if the last web page was not yet fetched.

    <Button Grid.Row="0" Content="AmIhot" Click="onClick" Width="60" HorizontalAlignment="Left"/>
    <TextBlock Grid.Row="1" x:Name="hotText" />
    <TextBlock Grid.Row="2" x:Name="revolvingText" Text="{Binding Path=RevolvingText, Mode=OneWay}" />
    
    using System.ComponentModel;
    using System.Threading;
    using System.Threading.Tasks;
    
    namespace waste09
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window, INotifyPropertyChanged
        {
            private System.Windows.Threading.DispatcherTimer _slideChangeTimer;
    
            public MainWindow()
            {
                InitializeComponent();
                this.DataContext = this;
                RevolvingText = "Starting text";
                _slideChangeTimer = new System.Windows.Threading.DispatcherTimer();
                _slideChangeTimer.Interval = TimeSpan.FromSeconds(8);
                _slideChangeTimer.Tick += new EventHandler(SlideChange_Tick);
                _slideChangeTimer.Start();
            }
    
            // 8 second timer event handler
            private void SlideChange_Tick(object sender, EventArgs e)
            {
                Task.Factory.StartNew(() =>
                {
                    // this will NOT block the UI
                    Thread.Sleep(4000);  // simulate a long fetch
                    RevolvingText = "Fetched text " + Guid.NewGuid();
                    NotifyPropertyChanged("RevolvingText");
                });
                RevolvingText = "Fetching data and UI not blocked ";
                NotifyPropertyChanged("RevolvingText");               
            }
    
            public string RevolvingText { get; private set; }
    
            private void onClick(object sender, RoutedEventArgs e)
            {
                hotText.Text = "Yes you are hot " + Guid.NewGuid();       
            }
    
            public event PropertyChangedEventHandler PropertyChanged;
            private void NotifyPropertyChanged(String info)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(info));
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make a simple program that does the following: I have two
I have following simple program: import std.stdio; int main(string[] argv) { writeln(Hello, world!); return
I have the following simple equation in my C# program to convert a number
I have a made a simple program that reproduces the problem: #include <boost/archive/text_oarchive.hpp> #include
I am writing a simple program that uses perspective projection and I have a
I have a simple x86-targeting .NET 3.5 console program that calls methods on COM
I have a simple openGL D program that compiles, but I can't get it
I have a simple openGL D program that compiles, but I can't get it
I have started learning Java and am having problem with a simple program that
I have a simple Java program that allows a user to draw rectangles on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.