/// <summary> /// /// </summary> /// <param name="info"></param> /// <param name="coverPos"></param> /// <param name="currentPos"></param> /// <param name="model"></param> public Cover(ImageInfo info, int coverPos, int currentPos, ModelVisual3D model) { pos = coverPos; try { imageName = new FileInfo(info.Path).Name; } catch(Exception) { imageName = new FileInfo("/Media/Imagenes/noimage.png").Name; } visualModel = model; try { imageSource = LoadImageSource(info); } catch (Exception) { ImageInfo im = new ImageInfo(Environment.MachineName, System.Configuration.ConfigurationManager.AppSettings["noimage"], "", "", 0,0,""); imageSource = LoadImageSource(im); } modelGroup = new Model3DGroup(); modelGroup.Children.Add(new GeometryModel3D(Tessellate(), LoadImage(imageSource))); modelGroup.Children.Add(new GeometryModel3D(TessellateMirror(), LoadImageMirror(imageSource))); rotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), RotationAngle(currentPos)); translation = new TranslateTransform3D(TranslationX(currentPos), 0, TranslationZ(currentPos)); var transformGroup = new Transform3DGroup(); transformGroup.Children.Add(new RotateTransform3D(rotation)); transformGroup.Children.Add(translation); modelGroup.Transform = transformGroup; Content = modelGroup; visualModel.Children.Add(this); }
/// <summary> /// /// </summary> /// <param name="info"></param> private void Add(ImageInfo info) { imageList.Add(imageList.Count, info); UpdateRange(index); }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <returns></returns> private static ImageSource LoadImageSource(ImageInfo info) { if (thumbCache == null) throw new InvalidOperationException("No thumbnail cache."); return thumbCache.GetThumbnail(info.Host, info.Path); }