// Launch a .png file that came with the package. private async void LaunchFileButton_Click(object sender, RoutedEventArgs e) { // First, get the image file from the package's image directory. var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(fileToLaunch); // Next, launch the file. bool success = await Windows.System.Launcher.LaunchFileAsync(file); if (success) { rootPage.NotifyUser("File launched: " + file.Name, NotifyType.StatusMessage); } else { rootPage.NotifyUser("File launch failed.", NotifyType.ErrorMessage); } }
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); } }
void Scenarios_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Scenarios.SelectedItem != null) { rootPage.NotifyUser("", NotifyType.StatusMessage); ListBoxItem selectedListBoxItem = Scenarios.SelectedItem as ListBoxItem; SuspensionManager.SessionState["SelectedScenario"] = selectedListBoxItem.Name; if (rootPage.InputFrame != null && rootPage.OutputFrame != null) { // Load the input and output pages for the current scenario into their respective frames. rootPage.DoNavigation(Type.GetType(typeof(ScenarioList).Namespace + "." + selectedListBoxItem.Name + "Input"), rootPage.InputFrame); rootPage.DoNavigation(Type.GetType(typeof(ScenarioList).Namespace + "." + selectedListBoxItem.Name + "Output"), rootPage.OutputFrame); } } }
// Launch a URI. private async void LaunchUriButton_Click(object sender, RoutedEventArgs e) { // Create the URI to launch from a string. var uri = new Uri(uriToLaunch); // Launch the URI. bool success = await Windows.System.Launcher.LaunchUriAsync(uri); if (success) { rootPage.NotifyUser("URI launched: " + uri.AbsoluteUri, NotifyType.StatusMessage); } else { rootPage.NotifyUser("URI launch failed.", NotifyType.ErrorMessage); } }