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

  • Home
  • SEARCH
  • 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 8413717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:58:25+00:00 2026-06-10T00:58:25+00:00

I have a problem with re-init MainWindow objects settings. I thought that OnNavigatedTo will

  • 0

I have a problem with “re-init” MainWindow objects settings. I thought that OnNavigatedTo will call after suspending too and I have some code in MainWindow like:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
object.value = initValue;
}

But it wasn’t called after suspending. So how can do this after suspending?

  • 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-10T00:58:27+00:00Added an answer on June 10, 2026 at 12:58 am

    If you use the default templates that come with VS2012, you’ll see following code in the App.xaml.cs file:

        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;
    
            // ... took out some code here
    
                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }
    
            // ... took out some more code here    
    
            Window.Current.Activate();
        }
    

    The possible values for ApplicationExecutionState are

    public enum ApplicationExecutionState
    {
        // Summary:
        //     The app is not running.
        NotRunning = 0,
        //
        // Summary:
        //     The app is running.
        Running = 1,
        //
        // Summary:
        //     The app is suspended.
        Suspended = 2,
        //
        // Summary:
        //     The app was terminated after being suspended.
        Terminated = 3,
        //
        // Summary:
        //     The app was closed by the user.
        ClosedByUser = 4,
    }
    

    So just add another if statement for

    if (args.PreviousExecutionState == ApplicationExecutionState.Suspended)
    

    to execute the code you want to execute after a suspended state.

    To restore a previous state in the pages itself, use the LoadState and SaveState methods that are defined on the LayoutAwarePage base class of each page (or implement your own state management). The templates that come with VS2012 (eg. the Grid application) already uses all these tricks for state management and are a good way to get started.

    protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
    protected override void SaveState(Dictionary<String, Object> pageState)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the problem, I have a class MainWindow that extends JFrame in one
I have problem related with question I've set contentsScale and after that text looking
I have problem with repopulating form_upload after validation. Other input fields or selectboxes are
I have a PyQt program used to visualize some python objects. I would like
I have developed a GUI that is used to extract some data from a
I'm creating a webservice client. And I have the problem - in MainWindow.xaml there
I have a problem with this code: NSDate *today = [[NSDate alloc] init]; if
I have managed to track done a weird problem in an init script I
I have problem that is in my code i create splash screen for a
I have problem with following code. mySpriteArray=[[NSMutableArray alloc] init]; star=[CCSprite spriteWithFile:@22.png]; for(int i=0;i<10; i++)

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.