PresentationView PresentationView {get;}
ReadOnly Property PresentationView As PresentationView
PresentationView PresentationView {get;}
ReadOnly Property PresentationView As PresentationView
{
//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("Presentation Name"));
//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
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)