Starting a Store app from a secondary RRS feed

  • Question

  • Hi

    I have a Windows Store App that loads the data from azure mobile services. The App creates a secondary tile. When the App is open and the tile clicked, the app navigates to the intended page (SplitPage). But when the App is closed the page comes up blank. I think this is because the data has not yet completed loading from azure,  when launched form the secondary tile. I have included the OnLaunched called from App.xaml.cs

    The SplintPage throws a null error:

      error: {"Object reference not set to an instance of an object."} on 

     this.DefaultViewModel["Group"] = item.Group;

     var item = AlbumDataSource.GetItem((int)navigationParameter);
                this.DefaultViewModel["Group"] = item.Group;
                this.DefaultViewModel["Items"] = item.Group.Items;
                this.itemListView.SelectedItem = item;

    protected override async void OnLaunched(LaunchActivatedEventArgs args) { AcquirePushChannel(); Frame rootFrame = Window.Current.Content as Frame;

    //***** wokrs while running************** if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Int32 xcovert1 = Convert.ToInt32(args.Arguments); if (!String.IsNullOrEmpty(args.Arguments)) ((Frame)Window.Current.Content).Navigate(typeof(SplitPageFirst), xcovert1); // args.Arguments); Window.Current.Activate(); return; } // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); // Associate the frame with a SuspensionManager key SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); //**** If the app was activated from a secondary tile while Closed**** if (!String.IsNullOrEmpty(args.Arguments)) { Int32 xcovert = Convert.ToInt32(args.Arguments); rootFrame.Navigate(typeof(SplitPage), xcovert); // args.Arguments); Window.Current.Content = rootFrame; Window.Current.Activate(); return; } 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 } } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } } // Ensure the current window is active Window.Current.Activate(); }

    Friday, March 22, 2013 10:51 PM

All replies

  • Hi Andy,

    What are you doing to ensure the data is loaded correctly before you are using it?

    How are you loading the data?


    Jeff Sanders (MSFT)

    Monday, March 25, 2013 12:50 PM