Exemplo n.º 1
0
        public ThumbnailList GetThumbnailsFromDB(int page)
        {
            ThumbnailList tList = new ThumbnailList();

            int startingIndex = 1 + (page - 1) * _defaultThumbnailsInPage;
            int endIndex      = startingIndex + (_defaultThumbnailsInPage - 1);

            using (ImageContext dbContext = new ImageContext())
            {
                if (startingIndex > dbContext.Images.Count())
                {
                    return(tList);
                }

                IQueryable <Image> images = dbContext.Images.Where(t => t.ID >= startingIndex && t.ID <= endIndex);
                foreach (Image img in images)
                {
                    Thumbnail tb = new Thumbnail();
                    tb.ID        = img.ID;
                    tb.Title     = img.Title;
                    tb.ImagePath = img.Path;
                    tList.thumbnails.Add(tb);
                }
            }
            return(tList);
        }
Exemplo n.º 2
0
 protected override void Parse(Stream s)
 {
     BinaryReader r = new BinaryReader(s);
     base.Parse(s);
     this.matdList = new MATDList(OnResourceChanged, s);
     this.thumList = new ThumbnailList(OnResourceChanged, s);
     this.unknown1 = r.ReadUInt32();
     this.colorList = new SwatchColorList(OnResourceChanged, s);
     this.catalogGroupID = r.ReadUInt64();
 }
        private void ThumbnailList_Loaded(object sender, RoutedEventArgs args)
        {
            if (_currentTransition != null)
            {
                DetailsInfo      info         = (DetailsInfo)_currentTransition.Payload;
                GridViewItem     item         = (GridViewItem)ThumbnailList.ContainerFromItem(info.thumbanil);
                CompositionImage image        = VisualTreeHelperExtensions.GetFirstDescendantOfType <CompositionImage>(item);
                ScrollViewer     scrollViewer = VisualTreeHelperExtensions.GetFirstDescendantOfType <ScrollViewer>(ThumbnailList);

                // Kick off the transition now that the page has loaded
                _currentTransition.Start(MyGrid, image, scrollViewer, ThumbnailList);
            }
        }
Exemplo n.º 4
0
 protected override Stream UnParse()
 {
     var s =  base.UnParse();
     BinaryWriter w = new BinaryWriter(s);
     if (this.matdList == null) this.matdList = new MATDList(OnResourceChanged);
     matdList.UnParse(s);
     if (this.thumList == null) this.thumList = new ThumbnailList(OnResourceChanged);
     this.thumList.UnParse(s);
     w.Write(this.unknown1);
     if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
     this.colorList.UnParse(s);
     w.Write(this.catalogGroupID);
     return s;
 }
Exemplo n.º 5
0
 public Media(XmlElement element)
 {
     Title = Util.ChildValue(element, "title");
     Player = Util.ChildValue(element, "player");
     Link = Util.ChildValue(element, "link");
     Thumbnails = new ThumbnailList();
     foreach (XmlElement child in element.GetElementsByTagName("thumbnail"))
     {
         Thumbnails.Add(new Thumbnail(child));
     }
     Content = new ContentList();
     foreach (XmlElement child in element.GetElementsByTagName("content"))
     {
         Content.Add(new Content(child));
     }
 }
Exemplo n.º 6
0
        private void ThumbnailList_ItemClick(object sender, ItemClickEventArgs e)
        {
            ListViewItem     listItem = (ListViewItem)ThumbnailList.ContainerFromItem(e.ClickedItem);
            CompositionImage image    = listItem.ContentTemplateRoot.GetFirstDescendantOfType <CompositionImage>();

            // Flip each thumbnail as it's clicked
            SpriteVisual sprite = image.SpriteVisual;

            sprite.RotationAxis = new Vector3(1, 0, 0);
            sprite.CenterPoint  = new Vector3(sprite.Size.X / 2, sprite.Size.Y / 2, 0);

            ScalarKeyFrameAnimation rotateAnimation = _compositor.CreateScalarKeyFrameAnimation();

            rotateAnimation.InsertKeyFrame(0, 0);
            rotateAnimation.InsertKeyFrame(1, 360);
            rotateAnimation.Duration = TimeSpan.FromSeconds(2);
            sprite.StartAnimation("RotationAngleInDegrees", rotateAnimation);
        }
