Skip to main content

Microsoft® Surface® Live Stream Code Sample

ive Stream enables businesses to engage their customers face-to-face using the most recent and relevant Twitter™, Flickr®, and RSS newsfeeds.

C# (5.9 MB)
 
 
 
 
 
4.3 Star
(4)
6,673 times
Add to favorites
4/19/2011
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
using System;
using System.ComponentModel;
using System.Windows;
using FeedProcessor.Enums;
using FeedProcessor.FeedItems;
using Microsoft.Surface.Presentation.Controls;

namespace LiveStream.Controls.RiverContent
{
    /// <summary>
    /// A river item which shows the small version of image feed items.
    /// </summary>
    public partial class SmallImage : SurfaceUserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SmallImage"/> class.
        /// </summary>
        public SmallImage()
        {
            InitializeComponent();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            SizeChanged += (sender, e) => _posted.Visibility = _author.Visibility = ActualWidth > 100 ? Visibility.Visible : Visibility.Collapsed;
        }

        /// <summary>
        /// Gets the size of the image.
        /// </summary>
        /// <value>The size of the image.</value>
        internal Size ImageSize
        {
            get
            {
                if (_image.BitmapImage == null)
                {
                    return _image.DesiredSize;
                }
                else
                {
                    return new Size(_image.BitmapImage.PixelWidth, _image.BitmapImage.PixelHeight);
                }
            }
        }
    }
}