Cleanup some code

pull/825/head
Oleksii Holub 3 years ago
parent ecb615ecf1
commit 5b563d4f00

@ -30,13 +30,13 @@ public class RootViewModel : Screen
private DiscordClient? _discord; private DiscordClient? _discord;
public SnackbarMessageQueue Notifications { get; } = new(TimeSpan.FromSeconds(5)); public bool IsBusy { get; private set; }
public ProgressContainer<Percentage> Progress { get; } = new(); public ProgressContainer<Percentage> Progress { get; } = new();
public bool IsBusy { get; private set; } public bool IsProgressIndeterminate => IsBusy && Progress.Current.Fraction is <= 0 or >= 1;
public bool IsProgressIndeterminate { get; private set; } public SnackbarMessageQueue Notifications { get; } = new(TimeSpan.FromSeconds(5));
public string? Token { get; set; } public string? Token { get; set; }
@ -63,17 +63,12 @@ public class RootViewModel : Screen
_settingsService = settingsService; _settingsService = settingsService;
_updateService = updateService; _updateService = updateService;
DisplayName = $"{App.Name} v{App.VersionString}";
_progressMuxer = Progress.CreateMuxer().WithAutoReset(); _progressMuxer = Progress.CreateMuxer().WithAutoReset();
this.Bind(o => o.IsBusy, (_, _) => DisplayName = $"{App.Name} v{App.VersionString}";
IsProgressIndeterminate = IsBusy && Progress.Current.Fraction is <= 0 or >= 1
);
Progress.Bind(o => o.Current, (_, _) => this.Bind(o => o.IsBusy, (_, _) => NotifyOfPropertyChange(() => IsProgressIndeterminate));
IsProgressIndeterminate = IsBusy && Progress.Current.Fraction is <= 0 or >= 1 Progress.Bind(o => o.Current, (_, _) => NotifyOfPropertyChange(() => IsProgressIndeterminate));
);
} }
private async ValueTask CheckForUpdatesAsync() private async ValueTask CheckForUpdatesAsync()

Loading…
Cancel
Save