Development 4
This commit is contained in:
@@ -32,6 +32,7 @@ namespace FoxTube
|
|||||||
#region Static Information
|
#region Static Information
|
||||||
public static NetworkCredential EmailCredential { get => new NetworkCredential("youwillneverknowthisadress@gmail.com", "thisisthepassword12345"); }
|
public static NetworkCredential EmailCredential { get => new NetworkCredential("youwillneverknowthisadress@gmail.com", "thisisthepassword12345"); }
|
||||||
public static SecretsVault Vault { get => Methods.MainPage.Vault; }
|
public static SecretsVault Vault { get => Methods.MainPage.Vault; }
|
||||||
|
public static string AccountId => Methods.MainPage.Vault.userId;
|
||||||
private static ClientSecrets Secrets
|
private static ClientSecrets Secrets
|
||||||
{
|
{
|
||||||
get => new ClientSecrets()
|
get => new ClientSecrets()
|
||||||
@@ -63,6 +64,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
#region Object containers
|
#region Object containers
|
||||||
public bool IsLoged = false;
|
public bool IsLoged = false;
|
||||||
|
public string userId;
|
||||||
public UserCredential Credential;
|
public UserCredential Credential;
|
||||||
public event EventHandler AuthorizationStateChanged;
|
public event EventHandler AuthorizationStateChanged;
|
||||||
|
|
||||||
@@ -75,6 +77,10 @@ namespace FoxTube
|
|||||||
IsLoged = true;
|
IsLoged = true;
|
||||||
AuthorizationStateChanged.Invoke(this, null);
|
AuthorizationStateChanged.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var request = Service.Channels.List("snippet");
|
||||||
|
request.Mine = true;
|
||||||
|
userId = (await request.ExecuteAsync()).Items[0].Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Deauthenticate()
|
public async void Deauthenticate()
|
||||||
|
|||||||
@@ -30,11 +30,19 @@
|
|||||||
<TextBlock Name="meta" Foreground="Gray" FontSize="13" Text="[Author's name] | [Published time span] [?](edited)"/>
|
<TextBlock Name="meta" Foreground="Gray" FontSize="13" Text="[Author's name] | [Published time span] [?](edited)"/>
|
||||||
<TextBlock Name="text" IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords" Grid.Row="1" Text="[Content]"/>
|
<TextBlock Name="text" IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords" Grid.Row="1" Text="[Content]"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1" Name="editor" Visibility="Collapsed">
|
||||||
|
<TextBox Name="editorText" Text="[Content]" AcceptsReturn="True" Height="Auto" TextChanged="editorText_TextChanged"/>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,0,5">
|
||||||
|
<Button Name="editorClose" Content="Cancel" Click="editorClose_Click"/>
|
||||||
|
<Button Name="editorSend" Content="Submit" Margin="5,0,0,0" Click="editorSend_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ProgressBar Name="editorSending" Foreground="Red" IsIndeterminate="True" Visibility="Collapsed"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||||
<Button Name="upvote" Background="Transparent" Foreground="Gray" Padding="0"
|
<TextBlock Name="upvote" Foreground="Gray" Padding="0"
|
||||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
VerticalAlignment="Center" Margin="0,0,5,0"
|
||||||
Height="35" Width="35"
|
FontFamily="Segoe MDL2 Assets" Text="" FontSize="20"/>
|
||||||
FontFamily="Segoe MDL2 Assets" Content="" FontSize="20"/>
|
|
||||||
<TextBlock Name="rating" Foreground="Gray" VerticalAlignment="Center" Text="123"/>
|
<TextBlock Name="rating" Foreground="Gray" VerticalAlignment="Center" Text="123"/>
|
||||||
|
|
||||||
<Button Visibility="Collapsed" Name="downvote" Background="Transparent" Foreground="Gray" Padding="0"
|
<Button Visibility="Collapsed" Name="downvote" Background="Transparent" Foreground="Gray" Padding="0"
|
||||||
@@ -59,6 +67,15 @@
|
|||||||
<TextBlock Text="Reply"/>
|
<TextBlock Text="Reply"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button Click="editBtn_Click" Visibility="Collapsed" Name="editBtn" Background="Transparent" Foreground="Gray" Padding="0" Margin="10,0,0,0"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||||
|
Height="35">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="20"/>
|
||||||
|
<TextBlock Text="Edit"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ using Windows.UI.Popups;
|
|||||||
|
|
||||||
namespace FoxTube.Controls
|
namespace FoxTube.Controls
|
||||||
{
|
{
|
||||||
|
public enum CommentType { TopLevel, Reply }
|
||||||
public sealed partial class CommentCard : UserControl
|
public sealed partial class CommentCard : UserControl
|
||||||
{
|
{
|
||||||
Comment item;
|
Comment item;
|
||||||
|
CommentType type = CommentType.TopLevel;
|
||||||
string NextPageToken;
|
string NextPageToken;
|
||||||
|
|
||||||
public CommentCard(CommentThread comment)
|
public CommentCard(CommentThread comment)
|
||||||
@@ -52,6 +54,9 @@ namespace FoxTube.Controls
|
|||||||
else
|
else
|
||||||
rating.Text = comment.Snippet.TopLevelComment.Snippet.LikeCount.HasValue ? comment.Snippet.TopLevelComment.Snippet.LikeCount.ToString() : "";
|
rating.Text = comment.Snippet.TopLevelComment.Snippet.LikeCount.HasValue ? comment.Snippet.TopLevelComment.Snippet.LikeCount.ToString() : "";
|
||||||
|
|
||||||
|
if (item.Snippet.AuthorChannelId.ToString().Split('"')[3] == SecretsVault.AccountId)
|
||||||
|
editBtn.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
meta.Text = string.Format("{0} | {1} {2}", comment.Snippet.TopLevelComment.Snippet.AuthorDisplayName, Methods.GetAgo(comment.Snippet.TopLevelComment.Snippet.PublishedAt.Value), comment.Snippet.TopLevelComment.Snippet.UpdatedAt != comment.Snippet.TopLevelComment.Snippet.PublishedAt ? "(edited)" : "");
|
meta.Text = string.Format("{0} | {1} {2}", comment.Snippet.TopLevelComment.Snippet.AuthorDisplayName, Methods.GetAgo(comment.Snippet.TopLevelComment.Snippet.PublishedAt.Value), comment.Snippet.TopLevelComment.Snippet.UpdatedAt != comment.Snippet.TopLevelComment.Snippet.PublishedAt ? "(edited)" : "");
|
||||||
Methods.FormatText(ref text, comment.Snippet.TopLevelComment.Snippet.TextDisplay);
|
Methods.FormatText(ref text, comment.Snippet.TopLevelComment.Snippet.TextDisplay);
|
||||||
|
|
||||||
@@ -90,6 +95,7 @@ namespace FoxTube.Controls
|
|||||||
public void Initialize(Comment comment)
|
public void Initialize(Comment comment)
|
||||||
{
|
{
|
||||||
item = comment;
|
item = comment;
|
||||||
|
type = CommentType.Reply;
|
||||||
|
|
||||||
replyBtn.Visibility = Visibility.Collapsed;
|
replyBtn.Visibility = Visibility.Collapsed;
|
||||||
showReplies.Visibility = Visibility.Collapsed;
|
showReplies.Visibility = Visibility.Collapsed;
|
||||||
@@ -186,5 +192,39 @@ namespace FoxTube.Controls
|
|||||||
reply.IsEnabled = true;
|
reply.IsEnabled = true;
|
||||||
sending.Visibility = Visibility.Collapsed;
|
sending.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void editorClose_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = GridLength.Auto;
|
||||||
|
text.Visibility = Visibility.Visible;
|
||||||
|
editor.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editorSend_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if(type == CommentType.Reply)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editorText_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (editorText.Text.Length == 0)
|
||||||
|
editorSend.IsEnabled = false;
|
||||||
|
else editorSend.IsEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editBtn_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = new GridLength(0);
|
||||||
|
text.Visibility = Visibility.Collapsed;
|
||||||
|
editorText.Text = text.Text;
|
||||||
|
editor.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user