[GUI] Clean up the UI

pull/403/head
Alexey Golub 4 years ago
parent 239c47c06e
commit a6bf546e79

@ -6,13 +6,13 @@ namespace DiscordChatExporter.Gui.Services
{ {
public class SettingsService : SettingsManager public class SettingsService : SettingsManager
{ {
public string DateFormat { get; set; } = "dd-MMM-yy hh:mm tt";
public bool IsAutoUpdateEnabled { get; set; } = true; public bool IsAutoUpdateEnabled { get; set; } = true;
public bool IsDarkModeEnabled { get; set; }
public bool IsTokenPersisted { get; set; } = true; public bool IsTokenPersisted { get; set; } = true;
public bool IsDarkThemeEnabled { get; set; } = false; public string DateFormat { get; set; } = "dd-MMM-yy hh:mm tt";
public int ParallelLimit { get; set; } = 1; public int ParallelLimit { get; set; } = 1;

@ -8,28 +8,28 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
{ {
private readonly SettingsService _settingsService; private readonly SettingsService _settingsService;
public string DateFormat
{
get => _settingsService.DateFormat;
set => _settingsService.DateFormat = value;
}
public bool IsAutoUpdateEnabled public bool IsAutoUpdateEnabled
{ {
get => _settingsService.IsAutoUpdateEnabled; get => _settingsService.IsAutoUpdateEnabled;
set => _settingsService.IsAutoUpdateEnabled = value; set => _settingsService.IsAutoUpdateEnabled = value;
} }
public bool IsDarkModeEnabled
{
get => _settingsService.IsDarkModeEnabled;
set => _settingsService.IsDarkModeEnabled = value;
}
public bool IsTokenPersisted public bool IsTokenPersisted
{ {
get => _settingsService.IsTokenPersisted; get => _settingsService.IsTokenPersisted;
set => _settingsService.IsTokenPersisted = value; set => _settingsService.IsTokenPersisted = value;
} }
public bool IsDarkThemeEnabled public string DateFormat
{ {
get => _settingsService.IsDarkThemeEnabled; get => _settingsService.DateFormat;
set => _settingsService.IsDarkThemeEnabled = value; set => _settingsService.DateFormat = value;
} }
public int ParallelLimit public int ParallelLimit

@ -108,7 +108,7 @@ namespace DiscordChatExporter.Gui.ViewModels
TokenValue = _settingsService.LastToken.Value; TokenValue = _settingsService.LastToken.Value;
} }
if (_settingsService.IsDarkThemeEnabled) if (_settingsService.IsDarkModeEnabled)
{ {
App.SetDarkTheme(); App.SetDarkTheme();
} }

@ -54,7 +54,7 @@
<Run Text="{Binding Channels[0].Category, Mode=OneWay}" ToolTip="{Binding Channels[0].Category, Mode=OneWay}" /> <Run Text="{Binding Channels[0].Category, Mode=OneWay}" ToolTip="{Binding Channels[0].Category, Mode=OneWay}" />
<Run Text="/" /> <Run Text="/" />
<Run <Run
FontWeight="DemiBold" FontWeight="SemiBold"
Text="{Binding Channels[0].Name, Mode=OneWay}" Text="{Binding Channels[0].Name, Mode=OneWay}"
ToolTip="{Binding Channels[0].Name, Mode=OneWay}" /> ToolTip="{Binding Channels[0].Name, Mode=OneWay}" />
</TextBlock> </TextBlock>

@ -17,14 +17,6 @@
FontSize="17" FontSize="17"
Text="Settings" /> Text="Settings" />
<!-- Date format -->
<TextBox
Margin="16,8"
materialDesign:HintAssist.Hint="Date format"
materialDesign:HintAssist.IsFloating="True"
Text="{Binding DateFormat}"
ToolTip="Format used when rendering dates (refer to .NET date format)" />
<!-- Auto-updates --> <!-- Auto-updates -->
<DockPanel <DockPanel
Background="Transparent" Background="Transparent"
@ -40,22 +32,25 @@
IsChecked="{Binding IsAutoUpdateEnabled}" /> IsChecked="{Binding IsAutoUpdateEnabled}" />
</DockPanel> </DockPanel>
<!-- Persist token --> <!-- Dark mode -->
<DockPanel <DockPanel
Background="Transparent" Background="Transparent"
LastChildFill="False" LastChildFill="False"
ToolTip="Persist last used token between sessions"> ToolTip="Use darker colors in the UI">
<TextBlock <TextBlock
Margin="16,8" Margin="16,8"
DockPanel.Dock="Left" DockPanel.Dock="Left"
Text="Save token" /> Text="Dark mode" />
<ToggleButton <ToggleButton
x:Name="DarkModeToggleButton"
Margin="16,8" Margin="16,8"
Checked="DarkModeToggleButton_Checked"
DockPanel.Dock="Right" DockPanel.Dock="Right"
IsChecked="{Binding IsTokenPersisted}" /> IsChecked="{Binding IsDarkModeEnabled}"
Unchecked="DarkModeToggleButton_Unchecked" />
</DockPanel> </DockPanel>
<!-- Dark/Light theme --> <!-- Persist token -->
<DockPanel <DockPanel
Background="Transparent" Background="Transparent"
LastChildFill="False" LastChildFill="False"
@ -63,23 +58,29 @@
<TextBlock <TextBlock
Margin="16,8" Margin="16,8"
DockPanel.Dock="Left" DockPanel.Dock="Left"
Text="Dark theme" /> Text="Save token" />
<ToggleButton <ToggleButton
Margin="16,8" Margin="16,8"
Checked="ToggleButton_Checked"
DockPanel.Dock="Right" DockPanel.Dock="Right"
IsChecked="{Binding IsDarkThemeEnabled}" IsChecked="{Binding IsTokenPersisted}" />
Unchecked="ToggleButton_Unchecked" />
</DockPanel> </DockPanel>
<!-- Date format -->
<TextBox
Margin="16,8"
materialDesign:HintAssist.Hint="Date format"
materialDesign:HintAssist.IsFloating="True"
Text="{Binding DateFormat}"
ToolTip="Format used when rendering dates (uses .NET date formatting rules)" />
<!-- Parallel limit --> <!-- Parallel limit -->
<StackPanel Background="Transparent" ToolTip="How many channels can be exported at the same time"> <StackPanel Background="Transparent" ToolTip="How many channels can be exported at the same time">
<TextBlock Margin="16,8"> <TextBlock Margin="16,8,16,4">
<Run Text="Parallel limit:" /> <Run Text="Parallel limit:" />
<Run Text="{Binding ParallelLimit, Mode=OneWay}" /> <Run Text="{Binding ParallelLimit, Mode=OneWay}" />
</TextBlock> </TextBlock>
<Slider <Slider
Margin="16,8" Margin="16,4,16,8"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
Maximum="10" Maximum="10"
Minimum="1" Minimum="1"

@ -9,12 +9,12 @@ namespace DiscordChatExporter.Gui.Views.Dialogs
InitializeComponent(); InitializeComponent();
} }
private void ToggleButton_Checked(object sender, RoutedEventArgs e) private void DarkModeToggleButton_Checked(object sender, RoutedEventArgs e)
{ {
App.SetDarkTheme(); App.SetDarkTheme();
} }
private void ToggleButton_Unchecked(object sender, RoutedEventArgs e) private void DarkModeToggleButton_Unchecked(object sender, RoutedEventArgs e)
{ {
App.SetLightTheme(); App.SetLightTheme();
} }

@ -157,25 +157,25 @@
<Run Text="1. Open Discord" /> <Run Text="1. Open Discord" />
<LineBreak /> <LineBreak />
<Run Text="2. Press" /> <Run Text="2. Press" />
<Run FontWeight="Bold" Text="Ctrl+Shift+I" /> <Run FontWeight="SemiBold" Text="Ctrl+Shift+I" />
<Run Text="to show developer tools" /> <Run Text="to show developer tools" />
<LineBreak /> <LineBreak />
<Run Text="3. Navigate to the" /> <Run Text="3. Navigate to the" />
<Run FontWeight="Bold" Text="Application" /> <Run FontWeight="SemiBold" Text="Application" />
<Run Text="tab" /> <Run Text="tab" />
<LineBreak /> <LineBreak />
<Run Text="4. Select" /> <Run Text="4. Select" />
<Run FontWeight="Bold" Text="Local Storage" /> <Run FontWeight="SemiBold" Text="Local Storage" />
<Run Text="&gt;" /> <Run Text="&gt;" />
<Run FontWeight="Bold" Text="https://discord.com" /> <Run FontWeight="SemiBold" Text="https://discord.com" />
<Run Text="on the left" /> <Run Text="on the left" />
<LineBreak /> <LineBreak />
<Run Text="5. Press" /> <Run Text="5. Press" />
<Run FontWeight="Bold" Text="Ctrl+R" /> <Run FontWeight="SemiBold" Text="Ctrl+R" />
<Run Text="to reload" /> <Run Text="to reload" />
<LineBreak /> <LineBreak />
<Run Text="6. Find" /> <Run Text="6. Find" />
<Run FontWeight="Bold" Text="token" /> <Run FontWeight="SemiBold" Text="token" />
<Run Text="at the bottom and copy the value" /> <Run Text="at the bottom and copy the value" />
</TextBlock> </TextBlock>
<TextBlock Margin="0,24,0,0" FontSize="14"> <TextBlock Margin="0,24,0,0" FontSize="14">
@ -210,13 +210,13 @@
<Run Text="2. Open your application's settings" /> <Run Text="2. Open your application's settings" />
<LineBreak /> <LineBreak />
<Run Text="3. Navigate to the" /> <Run Text="3. Navigate to the" />
<Run FontWeight="Bold" Text="Bot" /> <Run FontWeight="SemiBold" Text="Bot" />
<Run Text="section on the left" /> <Run Text="section on the left" />
<LineBreak /> <LineBreak />
<Run Text="4. Under" /> <Run Text="4. Under" />
<Run FontWeight="Bold" Text="Token" /> <Run FontWeight="SemiBold" Text="Token" />
<Run Text="click" /> <Run Text="click" />
<Run FontWeight="Bold" Text="Copy" /> <Run FontWeight="SemiBold" Text="Copy" />
</TextBlock> </TextBlock>
<TextBlock Margin="0,24,0,0" FontSize="14"> <TextBlock Margin="0,24,0,0" FontSize="14">
<Run Text="To authorize using user token instead, click" /> <Run Text="To authorize using user token instead, click" />
@ -269,7 +269,9 @@
<Ellipse <Ellipse
Width="48" Width="48"
Height="48" Height="48"
Margin="12,4,12,4"> Margin="12,4,12,4"
Stroke="{DynamicResource MaterialDesignDivider}"
StrokeThickness="1">
<Ellipse.Fill> <Ellipse.Fill>
<ImageBrush ImageSource="{Binding IconUrl}" /> <ImageBrush ImageSource="{Binding IconUrl}" />
</Ellipse.Fill> </Ellipse.Fill>
@ -303,7 +305,7 @@
Padding="0" Padding="0"
Background="Transparent" Background="Transparent"
BorderBrush="{DynamicResource MaterialDesignDivider}" BorderBrush="{DynamicResource MaterialDesignDivider}"
BorderThickness="0,1,0,0" BorderThickness="0,0,0,1"
Header="{Binding Name}" Header="{Binding Name}"
IsExpanded="False"> IsExpanded="False">
<ItemsPresenter /> <ItemsPresenter />

Loading…
Cancel
Save