mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-06-05 01:03:44 -04:00
Refactor & optimize changes in last commit
This commit is contained in:
parent
2c3b461d49
commit
efde9931c9
3 changed files with 111 additions and 51 deletions
|
@ -1,10 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.ComponentModel;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using DiscordChatExporter.Domain.Discord;
|
||||
using DiscordChatExporter.Domain.Discord.Models;
|
||||
using DiscordChatExporter.Domain.Exceptions;
|
||||
|
@ -44,34 +42,9 @@ namespace DiscordChatExporter.Gui.ViewModels
|
|||
|
||||
public Guild? SelectedGuild { get; set; }
|
||||
|
||||
|
||||
//Here for Legacy Purposes
|
||||
public IReadOnlyList<Channel>? AvailableChannelsList
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectedGuild != null ? GuildChannelMap?[SelectedGuild] : null;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollectionView? AvailableChannels
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = SelectedGuild != null ? GuildChannelMap?[SelectedGuild] : null;
|
||||
if (result != null)
|
||||
{
|
||||
var GroupedResults = CollectionViewSource.GetDefaultView(result);
|
||||
GroupedResults.GroupDescriptions.Clear();
|
||||
GroupedResults.SortDescriptions.Clear();
|
||||
GroupedResults.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
|
||||
GroupedResults.SortDescriptions.Add(new SortDescription("Category", ListSortDirection.Descending));
|
||||
return GroupedResults;
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<Channel>? AvailableChannels => SelectedGuild != null
|
||||
? GuildChannelMap?[SelectedGuild]
|
||||
: null;
|
||||
|
||||
public IReadOnlyList<Channel>? SelectedChannels { get; set; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue