Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #338 from microsoft/robmikh/removevideolink
Browse files Browse the repository at this point in the history
Remove link button from Video Playground sample
  • Loading branch information
robmikh authored Sep 5, 2019
2 parents da7495d + 54de96f commit 1b2a428
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,10 @@
Margin="10, 10, 25, 10">
<!-- Controls to load video. -->
<TextBlock Text="Video Source" Style="{StaticResource VideoPlaygroundText}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="OpenFileButton"
Content="Open File"
Style="{StaticResource VideoPlaygroundButton}"
Command="{Binding OpenFileCommand}"/>
<Button x:Name="OpenUriButton"
Grid.Column="1"
Content="Open Link"
Style="{StaticResource VideoPlaygroundButton}"
Command="{Binding OpenLinkDialogCommand}"
CommandParameter="{Binding ElementName=LinkDialog}"/>
</Grid>
<Button x:Name="OpenFileButton"
Content="Open File"
Style="{StaticResource VideoPlaygroundButton}"
Command="{Binding OpenFileCommand}"/>

<!-- The rest of these controls shouldn't show if there is not video loaded, as
there shouldn't be a current effect assigned until then.-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ public LightMode LightMode
public IDelegateCommand AddLightCommand { get; private set; }
public IDelegateCommand RemoveLightCommand { get; private set; }
public IDelegateCommand OpenFileCommand { get; private set; }
public IDelegateCommand OpenLinkDialogCommand { get; private set; }
public IDelegateCommand OpenLinkCommand { get; private set; }
public IDelegateCommand AnimateCommand { get; private set; }
#endregion

Expand Down Expand Up @@ -227,8 +225,6 @@ public VideoPlaygroundViewModel(Compositor compositor, Grid videoContentGrid)
RemoveLightCommand = new DelegateCommand(RemoveLightButton);
AnimateCommand = new DelegateCommand(Animate);
OpenFileCommand = new DelegateCommand(OpenFile);
OpenLinkDialogCommand = new DelegateCommand(OpenLinkDialog);
OpenLinkCommand = new DelegateCommand(OpenLink);

DurationIndex = 0;
}
Expand All @@ -244,40 +240,6 @@ private void OpenFile(object obj)
LoadFile();
}

/// <summary>
/// Command that shows the given ContentDialog.
/// </summary>
/// <param name="param">The ContentDialog to show.</param>
private async void OpenLinkDialog(object param)
{
var dialog = param as ContentDialog;

if (dialog != null)
{
await dialog.ShowAsync();
}
}

/// <summary>
/// Command that opens the given link as a MediaSource.
/// </summary>
/// <param name="param">String that is a valid Uri.</param>
private void OpenLink(object param)
{
try
{
var link = param as String;

var source = MediaSource.CreateFromUri(new Uri(link));

LoadSource(source);
}
catch(Exception ex)
{
var ignored = ErrorMessage("Video Error", ex.Message);
}
}

/// <summary>
/// Show the file picker UI and returns the given video.
/// </summary>
Expand Down

0 comments on commit 1b2a428

Please sign in to comment.