private void MakeIcons() { string[] thumbnails = this.directories.Directories; foreach (string path in thumbnails) { string newPath = path + MainWindowContoller.POSTER; try { BitmapImage img = new BitmapImage(new Uri(newPath, UriKind.RelativeOrAbsolute)); MoreInfoIcon thumbnail = new MoreInfoIcon(); thumbnail.Close.Visibility = Visibility.Collapsed; this.Genre.Text = this.genreName; thumbnail.Icon.Source = img; thumbnail.Description = directories.LoadDescription(path + MainWindowContoller.DESCRIPTION); thumbnail.ButtonLabel.Content = directories.Title; // find the name of the file from the path // photoTile.ImageTitle.Text = path.Split('\\').Last().Split('.').First(); // Subscribe to the PhotoTile's MouseDown event // photoTile.MouseDown += new MouseButtonEventHandler(photoTile_MouseDown); // Add the PhotoTile to the PhotoViewerGrid // thumbnail.Close.Visibility thumbnail.MouseDown += Thumbnail_MouseDown; Movies.UniformGrid.Children.Add(thumbnail); } catch (Exception e) { } } }
void MakeIcons() { // Retrieve the paths string[] thumbnails = this.directories.Directories; // For each path // Create a PhotoTile // add the image lead to by the path // add the title of the image // add the PhotoTile to the PhotoViewerGrid foreach (string path in thumbnails) { try { // grab the image from the path string newPath = path + POSTER; Uri uri = new Uri(newPath); BitmapImage img = new BitmapImage(uri); MoreInfoIcon thumbnail = new MoreInfoIcon(); // set the source of the Image control to the image we got from the path thumbnail.Icon.Source = img; thumbnail.Description = directories.LoadDescription(path + DESCRIPTION); thumbnail.ButtonLabel.Content = directories; thumbnail.MouseDown += Thumbnail_MouseDown; // find the name of the file from the path // photoTile.ImageTitle.Text = path.Split('\\').Last().Split('.').First(); // Subscribe to the PhotoTile's MouseDown event // photoTile.MouseDown += new MouseButtonEventHandler(photoTile_MouseDown); // Add the PhotoTile to the PhotoViewerGrid //MovieElement.UniformGrid.Children.Add(thumbnail); //Create Separate event handlers for every type } catch (Exception e) { // Do nothing } } }