protected override void OnNavigatedTo(NavigationEventArgs e) { rootPage = e.Parameter as rootPage; Scenarios.SelectionChanged += new SelectionChangedEventHandler(Scenarios_SelectionChanged); // Starting scenario is the first or based upon a previous selection. ListBoxItem startingScenario = null; if (rootPage.FileEvent != null) { // Set the file launch scenario. startingScenario = this.FindName("ReceiveFile") as ListBoxItem; } else if (rootPage.ProtocolEvent != null) { // Set the protocol launch scenario. startingScenario = this.FindName("ReceiveUri") as ListBoxItem; } else if (SuspensionManager.SessionState.ContainsKey("SelectedScenario")) { String selectedScenarioName = SuspensionManager.SessionState["SelectedScenario"] as string; startingScenario = this.FindName(selectedScenarioName) as ListBoxItem; } Scenarios.SelectedItem = startingScenario != null ? startingScenario : LaunchFile; }
protected override void OnNavigatedTo(NavigationEventArgs e) { // Get a pointer to our main page rootPage = e.Parameter as rootPage; // Display the result of the file activation if we got here as a result of being activated for a file. if (rootPage.FileEvent != null) { rootPage.NotifyUser("File activation received. The number of files received is " + rootPage.FileEvent.Files.Count + ". The first received file is " + rootPage.FileEvent.Files[0].Name + ".", NotifyType.StatusMessage); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { // Get a pointer to our main page rootPage = e.Parameter as rootPage; // Display the result of the protocol activation if we got here as a result of being activated for a protocol. if (rootPage.ProtocolEvent != null) { rootPage.NotifyUser("Protocol activation received. The received URI is " + rootPage.ProtocolEvent.Uri.AbsoluteUri + ".", NotifyType.StatusMessage); } }
// Handle file activations. protected override void OnFileActivated(FileActivatedEventArgs args) { var rootFrame = new Frame(); rootFrame.Navigate(typeof(rootPage)); Window.Current.Content = rootFrame; rootPage p = rootFrame.Content as rootPage; p.RootNamespace = this.GetType().Namespace; // Shuttle the event args to the scenario selector to display the proper scenario. p.FileEvent = args; p.ProtocolEvent = null; Window.Current.Activate(); }
async protected override void OnLaunched(LaunchActivatedEventArgs args) { if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // Do an asynchronous restore. await SuspensionManager.RestoreAsync(); } var rootFrame = new Frame(); rootFrame.Navigate(typeof(rootPage)); Window.Current.Content = rootFrame; rootPage p = rootFrame.Content as rootPage; p.RootNamespace = this.GetType().Namespace; p.FileEvent = null; p.ProtocolEvent = null; Window.Current.Activate(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { // Get a pointer to our main page rootPage = e.Parameter as rootPage; }