mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 11:16:59 -04:00
[GUI] Block UI when an export is underway
This commit is contained in:
parent
a7da90943f
commit
82b0b8cb0a
6 changed files with 41 additions and 11 deletions
|
@ -11,18 +11,18 @@ namespace DiscordChatExporter.Gui.Converters
|
|||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is DateTimeOffset date)
|
||||
return date.DateTime;
|
||||
if (value is DateTimeOffset dateTimeOffsetValue)
|
||||
return dateTimeOffsetValue.DateTime;
|
||||
|
||||
return null;
|
||||
return default;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is DateTime date)
|
||||
return new DateTimeOffset(date);
|
||||
if (value is DateTime dateTimeValue)
|
||||
return new DateTimeOffset(dateTimeValue);
|
||||
|
||||
return null;
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,10 +12,10 @@ namespace DiscordChatExporter.Gui.Converters
|
|||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is ExportFormat format)
|
||||
return format.GetDisplayName();
|
||||
if (value is ExportFormat exportFormatValue)
|
||||
return exportFormatValue.GetDisplayName();
|
||||
|
||||
return null;
|
||||
return default;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
|
28
DiscordChatExporter.Gui/Converters/InverseBoolConverter.cs
Normal file
28
DiscordChatExporter.Gui/Converters/InverseBoolConverter.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DiscordChatExporter.Gui.Converters
|
||||
{
|
||||
[ValueConversion(typeof(bool), typeof(bool))]
|
||||
public class InverseBoolConverter : IValueConverter
|
||||
{
|
||||
public static InverseBoolConverter Instance { get; } = new InverseBoolConverter();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool boolValue)
|
||||
return !boolValue;
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool boolValue)
|
||||
return !boolValue;
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -61,6 +61,7 @@
|
|||
<Compile Include="Bootstrapper.cs" />
|
||||
<Compile Include="Converters\DateTimeOffsetToDateTimeConverter.cs" />
|
||||
<Compile Include="Converters\ExportFormatToStringConverter.cs" />
|
||||
<Compile Include="Converters\InverseBoolConverter.cs" />
|
||||
<Compile Include="ViewModels\Components\ChannelViewModel.cs" />
|
||||
<Compile Include="ViewModels\Components\GuildViewModel.cs" />
|
||||
<Compile Include="ViewModels\Dialogs\ExportSetupViewModel.cs" />
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Framework
|
|||
{
|
||||
public T DialogResult { get; private set; }
|
||||
|
||||
public void Close(T dialogResult = default(T))
|
||||
public void Close(T dialogResult = default)
|
||||
{
|
||||
// Set the result
|
||||
DialogResult = dialogResult;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:behaviors="clr-namespace:DiscordChatExporter.Gui.Behaviors"
|
||||
xmlns:converters="clr-namespace:DiscordChatExporter.Gui.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
|
@ -124,7 +125,7 @@
|
|||
Value="{Binding ProgressManager.Progress, Mode=OneWay}" />
|
||||
|
||||
<!-- Content -->
|
||||
<Grid Grid.Row="2">
|
||||
<Grid Grid.Row="2" IsEnabled="{Binding IsBusy, Converter={x:Static converters:InverseBoolConverter.Instance}}">
|
||||
<!-- Placeholder / usage instructions -->
|
||||
<Grid Margin="32,32,8,8" Visibility="{Binding AvailableGuilds, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}">
|
||||
<!-- For user token -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue