# HG changeset patch # User sarias # Date 1249835381 -7200 # Node ID 9e222810f5b5ef4480686c3d4e3847662fa3bec9 # Parent 64446419171489aab8a7ae408a1d80abb705266d User Control Player User Control TimeLine + Communication du player et TimeLine dans User Panel diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.Player/UserControlPlayer.xaml --- a/src/FingersDance.Control.Player/UserControlPlayer.xaml Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml Sun Aug 09 18:29:41 2009 +0200 @@ -12,88 +12,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.Player/UserControlPlayer.xaml.cs --- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Sun Aug 09 18:29:41 2009 +0200 @@ -14,29 +14,72 @@ { public partial class UserControlPlayer { + #region Variables + private bool isPlaying = false; + #endregion - private bool play; + public event EventHandler PlayerOpened; public UserControlPlayer() { this.InitializeComponent(); - initPlayer(); - } + } + #region Properties + public double TotalMilliseconds + { + get + { + return MediaElementVideo.NaturalDuration.TimeSpan.TotalMilliseconds; + } + } + public MediaElement Player + { + get + { + return MediaElementVideo; + } + set + { + MediaElementVideo= value; + } + } + + #endregion + + + #region Methodes void initPlayer() - { + { //init player - play = false; + isPlaying = false; MediaElementVideo.Source = new Uri("Resources\\Lake.wmv", UriKind.Relative); MediaElementVideo.LoadedBehavior = MediaState.Manual; + MediaElementVideo.UnloadedBehavior = MediaState.Manual; + MediaElementVideo.ScrubbingEnabled= true; } + public void playerPause() + { + MediaElementVideo.Pause(); + } + public void playerPlay() + { + MediaElementVideo.Play(); + } + public void playerStop() + { + MediaElementVideo.Stop(); + } + + #endregion + private void ButtonPlayPause_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) { - if (!play)//Play + if (!isPlaying)//Play { - play = true; + isPlaying = true; try { MediaElementVideo.Play(); @@ -45,38 +88,87 @@ } else//Pause { - play = false; + isPlaying = false; try { MediaElementVideo.Pause(); } - catch (Exception exx ) { } + catch (Exception exx) { } } } private void ButtonPlayPause_Click(object sender, RoutedEventArgs e) { - if (!play)//Play + if (!isPlaying)//Play { - play = true; + isPlaying = true; try { MediaElementVideo.Play(); } - catch (Exception ex ) { } - ButtonPlayPause.Background = FindResource("[Skin_1]_Pause_button_xaml") as Brush; + catch (Exception ex) { } + } else//Pause { - play = false; + isPlaying = false; try { MediaElementVideo.Pause(); } - catch (Exception exx ) { } - ButtonPlayPause.Background = FindResource("[Skin_1]_Play_button_xaml") as Brush; + catch (Exception exx) { } + //ButtonPlayPause.Background = FindResource("[Skin_1]_Play_button_xaml") as Brush; + } + } + + private void ButtonFastForward_Click(object sender, RoutedEventArgs e) + { + if (MediaElementVideo.SpeedRatio <= 3) + MediaElementVideo.SpeedRatio += 1; + } + + private void ButtonFastForward_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) + { + if (MediaElementVideo.SpeedRatio <= 3) + MediaElementVideo.SpeedRatio += 1; + } + + private void ButtonRewind_Click(object sender, RoutedEventArgs e) + { + //TimeSpan ts = new TimeSpan(0, 0, 0, 0); + if (MediaElementVideo.SpeedRatio > 1) + { + MediaElementVideo.SpeedRatio -= 1; } + else + { + MediaElementVideo.Position = MediaElementVideo.Position.Add(new TimeSpan(0, 0, 0, -5)); + } + } + + private void ButtonRewind_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) + { + + //TimeSpan ts = new TimeSpan(0, 0, 0,0); + if (MediaElementVideo.SpeedRatio > 1) + { + MediaElementVideo.SpeedRatio -= 1; + } + else + { + MediaElementVideo.Position = MediaElementVideo.Position.Add(new TimeSpan(0, 0, 0, -5)); + } + } + + private void MediaElementVideo_MediaOpened(object sender, RoutedEventArgs e) + { + OnPlayerOpened(); + } + protected virtual void OnPlayerOpened() + { + if(PlayerOpened!=null) + PlayerOpened(this, new EventArgs()); } } } \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/App.xaml --- a/src/FingersDance.Control.TimeLine/App.xaml Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/App.xaml Sun Aug 09 18:29:41 2009 +0200 @@ -1,7 +1,7 @@  diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj --- a/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj Sun Aug 09 18:29:41 2009 +0200 @@ -80,9 +80,6 @@ UserControlTimeLine.xaml - - PreserveNewest - @@ -115,9 +112,6 @@ True Settings.settings - - SurfaceTimeLineTest.xaml - @@ -132,11 +126,5 @@ - - - MSBuild:Compile - Designer - - \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/Lake.wmv Binary file src/FingersDance.Control.TimeLine/Lake.wmv has changed diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/Properties/Resources.Designer.cs --- a/src/FingersDance.Control.TimeLine/Properties/Resources.Designer.cs Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/Properties/Resources.Designer.cs Sun Aug 09 18:29:41 2009 +0200 @@ -8,11 +8,10 @@ // //------------------------------------------------------------------------------ -namespace FingersDance.Control.TimeLine.Properties -{ +namespace FingersDance.Control.TimeLine.Properties { using System; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -23,48 +22,40 @@ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if (object.ReferenceEquals(resourceMan, null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WPFAppTemplate.Properties.Resources", typeof(Resources).Assembly); + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FingersDance.Control.TimeLine.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/Properties/Resources.resx --- a/src/FingersDance.Control.TimeLine/Properties/Resources.resx Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/Properties/Resources.resx Sun Aug 09 18:29:41 2009 +0200 @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml --- a/src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml Fri Aug 07 01:03:14 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml.cs --- a/src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml.cs Fri Aug 07 01:03:14 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,254 +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 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 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml Sun Aug 09 18:29:41 2009 +0200 @@ -6,11 +6,9 @@ mc:Ignorable="d" x:Class="FingersDance.Control.TimeLine.UserControlTimeLine" x:Name="UserControl" - d:DesignWidth="575" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Height="88" Background="#FF898686"> + d:DesignWidth="575" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Height="Auto" Background="#FF898686"> - - - + + + \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Sun Aug 09 18:29:41 2009 +0200 @@ -7,21 +7,79 @@ using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Navigation; +using System.Windows.Controls.Primitives; +using Microsoft.Surface.Presentation.Controls; +using System.Windows.Threading; namespace FingersDance.Control.TimeLine { public partial class UserControlTimeLine - { - public Microsoft.Surface.Presentation.Controls.SurfaceSlider Slider + { + + #region Variables + private DispatcherTimer timer; + private bool isDragging = false; + private bool finishedDragging = false; + #endregion + + public event EventHandler DragStarted; + public event EventHandler DragCompleted; + public event EventHandler TimerTick; + + #region Properties + + public SurfaceSlider Slider { - get { - return SurfaceSlider; + get + { + return slider; } - set { - SurfaceSlider = value; + set + { + slider = value; } } + public bool IsDragging + { + get + { + return isDragging; + } + set + { + isDragging = value; + } + } + + public bool FinishedDragging + { + get + { + return finishedDragging; + } + set + { + finishedDragging = value; + } + } + + public DispatcherTimer Timer + { + get + { + return timer; + } + set + { + timer = value; + } + } + #endregion + + + + public UserControlTimeLine() { this.InitializeComponent(); @@ -29,15 +87,73 @@ // Insert code required on object creation below this point. } - private void SurfaceSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + public void initslider(double totalmilliseconds) + { + slider.Maximum = totalmilliseconds; + } + + #region Timer + public void initTimer() + { + timer = new DispatcherTimer(); + timer.Interval = new TimeSpan(0, 0, 0, 0, 100); + timer.Tick += new EventHandler(timer_Tick); + } + + public void timerStart() + { + if (timer != null) + timer.Start(); + } + void timer_Tick(object sender, EventArgs 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);*/ + OnTimerTick(); + if (!isDragging) + { + //slider.Value = media.Position.TotalMilliseconds; + } + if (finishedDragging) + { + //int SliderValue = (int)slider.Value; + //TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); + // media.Position = ts; + // media.Play(); + // isDragging = false; + //finishedDragging = false; + } + } + protected virtual void OnTimerTick() + { + if (TimerTick != null) + TimerTick(this, new EventArgs()); } + + #endregion + + private void sliderPosition_DragStarted( + object sender, DragStartedEventArgs e) + { + isDragging = true; + OnDragStarted(); + // media.Pause(); + } + protected virtual void OnDragStarted() + { + if (DragStarted != null) + DragStarted(this, new EventArgs()); + } + + private void sliderPosition_DragCompleted( + object sender, DragCompletedEventArgs e) + { + finishedDragging = true; + OnDragCompleted(); + } + protected virtual void OnDragCompleted() + { + if (DragCompleted != null) + DragCompleted(this, new EventArgs()); + } + } } \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.UserPanel/App.xaml --- a/src/FingersDance.Control.UserPanel/App.xaml Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.UserPanel/App.xaml Sun Aug 09 18:29:41 2009 +0200 @@ -1,7 +1,7 @@  diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj --- a/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj Fri Aug 07 01:03:14 2009 +0200 +++ b/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj Sun Aug 09 18:29:41 2009 +0200 @@ -105,8 +105,8 @@ True Settings.settings - - SurfaceWindow1.xaml + + SurfaceUserPanelTest.xaml @@ -123,10 +123,20 @@ - + MSBuild:Compile Designer + + + {D5625AA4-362F-4E46-9916-65F3B173ECBE} + FingersDance.Control.Player + + + {2BCEE1BF-D3AC-478C-A26B-DFDB7420E965} + FingersDance.Control.TimeLine + + \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml Sun Aug 09 18:29:41 2009 +0200 @@ -0,0 +1,19 @@ + + + + + + + + + + diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml.cs Sun Aug 09 18:29:41 2009 +0200 @@ -0,0 +1,146 @@ +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.UserPanel +{ + /// + /// 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 + } + + private void UserControlPlayer_PlayerOpened(object sender, EventArgs e) + { + //Initialisation du slider + UserControlTimeLine.initslider(UserControlPlayer.TotalMilliseconds); + //Demarrage du Timer + UserControlTimeLine.timerStart(); + + } + + private void SurfaceWindow_Activated(object sender, EventArgs e) + { + //initialisation du Timer + UserControlTimeLine.initTimer(); + } + + private void UserControlTimeLine_DragStarted(object sender, EventArgs e) + { + UserControlPlayer.playerPause(); + } + + private void UserControlTimeLine_DragCompleted(object sender, EventArgs e) + { + } + + private void UserControlTimeLine_TimerTick(object sender, EventArgs e) + { + if (!UserControlTimeLine.IsDragging) + { + UserControlTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds; + } + if (UserControlTimeLine.FinishedDragging) + { + int SliderValue = (int)UserControlTimeLine.Slider.Value; + TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); + + UserControlPlayer.Player.Position = ts; + UserControlPlayer.playerPlay(); + + UserControlTimeLine.IsDragging = false; + UserControlTimeLine.FinishedDragging = false; + } + } + } +} \ No newline at end of file diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml --- a/src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml Fri Aug 07 01:03:14 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - diff -r 644464191714 -r 9e222810f5b5 src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml.cs --- a/src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml.cs Fri Aug 07 01:03:14 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.UserPanel -{ - /// - /// 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 644464191714 -r 9e222810f5b5 test/SliderTest/SliderTest/SurfaceWindow1.xaml.cs --- a/test/SliderTest/SliderTest/SurfaceWindow1.xaml.cs Fri Aug 07 01:03:14 2009 +0200 +++ b/test/SliderTest/SliderTest/SurfaceWindow1.xaml.cs Sun Aug 09 18:29:41 2009 +0200 @@ -26,7 +26,6 @@ DispatcherTimer timer; bool isDragging=false; bool finishedDragging = false; - bool mediaopened = false; /// /// Default constructor. @@ -116,7 +115,6 @@ private void media_MediaOpened(object sender, RoutedEventArgs e) { - mediaopened = true; initslider(); timer.Start(); }