# HG changeset patch # User sarias # Date 1249331806 -7200 # Node ID e8bfe1102e03dafdb431e9bc05cb924d1ae52fd4 # Parent 215a7412e5448c82b75a028b6d86e22593ec92ca Modif sur ControlPlayer pour les videos. Partage du test Control.TimeLine diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.Menu/UserControlMenu.xaml.cs --- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Mon Aug 03 22:36:46 2009 +0200 @@ -32,6 +32,7 @@ //Niveau 3 PanelChild1AxeCam.Width -= 0.05 * this.Width; PanelChild1MouvCam.Width -= 0.05 * this.Width; + } #region Events diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.Player/FingersDance.Control.Player.csproj --- a/src/FingersDance.Control.Player/FingersDance.Control.Player.csproj Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.Control.Player/FingersDance.Control.Player.csproj Mon Aug 03 22:36:46 2009 +0200 @@ -84,9 +84,6 @@ UserControlPlayer.xaml - - PreserveNewest - @@ -132,7 +129,9 @@ PreserveNewest - + + PreserveNewest + diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.Player/Lake.wmv Binary file src/FingersDance.Control.Player/Lake.wmv has changed diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.Player/UserControlPlayer.xaml --- a/src/FingersDance.Control.Player/UserControlPlayer.xaml Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml Mon Aug 03 22:36:46 2009 +0200 @@ -59,7 +59,7 @@ - + diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.Player/UserControlPlayer.xaml.cs --- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Mon Aug 03 22:36:46 2009 +0200 @@ -28,7 +28,7 @@ { //init player play = false; - //MediaElementVideo.Source = new Uri("Resources\\Lake.wmv", UriKind.Relative); + MediaElementVideo.Source = new Uri("Resources\\Lake.wmv", UriKind.Relative); MediaElementVideo.LoadedBehavior = MediaState.Manual; } diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/App.xaml --- a/src/FingersDance.Control.TimeLine/App.xaml Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/App.xaml Mon Aug 03 22:36:46 2009 +0200 @@ -1,7 +1,7 @@  diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj --- a/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj Mon Aug 03 22:36:46 2009 +0200 @@ -73,6 +73,16 @@ + + MSBuild:Compile + Designer + + + UserControlTimeLine.xaml + + + PreserveNewest + @@ -80,8 +90,8 @@ Designer + Code App.xaml - Code @@ -105,8 +115,8 @@ True Settings.settings - - SurfaceWindow1.xaml + + SurfaceTimeLineTest.xaml @@ -123,7 +133,7 @@ - + MSBuild:Compile Designer diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/Lake.wmv Binary file src/FingersDance.Control.TimeLine/Lake.wmv has changed diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml Mon Aug 03 22:36:46 2009 +0200 @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml.cs Mon Aug 03 22:36:46 2009 +0200 @@ -0,0 +1,254 @@ +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.Shapes; +using System.Windows.Threading; +using Microsoft.Surface; +using Microsoft.Surface.Presentation; +using Microsoft.Surface.Presentation.Controls; + +namespace FingersDance.Control.TimeLine +{ + /// + /// Interaction logic for SurfaceWindow1.xaml + /// + public partial class SurfaceTimeLineTest : SurfaceWindow + { + + DispatcherTimer timer; // handles position of slider and player + bool isDragging = false; + bool isPlaying = false; + + + + /// + /// Default constructor. + /// + public SurfaceTimeLineTest() + { + InitializeComponent(); + + // Add handlers for Application activation events + initplayer(); + AddActivationHandlers(); + } + + #region Handlers + /// + /// Occurs when the window is about to close. + /// + /// + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + + // Remove handlers for Application activation events + RemoveActivationHandlers(); + } + + /// + /// Adds handlers for Application activation events. + /// + private void AddActivationHandlers() + { + // Subscribe to surface application activation events + ApplicationLauncher.ApplicationActivated += OnApplicationActivated; + ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed; + ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated; + } + + /// + /// Removes handlers for Application activation events. + /// + private void RemoveActivationHandlers() + { + // Unsubscribe from surface application activation events + ApplicationLauncher.ApplicationActivated -= OnApplicationActivated; + ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed; + ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated; + } + + /// + /// This is called when application has been activated. + /// + /// + /// + private void OnApplicationActivated(object sender, EventArgs e) + { + //TODO: enable audio, animations here + } + + /// + /// This is called when application is in preview mode. + /// + /// + /// + private void OnApplicationPreviewed(object sender, EventArgs e) + { + //TODO: Disable audio here if it is enabled + + //TODO: optionally enable animations here + } + + /// + /// This is called when application has been deactivated. + /// + /// + /// + private void OnApplicationDeactivated(object sender, EventArgs e) + { + //TODO: disable audio, animations here + } + #endregion + + #region SurfaceWindows events + + private void SurfaceWindow_Activated(object sender, EventArgs e) + { + timer = new DispatcherTimer(); + //timer.Interval = TimeSpan.FromSeconds(1); + timer.Interval = TimeSpan.FromMilliseconds(250); + timer.Tick += new EventHandler(timer_Tick); + } + #endregion + + #region Timer + void timer_Tick(object sender, EventArgs e) + { + //Slider Position + labelPosition.Content = sliderBase.Value; + //Media Position ToString and TotalMilliseconds + labelMediaPositionToString.Content=mediaelement.Position.ToString(); + labelMediaPositionContent.Content = mediaelement.Position.TotalMilliseconds; + //Si le slider n'est pas en train d'etre bougé, on change sa valeur + if (!isDragging) + { + sliderBase.Value = mediaelement.Position.TotalMilliseconds; + } + + } + #endregion + + #region MediaElement events + private void MediaElement_MediaEnded(object sender, RoutedEventArgs e) + { + mediaelement.Stop(); + } + + private void mediaelement_MediaOpened(object sender, RoutedEventArgs e) + { + labelDuration.Content = mediaelement.NaturalDuration.ToString(); + + sliderBase.Maximum = mediaelement.NaturalDuration.TimeSpan.TotalMilliseconds; + labelSliderMax.Content = sliderBase.Maximum; + //initialisation du timer + timer.Start(); + } + #endregion + + #region Slider + + private void sliderBase_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + //TODO + if (!isDragging) + { + + int SliderValue = (int)sliderBase.Value; + + // Overloaded constructor takes the arguments days, hours, minutes, seconds, miniseconds. + // Create a TimeSpan with miliseconds equal to the slider value. + TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); + mediaelement.Position = ts; + mediaelement.Play(); + } + + } + + private void sliderBase_DragEnter(object sender, DragEventArgs e) + { + isDragging = true; + mediaelement.Pause(); + } + + private void sliderBase_DragLeave(object sender, DragEventArgs e) + { + isDragging = false; + //mediaelement.Position = TimeSpan.FromSeconds(sliderBase.Value); + + } + + private void sliderBase_ContactEnter(object sender, ContactEventArgs e) + { + isDragging = true; + mediaelement.Pause(); + } + + private void sliderBase_ContactLeave(object sender, ContactEventArgs e) + { + isDragging = false; + mediaelement.Position = TimeSpan.FromSeconds(sliderBase.Value); + } + + private void sliderBase_ContactChanged(object sender, ContactEventArgs e) + { + // isDragging = false; + //mediaelement.Position = TimeSpan.FromMilliseconds(sliderBase.Value); + } + #endregion + + #region Player + private void initplayer() + { + mediaelement.LoadedBehavior = MediaState.Manual; + } + + private void butonPlayPause_Click(object sender, RoutedEventArgs e) + { + if (!isPlaying)//Play + { + isPlaying = true; + try + { + mediaelement.Play(); + } + catch (Exception ex) { } + } + else//Pause + { + isPlaying = false; + try + { + mediaelement.Pause(); + } + catch (Exception exx) { } + } + } + private void SurfaceButton_Click(object sender, RoutedEventArgs e) + { + mediaelement.Stop(); + } + + private void SurfaceButton_ContactDown(object sender, ContactEventArgs e) + { + mediaelement.Stop(); + } + + #endregion + + + + + + } + + +} \ No newline at end of file diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/SurfaceWindow1.xaml --- a/src/FingersDance.Control.TimeLine/SurfaceWindow1.xaml Mon Aug 03 22:27:27 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/SurfaceWindow1.xaml.cs --- a/src/FingersDance.Control.TimeLine/SurfaceWindow1.xaml.cs Mon Aug 03 22:27:27 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -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.Shapes; -using System.Windows.Threading; -using Microsoft.Surface; -using Microsoft.Surface.Presentation; -using Microsoft.Surface.Presentation.Controls; - -namespace FingersDance.Control.TimeLine -{ - /// - /// Interaction logic for SurfaceWindow1.xaml - /// - public partial class SurfaceWindow1 : SurfaceWindow - { - /// - /// Default constructor. - /// - public SurfaceWindow1() - { - InitializeComponent(); - - // Add handlers for Application activation events - AddActivationHandlers(); - } - - - /// - /// Occurs when the window is about to close. - /// - /// - protected override void OnClosed(EventArgs e) - { - base.OnClosed(e); - - // Remove handlers for Application activation events - RemoveActivationHandlers(); - } - - /// - /// Adds handlers for Application activation events. - /// - private void AddActivationHandlers() - { - // Subscribe to surface application activation events - ApplicationLauncher.ApplicationActivated += OnApplicationActivated; - ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed; - ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated; - } - - /// - /// Removes handlers for Application activation events. - /// - private void RemoveActivationHandlers() - { - // Unsubscribe from surface application activation events - ApplicationLauncher.ApplicationActivated -= OnApplicationActivated; - ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed; - ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated; - } - - /// - /// This is called when application has been activated. - /// - /// - /// - private void OnApplicationActivated(object sender, EventArgs e) - { - //TODO: enable audio, animations here - } - - /// - /// This is called when application is in preview mode. - /// - /// - /// - private void OnApplicationPreviewed(object sender, EventArgs e) - { - //TODO: Disable audio here if it is enabled - - //TODO: optionally enable animations here - } - - /// - /// This is called when application has been deactivated. - /// - /// - /// - private void OnApplicationDeactivated(object sender, EventArgs e) - { - //TODO: disable audio, animations here - } - } -} \ No newline at end of file diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml Mon Aug 03 22:36:46 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Mon Aug 03 22:36:46 2009 +0200 @@ -0,0 +1,43 @@ +using System; +using System.IO; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Navigation; + +namespace FingersDance.Control.TimeLine +{ + public partial class UserControlTimeLine + { + public Microsoft.Surface.Presentation.Controls.SurfaceSlider Slider + { + get { + return SurfaceSlider; + } + set { + SurfaceSlider = value; + } + } + + public UserControlTimeLine() + { + this.InitializeComponent(); + + // Insert code required on object creation below this point. + } + + private void SurfaceSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + /*TimeSpan ts = TimeSpan.FromSeconds(e.NewValue); + LabelSliderPosition.Content = + String.Format("{0:00}:{1:00}:{2:00}", + ts.Hours, ts.Minutes, ts.Seconds); + SurfaceSlider.Maximum = ts.TotalSeconds; + SurfaceSlider.SmallChange = 1; + SurfaceSlider.LargeChange = Math.Min(10, ts.Seconds / 10);*/ + } + } +} \ No newline at end of file diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.Control/SurfaceWindow1.xaml --- a/src/FingersDance.Control/SurfaceWindow1.xaml Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.Control/SurfaceWindow1.xaml Mon Aug 03 22:36:46 2009 +0200 @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="http://schemas.microsoft.com/surface/2008" - Title="FingersDance.Control" + Title="FingersDance.Control" x:Name="SurfaceActionsTest" > diff -r 215a7412e544 -r e8bfe1102e03 src/FingersDance.sln --- a/src/FingersDance.sln Mon Aug 03 22:27:27 2009 +0200 +++ b/src/FingersDance.sln Mon Aug 03 22:36:46 2009 +0200 @@ -19,6 +19,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FingersDance.Control.TimeLine", "FingersDance.Control.TimeLine\FingersDance.Control.TimeLine.csproj", "{2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FingersDance.Actions", "FingersDance.Actions\FingersDance.Actions.csproj", "{1E80D5A1-C45C-443B-8992-4A4D78D280FC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -99,6 +101,12 @@ {2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}.Release|Any CPU.Build.0 = Release|Any CPU {2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}.Release|x86.ActiveCfg = Release|x86 {2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}.Release|x86.Build.0 = Release|x86 + {1E80D5A1-C45C-443B-8992-4A4D78D280FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E80D5A1-C45C-443B-8992-4A4D78D280FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E80D5A1-C45C-443B-8992-4A4D78D280FC}.Debug|x86.ActiveCfg = Debug|Any CPU + {1E80D5A1-C45C-443B-8992-4A4D78D280FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E80D5A1-C45C-443B-8992-4A4D78D280FC}.Release|Any CPU.Build.0 = Release|Any CPU + {1E80D5A1-C45C-443B-8992-4A4D78D280FC}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE