mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-21 05:28:39 +00:00
8
DiscordChatExporter.Gui/Models/ThreadInclusion.cs
Normal file
8
DiscordChatExporter.Gui/Models/ThreadInclusion.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace DiscordChatExporter.Gui.Models;
|
||||
|
||||
public enum ThreadInclusion
|
||||
{
|
||||
None,
|
||||
Active,
|
||||
All
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.IO;
|
||||
using Cogwheel;
|
||||
using DiscordChatExporter.Core.Exporting;
|
||||
using DiscordChatExporter.Gui.Models;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace DiscordChatExporter.Gui.Services;
|
||||
@@ -16,9 +17,7 @@ public partial class SettingsService : SettingsBase
|
||||
|
||||
public bool IsTokenPersisted { get; set; } = true;
|
||||
|
||||
public bool ShouldShowThreads { get; set; }
|
||||
|
||||
public bool ShouldShowArchivedThreads { get; set; }
|
||||
public ThreadInclusion ThreadInclusion { get; set; } = ThreadInclusion.None;
|
||||
|
||||
public string DateFormat { get; set; } = "MM/dd/yyyy h:mm tt";
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using DiscordChatExporter.Core.Discord.Data;
|
||||
using DiscordChatExporter.Core.Exceptions;
|
||||
using DiscordChatExporter.Core.Exporting;
|
||||
using DiscordChatExporter.Core.Utils.Extensions;
|
||||
using DiscordChatExporter.Gui.Models;
|
||||
using DiscordChatExporter.Gui.Services;
|
||||
using DiscordChatExporter.Gui.Utils;
|
||||
using DiscordChatExporter.Gui.ViewModels.Dialogs;
|
||||
@@ -169,12 +170,12 @@ public class DashboardViewModel : PropertyChangedBase
|
||||
}
|
||||
|
||||
// Threads
|
||||
if (_settingsService.ShouldShowThreads)
|
||||
if (_settingsService.ThreadInclusion != ThreadInclusion.None)
|
||||
{
|
||||
await foreach (
|
||||
var thread in _discord.GetGuildThreadsAsync(
|
||||
SelectedGuild.Id,
|
||||
_settingsService.ShouldShowArchivedThreads
|
||||
_settingsService.ThreadInclusion == ThreadInclusion.All
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DiscordChatExporter.Gui.Models;
|
||||
using DiscordChatExporter.Gui.Services;
|
||||
using DiscordChatExporter.Gui.ViewModels.Framework;
|
||||
|
||||
@@ -26,23 +28,13 @@ public class SettingsViewModel : DialogScreen
|
||||
set => _settingsService.IsTokenPersisted = value;
|
||||
}
|
||||
|
||||
public bool ShouldShowThreads
|
||||
{
|
||||
get => _settingsService.ShouldShowThreads;
|
||||
set => _settingsService.ShouldShowThreads = value;
|
||||
}
|
||||
public IReadOnlyList<ThreadInclusion> AvailableThreadInclusions { get; } =
|
||||
Enum.GetValues<ThreadInclusion>();
|
||||
|
||||
public bool ShouldShowArchivedThreads
|
||||
public ThreadInclusion ThreadInclusion
|
||||
{
|
||||
get => _settingsService.ShouldShowArchivedThreads;
|
||||
set
|
||||
{
|
||||
_settingsService.ShouldShowArchivedThreads = value;
|
||||
|
||||
// Enabling archived threads implicitly enables threads
|
||||
if (value)
|
||||
ShouldShowThreads = true;
|
||||
}
|
||||
get => _settingsService.ThreadInclusion;
|
||||
set => _settingsService.ThreadInclusion = value;
|
||||
}
|
||||
|
||||
public string DateFormat
|
||||
|
||||
@@ -82,36 +82,21 @@
|
||||
IsChecked="{Binding IsTokenPersisted}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- Show threads -->
|
||||
<!-- Thread inclusion -->
|
||||
<DockPanel
|
||||
Margin="16,8"
|
||||
Background="Transparent"
|
||||
LastChildFill="False"
|
||||
ToolTip="Pull threads and show them in the channel list">
|
||||
ToolTip="Which types of threads to show in the channel list">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
Text="Show threads" />
|
||||
<ToggleButton
|
||||
<ComboBox
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Right"
|
||||
IsChecked="{Binding ShouldShowThreads}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- Show archived threads -->
|
||||
<DockPanel
|
||||
Margin="16,8"
|
||||
Background="Transparent"
|
||||
LastChildFill="False"
|
||||
ToolTip="Pull archived threads and show them in the channel list">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
Text="Show archived threads" />
|
||||
<ToggleButton
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Right"
|
||||
IsChecked="{Binding ShouldShowArchivedThreads}" />
|
||||
ItemsSource="{Binding AvailableThreadInclusions}"
|
||||
SelectedItem="{Binding ThreadInclusion}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- Date format -->
|
||||
|
||||
Reference in New Issue
Block a user