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,650 times
Add to favorites
4/19/2011
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
using System.ComponentModel;
using LiveStream.Properties;
using Microsoft.Surface.Presentation;
using Microsoft.Surface.Presentation.Controls;

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

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

        /// <summary>
        /// Handles the ContactTapGesture event of the Close button.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.Surface.Presentation.ContactEventArgs"/> instance containing the event data.</param>
        private void Close_ContactTapGesture(object sender, ContactEventArgs e)
        {
            RaiseEvent(new UserSourceRoutedEventArgs(RiverItemBase.CloseRequestedEvent, _closeBtn));
        }

        /// <summary>
        /// Handles the ContactTapGesture event of the Flip button.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.Surface.Presentation.ContactEventArgs"/> instance containing the event data.</param>
        private void Flip_ContactTapGesture(object sender, ContactEventArgs e)
        {
            RaiseEvent(new UserSourceRoutedEventArgs(RiverItemBase.FlipRequestedEvent, _flipBtn));
        }

        /// <summary>
        /// If resizing is enabled, size the content to a fixed pixel size according to the size of the container, and put it in the ViewBox.
        /// </summary>
        internal void SetUpResizing()
        {
            if (!Settings.Default.EnableContentResizing)
            {
                return;
            }

            _contentRoot.Width = _contentRoot.ActualWidth;
            _contentRoot.Height = _contentRoot.ActualHeight;
            _fixedContentContainer.Child = null;
            _scalingContentContainer.Child = _contentRoot;
        }

        /// <summary>
        /// If resizing is enabled, let the content size dynamically and put it in the normal container.
        /// </summary>
        internal void TearDownResizing()
        {
            if (!Settings.Default.EnableContentResizing)
            {
                return;
            }

            _scalingContentContainer.Child = null;
            _contentRoot.Width = double.NaN;
            _contentRoot.Height = double.NaN;
            _fixedContentContainer.Child = _contentRoot;
        }
    }
}