public async Task Create(ContainerVisual rootContainer) { // Create a panning Visual that will be the entire size of all photos. _rootContainer = rootContainer; _compositor = rootContainer.Compositor; _panningContainer = _compositor.CreateContainerVisual(); _rootContainer.Children.InsertAtTop(_panningContainer); // Configure the photo database and create the initial layout. _random = new Random(); _allTiles = new List <Tile>(); _farTileHistory = new List <Tile>(); _nearTileHistory = new List <Tile>(); _photoDatabase = new PhotoDatabase(); await _photoDatabase.Create(_compositor.DefaultGraphicsDevice); CreatePlaceholderLayout(); // Start pictures loading: // - Don't load all of the pictures at once, as this will create threadpool threads for // each and will hammer the IO system, delaying everything. // - As each image arrives, connect it with a tile and start loading the next photo // until all tiles have photos. for (int i = 0; i < ConcurrentDecodeThreads; i++) { LoadNextPhoto(); } }
public async Task Create(ContainerVisual rootContainer) { // Create a panning Visual that will be the entire size of all photos. _rootContainer = rootContainer; _compositor = rootContainer.Compositor; _panningContainer = _compositor.CreateContainerVisual(); _rootContainer.Children.InsertAtTop(_panningContainer); // Configure the photo database and create the initial layout. _random = new Random(); _allTiles = new List<Tile>(); _farTileHistory = new List<Tile>(); _nearTileHistory = new List<Tile>(); _photoDatabase = new PhotoDatabase(); await _photoDatabase.Create(_compositor.DefaultGraphicsDevice); CreatePlaceholderLayout(); // Start pictures loading: // - Don't load all of the pictures at once, as this will create threadpool threads for // each and will hammer the IO system, delaying everything. // - As each image arrives, connect it with a tile and start loading the next photo // until all tiles have photos. for (int i = 0; i < ConcurrentDecodeThreads; i++) { LoadNextPhoto(); } }
private async void PictureHost_Loaded(object sender, RoutedEventArgs e) { // Check that there are photos in the pictures folder if (!await PhotoDatabase.PhotosExist()) { MessageDialog messageDialog = new MessageDialog("Add some photos to your Pictures folder"); await messageDialog.ShowAsync(); MissingPictures.Visibility = Visibility.Visible; return; } // Host the Composition scene inside the PictureHost canvas, allowing us to also display // Xaml controls. _rootVisual = GetVisual(PictureHost); _compositor = _rootVisual.Compositor; _rootVisual.Clip = _compositor.CreateInsetClip(0, 0, 0, 0); // Begin the TransitionController to load images and kick off animations. _transitionController = new TransitionController(); await _transitionController.Create(_rootVisual); var actualSize = new Vector2((float)PictureHost.ActualWidth, (float)PictureHost.ActualHeight); _transitionController.UpdateWindowSize(actualSize); NearSlideCheckBox_Click(this, null); FarSlideCheckBox_Click(this, null); FlashlightCheckBox_Click(this, null); ZoomCheckBox_Click(this, null); StackCheckBox_Click(this, null); _transitionController.NextTransition(); }