Click here to Skip to main content
15,884,472 members
Articles / Desktop Programming / WPF

Channel9 3D Explorer with gestures (hybrid smart client)

Rate me:
Please Sign up or sign in to vote.
4.88/5 (23 votes)
10 Mar 2009Ms-PL4 min read 34K   715   26  
An article on viewing Channel9's RSS posts
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using System.Diagnostics;

namespace Channel9Explorer.UserControls
{
    /// <summary>
    /// Interaction logic for BackDisplayControl.xaml
    /// </summary>
    public partial class BackDisplayControl : UserControl
    {
        public BackDisplayControl()
        {
            InitializeComponent();
            this.MouseDoubleClick += new MouseButtonEventHandler(BackDisplayControl_MouseLeftButtonUp);
        }

        

        #region Properties
        public string VideoLink
        {
            get;
            set;
        }
        #endregion

        #region Event handlers
        
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            
        }

        void StartStoryBoarrd(Storyboard sb, int from, int to)
        {
            DoubleAnimation animation = sb.Children[0] as DoubleAnimation;
            animation.From = from;
            animation.To = to;

            //sb.Children[0] = animation;
            sb.Begin();
        }

        bool play;

        void BackDisplayControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (play == false)
            {
                if (this.VideoLink == null) return;

                if (Uri.IsWellFormedUriString(this.VideoLink, UriKind.Absolute) == false) return;

                play = true;

                Storyboard sb = this.FindResource("PlayImageFadeStoryBoard") as Storyboard;
                this.StartStoryBoarrd(sb, 1, 0);

                Storyboard sb1 = this.FindResource("PauseImageFadeStoryBoard") as Storyboard;
                this.StartStoryBoarrd(sb1, 0, 1);

                this.MyPlayer.Source = new Uri(this.VideoLink);
                this.MyPlayer.LoadedBehavior = MediaState.Manual;
                this.MyPlayer.Play();
            }
            else
            {
                Storyboard sb = this.FindResource("PauseImageFadeStoryBoard") as Storyboard;
                this.StartStoryBoarrd(sb, 1, 0);

                Storyboard sb1 = this.FindResource("PlayImageFadeStoryBoard") as Storyboard;
                this.StartStoryBoarrd(sb1, 0, 1);

                play = false;

                this.MyPlayer.Pause();
            }
        }
        
        #endregion



    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Architect
Romania Romania
is a developer at LetsVR.ro.

Comments and Discussions