//Assume we want to open a view for a particular presentation or activate a view if one is already open
//A presentation project item is an item that appears in the Presentation folder in the Catalog pane.
PresentationProjectItem presentationItem = Project.Current.GetItems<PresentationProjectItem>()
.FirstOrDefault(item => item.Name.Equals(presentationName));
//Reference a presentation associated with a presentation project item
if (presentationItem != null)
{
//Get the presentation associated with the presentationItem
Presentation presentationToOpen = await QueuedTask.Run(() => presentationItem.GetPresentation());
//Next check to see if a presentation view is already open that references the presentation
foreach (var pane in ProApp.Panes)
{
var prePane = pane as IPresentationPane;
if (prePane == null) // Not a presentation view, continue to the next pane
continue;
//if there is a match, activate the view
if (prePane.PresentationView.Presentation == presentationToOpen)
{
(prePane as Pane).Activate();
return;
}
}
//No pane found, activate a new one - must be called on UI
IPresentationPane iNewPresentationPane = await ProApp.Panes.CreatePresentationPaneAsync(presentationToOpen); //GUI thread
}