Ejemplo n.º 1
0
        /// <summary>
        /// Called when the item is removed from the river by the user.
        /// </summary>
        /// <returns>Sizing restrictions for the item once its in the river.</returns>
        internal override RiverSize Removed()
        {
            RiverSize riverSize = new RiverSize {
                MaxSize = DesiredSize, RemovedSize = DesiredSize, MinSize = DesiredSize
            };

            return(riverSize);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when the item is removed from the river by the user.
        /// </summary>
        /// <returns>Sizing restrictions for the item once its in the river.</returns>
        internal override RiverSize Removed()
        {
            _flashOn.Begin(this, Template);
            _nextState = null;

            RiverSize riverSize = new RiverSize {
                MaxSize = DesiredSize, RemovedSize = DesiredSize, MinSize = DesiredSize
            };

            if (_feedItem is ImageFeedItem)
            {
                double longestWidth  = Settings.Default.MinImageSize.Width + ((Settings.Default.MaxImageSize.Width - Settings.Default.MinImageSize.Width) / 2);
                double longestHeight = Settings.Default.MinImageSize.Height + ((Settings.Default.MaxImageSize.Height - Settings.Default.MinImageSize.Height) / 2);
                double longestSide   = Math.Min(longestWidth, longestHeight) + (Math.Abs(longestWidth - longestHeight) / 2);

                // Grow to a size that's the same aspect ratio as the image, but clamped to longestSide.
                riverSize.RemovedSize = (_feedItem as ImageFeedItem).ThumbnailSize;

                if (riverSize.RemovedSize.Width == 0 && riverSize.RemovedSize.Height == 0)
                {
                    // Workaround for the thumbnail size sometimes not being set. This is a bug.
                    riverSize.RemovedSize = new Size(1, 1);
                }

                if (riverSize.RemovedSize.Width > riverSize.RemovedSize.Height)
                {
                    riverSize.RemovedSize = new Size(longestSide, riverSize.RemovedSize.Height / riverSize.RemovedSize.Width * longestSide);
                }
                else
                {
                    riverSize.RemovedSize = new Size(riverSize.RemovedSize.Width / riverSize.RemovedSize.Height * longestSide, longestSide);
                }

                riverSize.MinSize = Settings.Default.MinImageSize;
                riverSize.MaxSize = Settings.Default.MaxImageSize;

                _nextState = _largeImage;
            }
            else if (_feedItem is NewsFeedItem)
            {
                _nextState            = _largeNews;
                riverSize.MinSize     = Settings.Default.MinNewsSize;
                riverSize.MaxSize     = Settings.Default.MaxNewsSize;
                riverSize.RemovedSize = riverSize.MinSize;
            }
            else if (_feedItem is StatusFeedItem)
            {
                _nextState            = _largeTweet;
                riverSize.MinSize     = Settings.Default.MinStatusSize;
                riverSize.MaxSize     = Settings.Default.MaxStatusSize;
                riverSize.RemovedSize = riverSize.MinSize;
            }

            return(riverSize);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called when the item is removed from the river by the user.
        /// </summary>
        /// <returns>Sizing restrictions for the item once its in the river.</returns>
        internal override RiverSize Removed()
        {
            _flashOn.Begin(this, Template);
            _nextState = null;

            RiverSize riverSize = new RiverSize { MaxSize = DesiredSize, RemovedSize = DesiredSize, MinSize = DesiredSize };

            if (_feedItem is ImageFeedItem)
            {
                double longestWidth = Settings.Default.MinImageSize.Width + ((Settings.Default.MaxImageSize.Width - Settings.Default.MinImageSize.Width) / 2);
                double longestHeight = Settings.Default.MinImageSize.Height + ((Settings.Default.MaxImageSize.Height - Settings.Default.MinImageSize.Height) / 2);
                double longestSide = Math.Min(longestWidth, longestHeight) + (Math.Abs(longestWidth - longestHeight) / 2);

                // Grow to a size that's the same aspect ratio as the image, but clamped to longestSide.
                riverSize.RemovedSize = (_feedItem as ImageFeedItem).ThumbnailSize;

                if (riverSize.RemovedSize.Width == 0 && riverSize.RemovedSize.Height == 0)
                {
                    // Workaround for the thumbnail size sometimes not being set. This is a bug.
                    riverSize.RemovedSize = new Size(1, 1);
                }

                if (riverSize.RemovedSize.Width > riverSize.RemovedSize.Height)
                {
                    riverSize.RemovedSize = new Size(longestSide, riverSize.RemovedSize.Height / riverSize.RemovedSize.Width * longestSide);
                }
                else
                {
                    riverSize.RemovedSize = new Size(riverSize.RemovedSize.Width / riverSize.RemovedSize.Height * longestSide, longestSide);
                }

                riverSize.MinSize = Settings.Default.MinImageSize;
                riverSize.MaxSize = Settings.Default.MaxImageSize;

                _nextState = _largeImage;
            }
            else if (_feedItem is NewsFeedItem)
            {
                _nextState = _largeNews;
                riverSize.MinSize = Settings.Default.MinNewsSize;
                riverSize.MaxSize = Settings.Default.MaxNewsSize;
                riverSize.RemovedSize = riverSize.MinSize;
            }
            else if (_feedItem is StatusFeedItem)
            {
                _nextState = _largeTweet;
                riverSize.MinSize = Settings.Default.MinStatusSize;
                riverSize.MaxSize = Settings.Default.MaxStatusSize;
                riverSize.RemovedSize = riverSize.MinSize;
            }

            return riverSize;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Called when the item is removed from the river by the user.
 /// </summary>
 /// <returns>Sizing restrictions for the item once its in the river.</returns>
 internal override RiverSize Removed()
 {
     RiverSize riverSize = new RiverSize { MaxSize = DesiredSize, RemovedSize = DesiredSize, MinSize = DesiredSize };
     return riverSize;
 }