diff options
| author | Zippy <rattenbiss@gmx.de> | 2009-12-27 13:44:45 +0100 |
|---|---|---|
| committer | Zippy <rattenbiss@gmx.de> | 2009-12-27 13:44:45 +0100 |
| commit | 01cf83532d3a749a4705f763f805fc363f53a4fd (patch) | |
| tree | ca9df6fd2539b276a966e2c6eea4ee71d1520059 | |
| parent | a17dacd5c86ca386bfe69c809f62b65ce54087b4 (diff) | |
initial silverlight - webapp import
Signed-off-by: Zippy <rattenbiss@gmx.de>
| -rw-r--r-- | src/YalpClients/WebClient/App.xaml | 8 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/App.xaml.cs | 66 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/Default.aspx.cs | 22 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/Default.aspx.designer.cs | 70 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/MainPage.xaml | 284 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/MainPage.xaml.cs | 198 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/Properties/AppManifest.xml | 16 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/Properties/AssemblyInfo.cs | 35 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/VideoPlayer.csproj | 103 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/VideoPlayer.csproj.user | 28 | ||||
| -rw-r--r-- | src/YalpClients/WebClient/VideoPlayer.sln | 20 |
11 files changed, 850 insertions, 0 deletions
diff --git a/src/YalpClients/WebClient/App.xaml b/src/YalpClients/WebClient/App.xaml new file mode 100644 index 0000000..48a0475 --- /dev/null +++ b/src/YalpClients/WebClient/App.xaml @@ -0,0 +1,8 @@ +<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + x:Class="VideoPlayer.App" + > + <Application.Resources> + + </Application.Resources> +</Application> diff --git a/src/YalpClients/WebClient/App.xaml.cs b/src/YalpClients/WebClient/App.xaml.cs new file mode 100644 index 0000000..2a30f24 --- /dev/null +++ b/src/YalpClients/WebClient/App.xaml.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; + +namespace VideoPlayer +{ + public partial class App : Application + { + + public App() + { + this.Startup += this.Application_Startup; + this.Exit += this.Application_Exit; + this.UnhandledException += this.Application_UnhandledException; + + InitializeComponent(); + } + + private void Application_Startup(object sender, StartupEventArgs e) + { + this.RootVisual = new MainPage(); + } + + private void Application_Exit(object sender, EventArgs e) + { + + } + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + // If the app is running outside of the debugger then report the exception using + // the browser's exception mechanism. On IE this will display it a yellow alert + // icon in the status bar and Firefox will display a script error. + if (!System.Diagnostics.Debugger.IsAttached) + { + + // NOTE: This will allow the application to continue running after an exception has been thrown + // but not handled. + // For production applications this error handling should be replaced with something that will + // report the error to the website and stop the application. + e.Handled = true; + Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); + } + } + private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) + { + try + { + string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; + errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); + + System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); + } + catch (Exception) + { + } + } + } +} diff --git a/src/YalpClients/WebClient/Default.aspx.cs b/src/YalpClients/WebClient/Default.aspx.cs new file mode 100644 index 0000000..0bd1d7d --- /dev/null +++ b/src/YalpClients/WebClient/Default.aspx.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace TwitterSearchApplication.Web +{ + public partial class _Default : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void Button1_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/src/YalpClients/WebClient/Default.aspx.designer.cs b/src/YalpClients/WebClient/Default.aspx.designer.cs new file mode 100644 index 0000000..6b1c246 --- /dev/null +++ b/src/YalpClients/WebClient/Default.aspx.designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:2.0.50727.4200 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace TwitterSearchApplication.Web { + + + public partial class _Default { + + /// <summary> + /// form1-Steuerelement + /// </summary> + /// <remarks> + /// Automatisch generiertes Feld + /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. + /// </remarks> + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// <summary> + /// Checkbox1-Steuerelement + /// </summary> + /// <remarks> + /// Automatisch generiertes Feld + /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. + /// </remarks> + protected global::System.Web.UI.WebControls.CheckBox Checkbox1; + + /// <summary> + /// Button1-Steuerelement + /// </summary> + /// <remarks> + /// Automatisch generiertes Feld + /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. + /// </remarks> + protected global::System.Web.UI.WebControls.Button Button1; + + /// <summary> + /// TextBox1-Steuerelement + /// </summary> + /// <remarks> + /// Automatisch generiertes Feld + /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. + /// </remarks> + protected global::System.Web.UI.WebControls.TextBox TextBox1; + + /// <summary> + /// TextBox2-Steuerelement + /// </summary> + /// <remarks> + /// Automatisch generiertes Feld + /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. + /// </remarks> + protected global::System.Web.UI.WebControls.TextBox TextBox2; + + /// <summary> + /// RadioButton1-Steuerelement + /// </summary> + /// <remarks> + /// Automatisch generiertes Feld + /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. + /// </remarks> + protected global::System.Web.UI.WebControls.RadioButton RadioButton1; + } +} diff --git a/src/YalpClients/WebClient/MainPage.xaml b/src/YalpClients/WebClient/MainPage.xaml new file mode 100644 index 0000000..462b529 --- /dev/null +++ b/src/YalpClients/WebClient/MainPage.xaml @@ -0,0 +1,284 @@ +<UserControl xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" x:Class="VideoPlayer.MainPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" + mc:Ignorable="d" + Width="Auto" Height="Auto"> + + <UserControl.Resources> + <Style x:Key="roundThumbStyle" TargetType="Thumb"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Thumb"> + <Ellipse Stroke="#FFFFFFFF" StrokeThickness="2" Fill="#FF484848"/> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Grid x:Name="grid" Background="Transparent"> + + </Grid> + <Style x:Key="SliderStyle" TargetType="Slider"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid x:Name="Root" Background="Transparent"> + <Grid.Resources> + <ControlTemplate x:Key="RightRepeatButtonTemplate"> + <Rectangle Height="6" Margin="-5,0,0,0" Grid.Column="0" Grid.ColumnSpan="3" + StrokeThickness="0.5" RadiusY="3.5" RadiusX="3.5" Fill="#FF484848"/> + </ControlTemplate> + <ControlTemplate x:Key="LeftRepeatButtonTemplate"> + <Rectangle Height="6" Margin="0,0,-5,0" Grid.Column="0" Grid.ColumnSpan="3" + StrokeThickness="0.5" RadiusY="3.5" RadiusX="3.5" Fill="#FF7F7F7F"/> + </ControlTemplate> + </Grid.Resources> + <Grid x:Name="HorizontalTemplate"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + + <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Grid.Column="0" + IsTabStop="False" Template="{StaticResource LeftRepeatButtonTemplate}"/> + <Rectangle x:Name="LeftTrack" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/> + <Thumb Background="#00FFFFFF" Height="10" x:Name="HorizontalThumb" Width="10" + Grid.Column="1" Style="{StaticResource roundThumbStyle}" HorizontalAlignment="Left" + DragStarted="HorizontalThumb_DragStarted" DragCompleted="HorizontalThumb_DragCompleted" + Canvas.ZIndex="1"/> + <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Grid.Column="2" + IsTabStop="False" Template="{StaticResource RightRepeatButtonTemplate}"/> + <Rectangle x:Name="RightTrack" Grid.Column="2" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/> + </Grid> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <ControlTemplate x:Key="PlayButtonTemplate" TargetType="ToggleButton"> + <Grid x:Name="grid" Background="Transparent"> + <vsm:VisualStateManager.VisualStateGroups> + <vsm:VisualStateGroup x:Name="FocusStates"> + <vsm:VisualState x:Name="Focused"> + <Storyboard> + </Storyboard> + </vsm:VisualState> + <vsm:VisualState x:Name="Unfocused"> + <Storyboard/> + </vsm:VisualState> + </vsm:VisualStateGroup> + <vsm:VisualStateGroup x:Name="CommonStates"> + <vsm:VisualState x:Name="Normal"> + <Storyboard/> + </vsm:VisualState> + <vsm:VisualState x:Name="MouseOver"> + <Storyboard> + </Storyboard> + </vsm:VisualState> + <vsm:VisualState x:Name="Pressed"> + <Storyboard/> + </vsm:VisualState> + </vsm:VisualStateGroup> + <vsm:VisualStateGroup x:Name="CheckStates"> + <vsm:VisualState x:Name="Checked"> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" + Storyboard.TargetName="playSymbol" + Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" + Storyboard.TargetName="pauseSymbol" + Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </vsm:VisualState> + <vsm:VisualState x:Name="Unchecked"> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="pauseSymbol" Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </vsm:VisualState> + </vsm:VisualStateGroup> + </vsm:VisualStateManager.VisualStateGroups> + <Grid Margin="11,3,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" + Opacity="1" x:Name="playSymbol" Width="21" Height="22"> + <Path Width="14" Height="15" Stretch="Fill" Fill="#FF7F7F7F" + Data="F1 M 15.1997,22.542L 29.7776,14.89L 15.2707,6.99886L 15.1997,22.542 Z "/> + </Grid> + <Grid Margin="11,2,0,0" Opacity="0" x:Name="pauseSymbol" Width="31" Height="15"> + <Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Left" + Margin="0,0,0,0" Width="6"/> + <Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Stretch" + Margin="6,0,13,0" Width="6"/> + </Grid> + </Grid> + </ControlTemplate> + + <ControlTemplate x:Key="MuteButtonTemplate" TargetType="ToggleButton"> + <Grid Background="Transparent" Cursor="Hand"> + <vsm:VisualStateManager.VisualStateGroups> + <vsm:VisualStateGroup x:Name="FocusStates"> + <vsm:VisualState x:Name="Focused"> + <Storyboard> + </Storyboard> + </vsm:VisualState> + <vsm:VisualState x:Name="Unfocused"> + <Storyboard/> + </vsm:VisualState> + </vsm:VisualStateGroup> + <vsm:VisualStateGroup x:Name="CommonStates"> + <vsm:VisualState x:Name="Normal"> + <Storyboard/> + </vsm:VisualState> + <vsm:VisualState x:Name="MouseOver"> + <Storyboard> + </Storyboard> + </vsm:VisualState> + <vsm:VisualState x:Name="Pressed"> + <Storyboard/> + </vsm:VisualState> + </vsm:VisualStateGroup> + <vsm:VisualStateGroup x:Name="CheckStates"> + <vsm:VisualState x:Name="Checked"> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" + Storyboard.TargetName="volumeSymbol" + Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </vsm:VisualState> + <vsm:VisualState x:Name="Unchecked"> + <Storyboard> + <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" + Storyboard.TargetName="volumeSymbol" + Storyboard.TargetProperty="(UIElement.Opacity)"> + <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </vsm:VisualState> + </vsm:VisualStateGroup> + </vsm:VisualStateManager.VisualStateGroups> + <Grid HorizontalAlignment="Left" VerticalAlignment="Top" + Width="17"> + <Path HorizontalAlignment="Left" Stretch="Fill" + Fill="#FF7F7F7F" Data="F1 M 23.1457,26.5056L 23.1457,33.8944L 25.7913,33.8944L 28.8235,37.4722L 30.5346,37.4722L 30.5665,23.0833L 28.8995,23.0833L 25.8679,26.5056L 23.1457,26.5056 Z " + Width="7.421" Height="14.389" UseLayoutRounding="False" + Margin="0,6.5,0,6.5"/> + + <Grid HorizontalAlignment="Right" Width="7.003" x:Name="volumeSymbol" + Height="27"> + <Path HorizontalAlignment="Right" VerticalAlignment="Stretch" + Width="2.398" + Data="M0.5,0.5 C0.5,0.5 2.5939558,2.7128265 2.5946648,7.0504856 C2.5953746,11.391507 0.50033337,13.889001 0.50033337,13.889001" + Stretch="Fill" Stroke="#FF7F7F7F" Margin="0,0,-0.398,0" UseLayoutRounding="False"/> + <Path HorizontalAlignment="Stretch" Margin="2.4,2.384,2.317,1.584" VerticalAlignment="Stretch" + Data="M0.5,0.50000006 C0.5,0.50000006 1.4786903,2.1275051 1.4781417,4.9569001 C1.4776551,7.4670725 0.35717732,9.892808 0.35717732,9.892808" Stretch="Fill" Stroke="#FF7F7F7F" UseLayoutRounding="False"/> + <Path HorizontalAlignment="Left" Margin="0,4.36,0,3.46" VerticalAlignment="Stretch" Width="1.542" + Data="M0.5,0.5 C0.5,0.5 1.0412779,1.4903735 1.042276,3.1459465 C1.0429831,4.3189368 0.66544437,6.0685911 0.66544437,6.0685911" Stretch="Fill" Stroke="#FF7F7F7F" d:LayoutOverrides="Width"/> + </Grid> + </Grid> + </Grid> + </ControlTemplate> + + <ControlTemplate x:Key="ButtonTemplate" TargetType="Button"> + <Grid Background="Transparent"> + <ContentPresenter Width="Auto"/> + </Grid> + </ControlTemplate> + </UserControl.Resources> + + <Border x:Name="layoutRoot" Background="#FF000000"> + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <Grid.RowDefinitions> + <RowDefinition Height="auto" x:Name="VideoRow"/> + <RowDefinition Height="auto"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="auto" x:Name="VideoColumn"/> + </Grid.ColumnDefinitions> + + <MediaElement x:Name="mediaElement" AutoPlay="False" Stretch="Uniform" + MediaOpened="MediaElement_MediaOpened" + CacheMode="BitmapCache" + Grid.Row="0" Height="auto" Width="auto"/> + + <Button x:Name="bigPlayButton" Template="{StaticResource ButtonTemplate}" + Click="BigPlayButton_Click" Grid.Row="0" > + <Canvas Width="100" Height="100"> + <Path Width="100" Height="100" Canvas.Left="0" Canvas.Top="0" Stretch="Fill" + Fill="#77000000" Data="F1 M 15,0L 85,0C 93.2843,0 100,6.71573 100,15L 100,85C 100,93.2843 93.2843,100 85,100L 15,100C 6.71573,100 0,93.2843 0,85L 0,15C 0,6.71573 6.71573,0 15,0 Z "/> + <Path Width="40.8182" Height="47.1328" Canvas.Left="34.6439" + Canvas.Top="27.6003" Stretch="Fill" Fill="#FFFFFFFF" + Data="F1 M 75.4621,51.1667L 34.6439,27.6003L 34.6439,74.7331L 75.4621,51.1667 Z "/> + </Canvas> + </Button> + + <Grid x:Name="transportControls" VerticalAlignment="Bottom" Height="40" Background="#FF000000" + Grid.Row="1" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="0" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" MinWidth="10" /> + <ColumnDefinition Width="Auto" MinWidth="10" /> + </Grid.ColumnDefinitions> + + <!-- play symbol showing is checked = false, Pause symbol showing is checked = true--> + <ToggleButton x:Name="playPauseButton" Template="{StaticResource PlayButtonTemplate}" + Click="PlayPauseButton_Click" IsChecked="false"/> + + <Grid x:Name="time" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="40" /> + <ColumnDefinition Width="10" /> + <ColumnDefinition Width="40" /> + </Grid.ColumnDefinitions> + + <Slider x:Name="timelineSlider" Margin="0,1.5,0,0" HorizontalAlignment="Stretch" + Maximum="1" Style="{StaticResource SliderStyle}" Grid.Column="0" + ValueChanged="TimelineSlider_ValueChanged" + Value="0"/> + <TextBlock x:Name="currentTimeTextBlock" Margin="0,1.5,0,0" Height="12" + FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap" + Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Right" + TextAlignment="Right" Grid.Column="1"/> + <TextBlock Margin="0,1.5,0,0" Height="12" FontFamily="Verdana" FontSize="10" + Text="/" TextWrapping="Wrap" Foreground="#FFFFFFFF" + FontStyle="Normal" HorizontalAlignment="Center" TextAlignment="Right" + Grid.Column="2"/> + <TextBlock x:Name="totalTimeTextBlock" Margin="0,1.5,0,0" Height="12" + FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap" + Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Left" + TextAlignment="Right" Grid.Column="3"/> + </Grid> + + <ToggleButton IsChecked="false" Grid.Column="3" x:Name="muteButton" + Template="{StaticResource MuteButtonTemplate}" Click="MuteButton_Click" + VerticalAlignment="Center" Margin="0,0,6,0"/> + + <Slider Grid.Column="4" HorizontalAlignment="Stretch" Margin="3,0,0,0" + VerticalAlignment="Center" Maximum="1" x:Name="volumeSlider" + Background="#FF777777" Style="{StaticResource SliderStyle}" Width="50" + Value="{Binding ElementName=mediaElement, Mode=TwoWay, Path=Volume, UpdateSourceTrigger=Default}"/> + + <Button x:Name="fullScreenButton" Grid.Column="5" Margin="8,10,4,10" Click="FullScreenButton_Click" + Template="{StaticResource ButtonTemplate}" VerticalAlignment="Center"> + <Path Height="14.375" HorizontalAlignment="Stretch" + VerticalAlignment="Bottom" RenderTransformOrigin="0.212389379739761,0.208695650100708" + Data="M10.181361,8.375 L12.844413,11.008244 L14.125,9.7418737 L14.125,14.375 L9.675765,14.374833 L10.906104,13.158273 L8.125,10.408315 L10.181361,8.375 z M3.9666855,8.375 L6,10.431361 L3.3667567,13.094413 L4.6331258,14.375 L0,14.375 L0.00016707927,9.925765 L1.2167276,11.156104 L3.9666855,8.375 z M9.4918737,0 L14.125,0 L14.124833,4.449235 L12.908273,3.2188957 L10.158315,6 L8.125,3.943639 L10.758244,1.2805867 L9.4918737,0 z M0,0 L4.449235,0.00016686507 L3.2188957,1.2167276 L6,3.9666855 L3.943639,6 L1.280587,3.3667567 L0,4.6331258 L0,0 z" + Fill="#FF7F7F7F" Stretch="Fill" Stroke="#FF000000" StrokeThickness="0" /> + </Button> + </Grid> + </Grid> + </Border> +</UserControl>
\ No newline at end of file diff --git a/src/YalpClients/WebClient/MainPage.xaml.cs b/src/YalpClients/WebClient/MainPage.xaml.cs new file mode 100644 index 0000000..aa392f2 --- /dev/null +++ b/src/YalpClients/WebClient/MainPage.xaml.cs @@ -0,0 +1,198 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; + +namespace VideoPlayer +{ + // For best full-screen video performance, set EnableGPUAcceleration="true" on the plug-in. + // If hosting Silverlight from .aspx, add EnableGPUAcceleration="true" to the + // <asp:Silverlight> element. If hosting Silverlight from .html, add + // <param name="enableGPUAcceleration" value="true" /> under the <object> tag. + + public partial class MainPage : UserControl + { + // mediaElement.Position updates TimelineSlider.Value, and + // updating TimelineSlider.Value updates mediaElement.Position, + // this variable helps us break the infinite loop + private bool duringTickEvent = false; + + private bool playVideoWhenSliderDragIsOver = false; + + public MainPage() + { + InitializeComponent(); + + mediaElement.Source = new Uri("file:///D:/Test/countdown.wmv"); + //mit Datei: + //mediaElement.Source = new Uri("file:///D:/Test/countdown.wmv"); + //http://www.shoutcast.com/shoutcast_player?stationid=7806&Genre=Electronic&ContentFlag=1 + // + CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering); + Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged); + } + + private void MediaElement_MediaOpened(object sender, RoutedEventArgs e) + { + TimeSpan duration = mediaElement.NaturalDuration.TimeSpan; + totalTimeTextBlock.Text = TimeSpanToString(duration); + UpdateVideoSize(); + } + + #region play button + + private void BigPlayButton_Click(object sender, RoutedEventArgs e) + { + playPauseButton.IsChecked = true; + PlayPauseButton_Click(sender, e); + } + + private void PlayPauseButton_Click(object sender, RoutedEventArgs e) + { + bigPlayButton.Visibility = Visibility.Collapsed; + + // this will be the toggle button state after the click has been processed + if (playPauseButton.IsChecked == true) + mediaElement.Play(); + else + mediaElement.Pause(); + } + + #endregion + + #region timelineSlider + + private void Seek(double percentComplete) + { + if (duringTickEvent) + throw new Exception("Can't call Seek() now, you'll get an infinite loop"); + + TimeSpan duration = mediaElement.NaturalDuration.TimeSpan; + int newPosition = (int)(duration.TotalSeconds * percentComplete); + mediaElement.Position = new TimeSpan(0, 0, newPosition); + + // let the next CompositionTarget.Rendering take care of updating the text blocks + } + + private Slider GetSliderParent(object sender) + { + FrameworkElement element = (FrameworkElement)sender; + do + { + element = (FrameworkElement)VisualTreeHelper.GetParent(element); + } while (!(element is Slider)); + return (Slider)element; + } + + private void LeftTrack_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + e.Handled = true; + FrameworkElement lefttrack = (sender as FrameworkElement).FindName("LeftTrack") as FrameworkElement; + FrameworkElement righttrack = (sender as FrameworkElement).FindName("RightTrack") as FrameworkElement; + double position = e.GetPosition(lefttrack).X; + double width = righttrack.TransformToVisual(lefttrack).Transform(new Point(righttrack.ActualWidth, righttrack.ActualHeight)).X; + double percent = position / width; + Slider slider = GetSliderParent(sender); + slider.Value = percent; + } + + private void HorizontalThumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) + { + if (GetSliderParent(sender) != timelineSlider) return; + + bool notPlaying = (mediaElement.CurrentState == MediaElementState.Paused + || mediaElement.CurrentState == MediaElementState.Stopped); + + if (notPlaying) + { + playVideoWhenSliderDragIsOver = false; + } + else + { + playVideoWhenSliderDragIsOver = true; + mediaElement.Pause(); + } + } + + private void HorizontalThumb_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) + { + if (playVideoWhenSliderDragIsOver) + mediaElement.Play(); + } + + private void TimelineSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + if (duringTickEvent) + return; + + Seek(timelineSlider.Value); + } + + #endregion + + #region updating current time + + private void CompositionTarget_Rendering(object sender, EventArgs e) + { + duringTickEvent = true; + + TimeSpan duration = mediaElement.NaturalDuration.TimeSpan; + if (duration.TotalSeconds != 0) + { + double percentComplete = (mediaElement.Position.TotalSeconds / duration.TotalSeconds); + timelineSlider.Value = percentComplete; + string text = TimeSpanToString(mediaElement.Position); + if (this.currentTimeTextBlock.Text != text) + this.currentTimeTextBlock.Text = text; + } + + duringTickEvent = false; + } + + private static string TimeSpanToString(TimeSpan time) + { + return string.Format("{0:00}:{1:00}", (time.Hours * 60) + time.Minutes, time.Seconds); + } + #endregion + + private void MuteButton_Click(object sender, RoutedEventArgs e) + { + mediaElement.IsMuted = (bool)muteButton.IsChecked; + } + + #region fullscreen mode + + private void FullScreenButton_Click(object sender, RoutedEventArgs e) + { + var content = Application.Current.Host.Content; + content.IsFullScreen = !content.IsFullScreen; + } + + private void Content_FullScreenChanged(object sender, EventArgs e) + { + UpdateVideoSize(); + } + + private void UpdateVideoSize() + { + if (App.Current.Host.Content.IsFullScreen) + { + // mediaElement takes all available space + VideoRow.Height = new GridLength(1, GridUnitType.Star); + VideoColumn.Width = new GridLength(1, GridUnitType.Star); + } + else + { + // mediaElement is only as big as the source video + VideoRow.Height = new GridLength(1, GridUnitType.Auto); + VideoColumn.Width = new GridLength(1, GridUnitType.Auto); + } + } + + #endregion + } +}
\ No newline at end of file diff --git a/src/YalpClients/WebClient/Properties/AppManifest.xml b/src/YalpClients/WebClient/Properties/AppManifest.xml new file mode 100644 index 0000000..2e175fc --- /dev/null +++ b/src/YalpClients/WebClient/Properties/AppManifest.xml @@ -0,0 +1,16 @@ +<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" +> + <Deployment.Parts> + </Deployment.Parts> + + <!-- Uncomment the markup and update the fields below to make your application offline enabled + <Deployment.ApplicationIdentity> + <ApplicationIdentity + ShortName="Out of Browser Silverlight Application" + Title="Window Title of Your Silverlight Application"> + <ApplicationIdentity.Blurb>Description of your Silverlight application</ApplicationIdentity.Blurb> + </ApplicationIdentity> + </Deployment.ApplicationIdentity> + --> +</Deployment> diff --git a/src/YalpClients/WebClient/Properties/AssemblyInfo.cs b/src/YalpClients/WebClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a7710f2 --- /dev/null +++ b/src/YalpClients/WebClient/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VideoPlayer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("MSIT")] +[assembly: AssemblyProduct("VideoPlayer")] +[assembly: AssemblyCopyright("Copyright © MSIT 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("35c726b0-7859-4c8e-a45c-81dc889f321e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/YalpClients/WebClient/VideoPlayer.csproj b/src/YalpClients/WebClient/VideoPlayer.csproj new file mode 100644 index 0000000..5e6c3f4 --- /dev/null +++ b/src/YalpClients/WebClient/VideoPlayer.csproj @@ -0,0 +1,103 @@ +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{9254F122-1734-4DEC-9859-49C16D114EBA}</ProjectGuid> + <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>VideoPlayer</RootNamespace> + <AssemblyName>VideoPlayer</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <SilverlightApplication>true</SilverlightApplication> + <SupportedCultures> + </SupportedCultures> + <XapOutputs>true</XapOutputs> + <GenerateSilverlightManifest>true</GenerateSilverlightManifest> + <XapFilename>VideoPlayer.xap</XapFilename> + <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate> + <SilverlightAppEntry>VideoPlayer.App</SilverlightAppEntry> + <TestPageFileName>TestPage.html</TestPageFileName> + <CreateTestPage>true</CreateTestPage> + <ValidateXaml>true</ValidateXaml> + <UsePlatformExtensions>false</UsePlatformExtensions> + <ThrowErrorsInValidation>true</ThrowErrorsInValidation> + <LinkedServerProject> + </LinkedServerProject> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>Bin\Debug</OutputPath> + <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>Bin\Release</OutputPath> + <DefineConstants>TRACE;SILVERLIGHT</DefineConstants> + <NoStdLib>true</NoStdLib> + <NoConfig>true</NoConfig> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System.Windows" /> + <Reference Include="mscorlib" /> + <Reference Include="system" /> + <Reference Include="System.Core" /> + <Reference Include="System.Net" /> + <Reference Include="System.Windows.Controls.DataVisualization.Toolkit, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> + <Reference Include="System.Windows.Controls.Theming.ShinyRed, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> + <Reference Include="System.Windows.Controls.Theming.Toolkit, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Windows.Browser" /> + </ItemGroup> + <ItemGroup> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + </Compile> + <Compile Include="MainPage.xaml.cs"> + <DependentUpon>MainPage.xaml</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:MarkupCompilePass1</Generator> + </ApplicationDefinition> + <Page Include="MainPage.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:MarkupCompilePass1</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <None Include="Properties\AppManifest.xml" /> + </ItemGroup> + <ItemGroup> + <WCFMetadata Include="Service References\" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <ProjectExtensions> + <VisualStudio> + <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> + <SilverlightProjectProperties /> + </FlavorProperties> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/src/YalpClients/WebClient/VideoPlayer.csproj.user b/src/YalpClients/WebClient/VideoPlayer.csproj.user new file mode 100644 index 0000000..47ceb7f --- /dev/null +++ b/src/YalpClients/WebClient/VideoPlayer.csproj.user @@ -0,0 +1,28 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ProjectExtensions> + <VisualStudio> + <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> + <SilverlightProjectProperties> + <StartPageUrl> + </StartPageUrl> + <StartAction>DynamicPage</StartAction> + <AspNetDebugging>True</AspNetDebugging> + <NativeDebugging>False</NativeDebugging> + <SQLDebugging>False</SQLDebugging> + <ExternalProgram> + </ExternalProgram> + <StartExternalURL> + </StartExternalURL> + <StartCmdLineArguments> + </StartCmdLineArguments> + <StartWorkingDirectory> + </StartWorkingDirectory> + <ShowWebRefOnDebugPrompt>True</ShowWebRefOnDebugPrompt> + <OutOfBrowserProjectToDebug> + </OutOfBrowserProjectToDebug> + <ShowRiaSvcsOnDebugPrompt>True</ShowRiaSvcsOnDebugPrompt> + </SilverlightProjectProperties> + </FlavorProperties> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/src/YalpClients/WebClient/VideoPlayer.sln b/src/YalpClients/WebClient/VideoPlayer.sln new file mode 100644 index 0000000..9ef3f22 --- /dev/null +++ b/src/YalpClients/WebClient/VideoPlayer.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Web Developer Express 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoPlayer", "VideoPlayer.csproj", "{9254F122-1734-4DEC-9859-49C16D114EBA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9254F122-1734-4DEC-9859-49C16D114EBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9254F122-1734-4DEC-9859-49C16D114EBA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9254F122-1734-4DEC-9859-49C16D114EBA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9254F122-1734-4DEC-9859-49C16D114EBA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal |
