You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DiscordChatExporter/DiscordChatExporter.Gui/Views/RootView.xaml

374 lines
20 KiB

3 years ago
<Window
3 years ago
Background="{DynamicResource MaterialDesignPaper}"
FocusManager.FocusedElement="{Binding ElementName=TokenValueTextBox}"
Height="550"
Icon="/DiscordChatExporter;component/favicon.ico"
MinWidth="325"
Style="{DynamicResource MaterialDesignRoot}"
Width="600"
WindowStartupLocation="CenterScreen"
d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}"
mc:Ignorable="d"
x:Class="DiscordChatExporter.Gui.Views.RootView"
6 years ago
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:behaviors="clr-namespace:DiscordChatExporter.Gui.Behaviors"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
6 years ago
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:viewModels="clr-namespace:DiscordChatExporter.Gui.ViewModels"
3 years ago
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.TaskbarItemInfo>
3 years ago
<TaskbarItemInfo ProgressState="Normal" ProgressValue="{Binding Progress.Current.Fraction}" />
</Window.TaskbarItemInfo>
<Window.Resources>
3 years ago
<CollectionViewSource Source="{Binding AvailableChannels, Mode=OneWay}" x:Key="AvailableChannelsViewSource">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Category.Name" />
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<componentModel:SortDescription Direction="Ascending" PropertyName="Position" />
<componentModel:SortDescription Direction="Ascending" PropertyName="Name" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Window.Resources>
<materialDesign:DialogHost SnackbarMessageQueue="{Binding Notifications}" Style="{DynamicResource MaterialDesignEmbeddedDialogHost}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
6 years ago
<!-- Toolbar -->
3 years ago
<Grid Background="{DynamicResource MaterialDesignDarkBackground}" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
6 years ago
<!-- Token and pull data button -->
<materialDesign:Card
Grid.Column="0"
3 years ago
Grid.Row="0"
Margin="12,12,0,12">
6 years ago
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
6 years ago
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Token icon -->
<materialDesign:PackIcon
3 years ago
Foreground="{DynamicResource PrimaryHueMidBrush}"
Grid.Column="0"
Height="24"
3 years ago
Kind="Password"
Margin="8"
VerticalAlignment="Center"
3 years ago
Width="24" />
6 years ago
<!-- Token value -->
<TextBox
3 years ago
BorderThickness="0"
FontSize="16"
6 years ago
Grid.Column="1"
Margin="0,6,6,8"
3 years ago
Text="{Binding Token, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Bottom"
materialDesign:HintAssist.Hint="Token"
materialDesign:TextFieldAssist.DecorationVisibility="Hidden"
materialDesign:TextFieldAssist.TextBoxViewMargin="0,0,2,0"
3 years ago
x:Name="TokenValueTextBox" />
<!-- Pull data button -->
<Button
3 years ago
Command="{s:Action PopulateGuildsAndChannels}"
Grid.Column="2"
3 years ago
IsDefault="True"
Margin="0,6,6,6"
Padding="4"
Style="{DynamicResource MaterialDesignFlatButton}"
ToolTip="Pull available guilds and channels (Enter)">
<materialDesign:PackIcon
Height="24"
3 years ago
Kind="ArrowRight"
Width="24" />
</Button>
6 years ago
</Grid>
</materialDesign:Card>
6 years ago
<!-- Settings button -->
<Button
3 years ago
Command="{s:Action ShowSettings}"
Foreground="{DynamicResource MaterialDesignDarkForeground}"
Grid.Column="1"
6 years ago
Margin="6"
Padding="4"
Style="{DynamicResource MaterialDesignFlatButton}"
ToolTip="Settings">
<Button.Resources>
3 years ago
<SolidColorBrush Color="#4C4C4C" x:Key="MaterialDesignFlatButtonClick" />
</Button.Resources>
6 years ago
<materialDesign:PackIcon
Height="24"
3 years ago
Kind="Settings"
Width="24" />
6 years ago
</Button>
</Grid>
6 years ago
<!-- Progress bar -->
<ProgressBar
Background="{DynamicResource MaterialDesignDarkBackground}"
3 years ago
Grid.Row="1"
IsIndeterminate="{Binding IsProgressIndeterminate}"
3 years ago
Value="{Binding Progress.Current.Fraction, Mode=OneWay}" />
6 years ago
<!-- Content -->
<Grid
Background="{DynamicResource MaterialDesignCardBackground}"
3 years ago
Grid.Row="2"
IsEnabled="{Binding IsBusy, Converter={x:Static converters:InverseBoolConverter.Instance}}">
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontWeight" Value="Light" />
</Style>
</Grid.Resources>
6 years ago
<!-- Placeholder / usage instructions -->
<Grid Visibility="{Binding AvailableGuilds, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
3 years ago
<TextBlock FontSize="14" Margin="32,16">
<Run FontSize="18" Text="Please provide authentication token to continue" />
<LineBreak />
<LineBreak />
<!-- User token -->
<InlineUIContainer>
<materialDesign:PackIcon
Foreground="{DynamicResource PrimaryHueMidBrush}"
3 years ago
Kind="Account"
Margin="1,0,0,-2" />
</InlineUIContainer>
<Run FontSize="16" Text="Authenticate using your personal account" />
<LineBreak />
<Run Text="1. Open Discord in your" />
<Run FontWeight="SemiBold" Text="web browser" />
<Run Text="and login" />
<LineBreak />
<Run Text="2. Press" />
<Run FontWeight="SemiBold" Text="Ctrl+Shift+I" />
<Run Text="to show developer tools" />
<LineBreak />
<Run Text="3. Press" />
<Run FontWeight="SemiBold" Text="Ctrl+Shift+M" />
<Run Text="to toggle device toolbar" />
<LineBreak />
<Run Text="4. Navigate to the" />
<Run FontWeight="SemiBold" Text="Application" />
<Run Text="tab" />
<LineBreak />
<Run Text="5. On the left, expand" />
<Run FontWeight="SemiBold" Text="Local Storage" />
<Run Text="and select" />
<Run FontWeight="SemiBold" Text="https://discord.com" />
<LineBreak />
<Run Text="6. Type" />
<Run FontWeight="SemiBold" Text="token" />
<Run Text="into the" />
<Run FontWeight="SemiBold" Text="Filter" />
<Run Text="box" />
<LineBreak />
<Run Text="7. If the token key does not appear, press" />
<Run FontWeight="SemiBold" Text="Ctrl+R" />
<Run Text="to reload" />
<LineBreak />
<Run Text="8. Copy the value of the" />
<Run FontWeight="SemiBold" Text="token" />
<Run Text="key" />
<LineBreak />
<Run Text="* Automating user accounts is technically against TOS, use at your own risk!" />
<LineBreak />
<LineBreak />
<!-- Bot token -->
<InlineUIContainer>
<materialDesign:PackIcon
Foreground="{DynamicResource PrimaryHueMidBrush}"
3 years ago
Kind="Robot"
Margin="1,0,0,-2" />
</InlineUIContainer>
<Run FontSize="16" Text="Authenticate as a bot" />
<LineBreak />
<Run Text="1. Open Discord developer portal" />
<LineBreak />
<Run Text="2. Open your application's settings" />
<LineBreak />
<Run Text="3. Navigate to the" />
<Run FontWeight="SemiBold" Text="Bot" />
<Run Text="section on the left" />
<LineBreak />
<Run Text="4. Under" />
<Run FontWeight="SemiBold" Text="Token" />
<Run Text="click" />
<Run FontWeight="SemiBold" Text="Copy" />
<LineBreak />
<LineBreak />
<Run FontSize="16" Text="If you have questions or issues, please refer to the" />
<Hyperlink Command="{s:Action ShowHelp}" FontSize="16">wiki</Hyperlink><Run FontSize="16" Text="." />
</TextBlock>
</ScrollViewer>
</Grid>
<!-- Guilds and channels -->
<Grid Background="{DynamicResource MaterialDesignCardBackground}" Visibility="{Binding AvailableGuilds, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
6 years ago
<!-- Guilds -->
<Border
BorderBrush="{DynamicResource MaterialDesignDivider}"
3 years ago
BorderThickness="0,0,1,0"
Grid.Column="0">
6 years ago
<ListBox
ItemsSource="{Binding AvailableGuilds}"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
SelectedItem="{Binding SelectedGuild}"
SelectionMode="Single">
6 years ago
<ListBox.ItemTemplate>
<DataTemplate>
6 years ago
<Grid
Background="Transparent"
Cursor="Hand"
3 years ago
Margin="-8"
4 years ago
ToolTip="{Binding Name}">
6 years ago
<!-- Guild icon placeholder -->
<Ellipse
3 years ago
Fill="{DynamicResource MaterialDesignDivider}"
6 years ago
Height="48"
Margin="12,4,12,4"
3 years ago
Width="48" />
6 years ago
<!-- Guild icon -->
<Ellipse
Height="48"
Margin="12,4,12,4"
Stroke="{DynamicResource MaterialDesignDivider}"
3 years ago
StrokeThickness="1"
Width="48">
6 years ago
<Ellipse.Fill>
4 years ago
<ImageBrush ImageSource="{Binding IconUrl}" />
6 years ago
</Ellipse.Fill>
</Ellipse>
</Grid>
6 years ago
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<!-- Channels -->
<Border Grid.Column="1">
<ListBox
HorizontalContentAlignment="Stretch"
ItemsSource="{Binding Source={StaticResource AvailableChannelsViewSource}}"
SelectionMode="Extended"
TextSearch.TextPath="Model.Name"
VirtualizingPanel.IsVirtualizingWhenGrouping="True">
<i:Interaction.Behaviors>
4 years ago
<behaviors:ChannelMultiSelectionListBoxBehavior SelectedItems="{Binding SelectedChannels}" />
</i:Interaction.Behaviors>
<ListBox.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate d:DataContext="{x:Type CollectionViewGroup}">
<Expander
Background="Transparent"
BorderBrush="{DynamicResource MaterialDesignDivider}"
BorderThickness="0,0,0,1"
Header="{Binding Name}"
3 years ago
IsExpanded="False"
Margin="0"
Padding="0">
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListBox.GroupStyle>
6 years ago
<ListBox.ItemTemplate>
<DataTemplate>
3 years ago
<Grid Background="Transparent" Margin="-8">
<Grid.InputBindings>
<MouseBinding Command="{s:Action ExportChannels}" MouseAction="LeftDoubleClick" />
</Grid.InputBindings>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Channel icon -->
6 years ago
<materialDesign:PackIcon
Grid.Column="0"
3 years ago
Kind="Pound"
6 years ago
Margin="16,7,0,6"
3 years ago
VerticalAlignment="Center" />
<!-- Channel name -->
6 years ago
<TextBlock
3 years ago
FontSize="14"
Grid.Column="1"
6 years ago
Margin="3,8,8,8"
3 years ago
Text="{Binding Name, Mode=OneWay}"
VerticalAlignment="Center" />
<!-- Is selected checkmark -->
<materialDesign:PackIcon
Grid.Column="2"
Height="24"
3 years ago
Kind="Check"
Margin="8,0"
VerticalAlignment="Center"
3 years ago
Visibility="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
Width="24" />
</Grid>
6 years ago
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</Grid>
<!-- Export button -->
<Button
Command="{s:Action ExportChannels}"
3 years ago
HorizontalAlignment="Right"
Margin="32,24"
3 years ago
Style="{DynamicResource MaterialDesignFloatingActionAccentButton}"
3 years ago
VerticalAlignment="Bottom"
Visibility="{Binding CanExportChannels, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<materialDesign:PackIcon
Height="32"
3 years ago
Kind="Download"
Width="32" />
</Button>
<!-- Notifications snackbar -->
<materialDesign:Snackbar MessageQueue="{Binding Notifications}" />
6 years ago
</Grid>
</Grid>
6 years ago
</materialDesign:DialogHost>
3 years ago
</Window>