Improve performance (#162)

This commit is contained in:
Alexey Golub 2019-04-10 23:45:21 +03:00 committed by GitHub
parent 359278afec
commit 4bfb2ec7fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 1242 additions and 900 deletions

View file

@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DiscordChatExporter.Core.Helpers;
using DiscordChatExporter.Core.Models;
using DiscordChatExporter.Core.Services;
using DiscordChatExporter.Core.Services.Helpers;
using DiscordChatExporter.Gui.ViewModels.Components;
using DiscordChatExporter.Gui.ViewModels.Framework;
using Tyrrrz.Extensions;
namespace DiscordChatExporter.Gui.ViewModels.Dialogs
{
@ -85,7 +84,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
}
// If canceled - return
if (OutputPath.IsBlank())
if (OutputPath == null)
return;
// Close dialog

View file

@ -4,10 +4,10 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using DiscordChatExporter.Core.Exceptions;
using DiscordChatExporter.Core.Helpers;
using DiscordChatExporter.Core.Models;
using DiscordChatExporter.Core.Services;
using DiscordChatExporter.Core.Services.Exceptions;
using DiscordChatExporter.Core.Services.Helpers;
using DiscordChatExporter.Gui.ViewModels.Components;
using DiscordChatExporter.Gui.ViewModels.Framework;
using Gress;
@ -62,9 +62,9 @@ namespace DiscordChatExporter.Gui.ViewModels
// Update busy state when progress manager changes
ProgressManager.Bind(o => o.IsActive, (sender, args) => IsBusy = ProgressManager.IsActive);
ProgressManager.Bind(o => o.IsActive,
(sender, args) => IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress <= 0);
(sender, args) => IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress.IsEither(0, 1));
ProgressManager.Bind(o => o.Progress,
(sender, args) => IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress <= 0);
(sender, args) => IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress.IsEither(0, 1));
}
protected override async void OnViewLoaded()
@ -122,7 +122,7 @@ namespace DiscordChatExporter.Gui.ViewModels
await _dialogManager.ShowDialogAsync(dialog);
}
public bool CanPopulateGuildsAndChannels => !IsBusy && TokenValue.IsNotBlank();
public bool CanPopulateGuildsAndChannels => !IsBusy && !TokenValue.EmptyIfNull().IsWhiteSpace();
public async void PopulateGuildsAndChannels()
{
@ -235,7 +235,7 @@ namespace DiscordChatExporter.Gui.ViewModels
}
}
public bool CanExportChannels => !IsBusy && SelectedChannels.NotNullAndAny();
public bool CanExportChannels => !IsBusy && SelectedChannels.EmptyIfNull().Any();
public async void ExportChannels()
{