Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

Commit

Permalink
Add Video URL to Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
daramkun committed Aug 6, 2018
1 parent 0f426b7 commit be71842
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Daramee.YouTubeUploader/Strings.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Daramee.YouTubeUploader/UploadItemEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<RowDefinition Height="32" />
<RowDefinition Height="64" />
<RowDefinition Height="32" />
<RowDefinition Height="32" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64" />
Expand All @@ -44,6 +45,7 @@
<TextBlock Text="{Binding [editor_textblock_category], Source={x:Static dcl:StringTable.SharedStrings}}" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Style="{StaticResource textBlockStyle}" />
<TextBlock Text="{Binding [editor_textblock_etc], Source={x:Static dcl:StringTable.SharedStrings}}" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Style="{StaticResource textBlockStyle}" />
<TextBlock Text="{Binding [editor_textblock_thumbnail], Source={x:Static dcl:StringTable.SharedStrings}}" Grid.Row="5" Grid.Column="0" VerticalAlignment="Top" Style="{StaticResource textBlockStyle}" Margin="0,7,0,0" />
<TextBlock Text="{Binding [editor_textblock_url], Source={x:Static dcl:StringTable.SharedStrings}}" Grid.Row="6" Grid.Column="0" VerticalAlignment="Top" Style="{StaticResource textBlockStyle}" Margin="0,7,0,0" />

<TextBox Text="{Binding Title}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" />
<TextBox Text="{Binding Description}" Grid.Row="1" Grid.Column="1" Margin="0,8,0,8"
Expand Down Expand Up @@ -100,6 +102,12 @@
</TextBlock>
</StackPanel>
</Grid>

<TextBlock Grid.Row="6" Grid.Column="1" VerticalAlignment="Center">
<Hyperlink Click="URLHyperlink_Click">
<TextBlock Name="textBlockURL" Text="{Binding URL}" />
</Hyperlink>
</TextBlock>
</Grid>
</ScrollViewer>
</Border>
Expand Down
6 changes: 6 additions & 0 deletions Daramee.YouTubeUploader/UploadItemEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -158,5 +159,10 @@ private void SetThumbnailImage ( BitmapSource bitmapSource )

GC.Collect ();
}

private void URLHyperlink_Click ( object sender, RoutedEventArgs e )
{
Process.Start ( textBlockURL.Text );
}
}
}
2 changes: 1 addition & 1 deletion Daramee.YouTubeUploader/YouTube/Categories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Categories
{
new VideoCategory ()
{
Name = StringTable.SharedStrings [ "category_none" ],
Name = StringTable.SharedStrings? [ "category_none" ],
Id = null
}
};
Expand Down
1 change: 1 addition & 0 deletions Daramee.YouTubeUploader/YouTube/IUploadItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Daramee.YouTubeUploader.YouTube
public interface IUploadItem : INotifyPropertyChanged
{
Uri FileName { get; }
Uri URL { get; }

string Title { get; set; }
string Description { get; set; }
Expand Down
8 changes: 8 additions & 0 deletions Daramee.YouTubeUploader/YouTube/MultipleUploadItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ public Uri FileName
return collection.First ().FileName;
}
}
public Uri URL
{
get
{
if ( collection.Count > 1 ) return null;
return collection.First ().URL;
}
}

public string Title
{
Expand Down
11 changes: 11 additions & 0 deletions Daramee.YouTubeUploader/YouTube/UploadItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public sealed class UploadItem : IUploadItem, IDisposable
#endregion

public Uri FileName { get; private set; }
public Uri URL
{
get
{
if ( string.IsNullOrEmpty ( video.Id ) ) return null;
return new Uri ( $"https://youtube.com/watch?v={video.Id}" );
}
}

public string Title { get { return video.Snippet.Title; } set { video.Snippet.Title = value; PC (); } }
public string Description { get { return video.Snippet.Description; } set { video.Snippet.Description = value; PC (); } }
public PrivacyStatus PrivacyStatus
Expand Down Expand Up @@ -248,6 +257,8 @@ await videoInsertRequest.UploadAsync ( cancellationTokenSource.Token ) :
return UploadResult.UploadCanceled;
}

PC ( nameof ( URL ) );

return UploadResult.Succeed;
}

Expand Down

0 comments on commit be71842

Please sign in to comment.