Skip to content

Commit

Permalink
Show all listening HTTP streming URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienwarin committed Nov 15, 2019
1 parent f214fa5 commit bbca5f0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
33 changes: 27 additions & 6 deletions SWYH/Windows/HTTPLiveStreamWindow.xaml
@@ -1,13 +1,34 @@
<Window x:Class="SWYH.HTTPLiveStreamWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Stream What You Hear - Sebastien.warin.fr" Height="179" Width="477" Icon="/SWYH;component/Resources/Icons/swyh48.ico"
Title="Stream What You Hear - Sebastien.warin.fr" SizeToContent="WidthAndHeight" Icon="/SWYH;component/Resources/Icons/swyh48.ico"
Loaded="Window_Loaded" WindowState="Normal" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Closing="Window_Closing" Topmost="True" KeyDown="Window_KeyDown">
<Grid>
<TextBlock Margin="144,16,12,0" TextWrapping="Wrap" FontFamily="Showcard Gothic" TextAlignment="Center" Height="59" VerticalAlignment="Top"><Run FontSize="21.333" FontFamily="Segoe WP Black" Text="Stream What You Hear HTTP Live Streaming URI"/></TextBlock>
<Image HorizontalAlignment="Left" Margin="8,8,0,0" Source="../Resources/Icons/swyh128.png" Stretch="Fill" Width="128" Height="128" VerticalAlignment="Top"/>
<TextBox IsReadOnly="True" VerticalContentAlignment="Center" Height="25" Margin="142,81,54,0" TextWrapping="Wrap" VerticalAlignment="Top" FontFamily="Segoe WP Semibold" x:Name="txtUrl"></TextBox>
<TextBlock Cursor="Hand" FontFamily="Segoe WP Semibold" Foreground="#FF003EFF" Margin="0,84,10,0" TextDecorations="Underline" TextWrapping="Wrap" Height="20" Width="34" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown" VerticalAlignment="Top" HorizontalAlignment="Right"><Run Text="Copy"/></TextBlock>
<TextBlock FontFamily="Segoe WP Semibold" TextWrapping="Wrap" Margin="145,110,49,-2"><Run Text="Warning : don't start this live streaming on this local computer (music loopback ;)"/></TextBlock>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Margin="8" Source="../Resources/Icons/swyh128.png" Stretch="Fill" Width="128" Height="128" VerticalAlignment="Top"/>
<StackPanel Grid.Column="1" MinHeight="200">
<TextBlock Margin="10" TextWrapping="Wrap" TextAlignment="Center"><Run FontSize="21.333" FontFamily="Segoe WP Black" Text="Stream What You Hear HTTP Live Streaming"/></TextBlock>
<TextBlock Margin="10, 0" TextDecorations="Underline" FontFamily="Segoe WP Semibold" TextWrapping="Wrap"><Run Text="Listening URIs:"/></TextBlock>
<ItemsControl Margin="5" ItemsSource="{Binding Uris}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" IsReadOnly="True" VerticalContentAlignment="Center" Height="25" TextWrapping="Wrap" FontFamily="Segoe WP Semibold" Text="{Binding Mode=OneWay}"></TextBox>
<TextBlock Margin="5,0,0,0" Grid.Column="1" Cursor="Hand" FontFamily="Segoe WP Semibold" Foreground="#FF003EFF" TextDecorations="Underline" TextWrapping="Wrap" Height="20" Width="34" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"><Run Text="Copy"/></TextBlock>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
<TextBlock FontFamily="Segoe WP Semibold" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Bottom"><Run Text="Warning : don't start this live streaming on this local computer (music loopback ;)"/></TextBlock>
</Grid>
</Window>
9 changes: 6 additions & 3 deletions SWYH/Windows/HTTPLiveStreamWindow.xaml.cs
Expand Up @@ -23,27 +23,30 @@

namespace SWYH
{
using System.Linq;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;

/// <summary>
/// Interaction logic for HTTPLiveStreamWindow.xaml
/// </summary>
public partial class HTTPLiveStreamWindow : Window
{
public List<string> Uris => App.CurrentInstance.swyhDevice.ContentDirectory.GetWasapiUris(Audio.AudioFormats.Format.Mp3);

public HTTPLiveStreamWindow()
{
InitializeComponent();
this.DataContext = this;
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{
txtUrl.Text = App.CurrentInstance.swyhDevice.ContentDirectory.GetWasapiUris(Audio.AudioFormats.Format.Mp3).FirstOrDefault();
}

private void TextBlock_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
System.Windows.Clipboard.SetText(txtUrl.Text);
System.Windows.Clipboard.SetText(((TextBlock)sender).DataContext as string);
}

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
Expand Down

0 comments on commit bbca5f0

Please sign in to comment.