Exemplo n.º 7
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            Compositor compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            // Get scrollviewer
            ScrollViewer myScrollViewer = ThumbnailList.GetFirstDescendantOfType <ScrollViewer>();

            _scrollProperties = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(myScrollViewer);

            // Setup the expression
            var scrollPropSet = _scrollProperties.GetSpecializedReference <ManipulationPropertySetReferenceNode>();
            var startOffset   = ExpressionValues.Constant.CreateConstantScalar("startOffset", 0.0f);
            var parallaxValue = 0.5f;
            var parallax      = (scrollPropSet.Translation.Y + startOffset);

            _parallaxExpression = parallax * parallaxValue - parallax;

            ThumbnailList.ItemsSource = LocalDataSource.RandomizeDataSource(Model.Nature);
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            Compositor compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            // Get scrollviewer
            ScrollViewer myScrollViewer = ThumbnailList.GetFirstDescendantOfType <ScrollViewer>();

            _scrollProperties = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(myScrollViewer);

            // Setup the expression
            _parallaxExpression = compositor.CreateExpressionAnimation();
            _parallaxExpression.SetScalarParameter("StartOffset", 0.0f);
            _parallaxExpression.SetScalarParameter("ParallaxValue", 0.5f);
            _parallaxExpression.SetScalarParameter("ItemHeight", 0.0f);
            _parallaxExpression.SetReferenceParameter("ScrollManipulation", _scrollProperties);
            _parallaxExpression.Expression = "(ScrollManipulation.Translation.Y + StartOffset - (0.5 * ItemHeight)) * ParallaxValue - (ScrollManipulation.Translation.Y + StartOffset - (0.5 * ItemHeight))";

            ThumbnailList.ItemsSource = Model.Items;
        }
Exemplo n.º 9
0
        public ThumbnailList SearchThumbnailsFromDB(string query, int page)
        {
            ThumbnailList tList = new ThumbnailList();

            query.Trim();

            if (query.Length < 2)
            {
                return(tList);
            }
            if (page < 1)
            {
                return(tList);
            }

            int startingIndex = 1 + (page - 1) * _defaultThumbnailsInPage;
            int endIndex      = startingIndex + (_defaultThumbnailsInPage - 1);

            using (ImageContext dbContext = new ImageContext())
            {
                IQueryable <Image> images = dbContext.Images.Where(t => t.Title.Contains(query)).OrderByDescending(t => t.ID);

                if (startingIndex > images.Count())
                {
                    return(tList);
                }

                for (int i = startingIndex; i <= endIndex && i <= images.Count(); i++)
                {
                    Image     img = images.ToList <Image>().ElementAt(i - 1);
                    Thumbnail tb  = new Thumbnail();
                    tb.ID        = img.ID;
                    tb.Title     = img.Title;
                    tb.ImagePath = img.Path;
                    tList.thumbnails.Add(tb);
                }
            }

            return(tList);
        }
Exemplo n.º 10
0
        public Hashtable FindThumbnails()
        {
            List <string> ThumbnailList;
            Hashtable     Thumbnailtable = new Hashtable();

            try
            {
                foreach (Thread thread in TObj)
                {
                    thread.Join();
                }
            }
            catch (NullReferenceException)
            {
            }
            catch (Exception)
            {
            }

            foreach (string photo in PhotoList)
            {
                string[] str = photo.Split('\\');
                string   key = str[str.Length - 2];

                if (Thumbnailtable.ContainsKey(key))
                {
                    ThumbnailList = (List <string>)Thumbnailtable[key];
                    ThumbnailList.Add(photo);
                }
                else
                {
                    ThumbnailList = new List <string>();
                    ThumbnailList.Add(photo);
                    Thumbnailtable.Add(key, ThumbnailList);
                }
            }
            return(Thumbnailtable);
        }