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 7846299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:32:17+00:00 2026-06-02T17:32:17+00:00

When my app start I want to show splash screen and create httpwebrequest and

  • 0

When my app start I want to show splash screen and create httpwebrequest and when request is finish hide splash screen and show main page.

This is my splash screen:

    private void ShowPopup()
    {
        this.popup = new Popup();
        this.popup.Child = new PopupSplash();
        this.popup.IsOpen = true;
        StartLoadingData();
    }

    private void StartLoadingData()
    {
        backgroundWorker = new BackgroundWorker();
        backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork);
        backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
        backgroundWorker.RunWorkerAsync();
    }

    void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
        this.Dispatcher.BeginInvoke(() =>
            {
                this.popup.IsOpen = false;
            }
        );
    }

    void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
    {

        using (var db = new ListDataContext(ListDataContext.DBConnectionString))
        {
            if (!db.DatabaseExists())
            {
                db.CreateDatabase();
            }
        }
        Thread.Sleep(4000);
    }

and this is my httpwebrequest:

    private void main_WebResponseAvailableEventHandler(object sender, string response, string url)
    {
            SearchResult result = new SearchResult(response, url);

            PhoneApplicationService.Current.State["result"] = result;
            this.NavigationService.Navigate(new Uri("/SearchPivotPage.xaml", UriKind.Relative));
    }

    private void HandleWebResponse(IAsyncResult asyncResult)
    {
        WebRequestState state = (WebRequestState)asyncResult.AsyncState;
        HttpWebRequest request = state.Request;
        string url = request.RequestUri.ToString();
        state.Response = (HttpWebResponse)request.EndGetResponse(asyncResult);

        if (state.Response != null)
        {
            StreamReader reader = new StreamReader(state.Response.GetResponseStream());
            StringBuilder sb = new StringBuilder();
            while (!reader.EndOfStream)
                sb.Append(reader.ReadLine());
            string text = sb.ToString();
            Dispatcher.BeginInvoke(() =>
            {
                if (WebResponseAvailable != null)
                {
                    WebResponseAvailable(this, text, url);
                }
            });
        }
    }

in constructor MainPage()

        ....
        ShowPopup();
        HttpWebRequest movieRequest = (HttpWebRequest)WebRequest.Create(url);
        WebRequestState state = new WebRequestState();
        state.Request = movieRequest;
        movieRequest.BeginGetResponse(new AsyncCallback(HandleWebResponse), state);
        WebResponseAvailable += main_WebResponseAvailableEventHandler;
        ....

Is there a way how can I do what I want? Or that both are in other thread this isn´t possible?

  • 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-02T17:32:19+00:00Added an answer on June 2, 2026 at 5:32 pm

    You could create a fake splashScreen by adding a new SplashScreenPage.xaml page instead of SpalshScreen.jpg file. If you delete SplashScreen.jpg file the first page that should be loaded (from App.xaml) will be SplashScreenPage.xaml and there you can perform any operation like webrequest as you pointed out above. Once webrequest ends then do navigate to mainPage.xaml and then call RemoveBackEntry method in order to make MainPage.xaml the first page entry in the BackStack.

    Regards,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i create some project but when start App. How to Run this App one
Everytime I launch an app I want to show a view and this view
i have create map in app. i want to show check-ins in it. i
When the user start the app I want it show the stockholm.xib and It
I want to show the splash screen only once during the Application life cycle.
I want to have a splash screen show up for a few seconds before
My app has has an option to show screen-B instead of screen-A (default main)
I want to start using .NET 3.5 features in an app that is currently
I have a tab-based iPhone app where I want to increase the perceived start-up
So i found System.Diagnostics.Process.Start() But, then i want to close app which started it

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.