Skip to content

Commit

Permalink
Remove the channel tab visibility condition
Browse files Browse the repository at this point in the history
  • Loading branch information
legend2k committed Sep 2, 2023
1 parent 557d43b commit c5c61ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
9 changes: 1 addition & 8 deletions YoutubeApp/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using MessageBox.Avalonia.Enums;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using YoutubeApp.Downloader;
using YoutubeApp.Messages;
Expand All @@ -23,8 +22,6 @@ public partial class MainWindowViewModel : ViewModelBase
private readonly Settings _settings;
private readonly IMessenger _messenger;

public bool ChannelsTabEnabled { get; init; }

public Grabber Grabber { get; protected init; }
[ObservableProperty] private int _downloadSpeed;

Expand Down Expand Up @@ -52,18 +49,14 @@ public WindowState WindowState
private bool _isShuttingDown;

public MainWindowViewModel(ILogger<MainWindowViewModel> logger, Grabber grabber, DownloadManager downloadManager,
Settings settings, IMessenger messenger, IConfiguration configuration)
Settings settings, IMessenger messenger)
{
_logger = logger;
_settings = settings;
_messenger = messenger;
DownloadManager = downloadManager;
Grabber = grabber;

var channelsTabEnabled = configuration["ChannelsTabEnabled"];
if (channelsTabEnabled is not null)
ChannelsTabEnabled = bool.Parse(channelsTabEnabled);

_ = Task.Run(async () =>
{
var success = await DownloadManager.InitializeAsync();
Expand Down
5 changes: 3 additions & 2 deletions YoutubeApp/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<views:DownloadsView />
</TabItem>

<TabItem Header="Channels" IsVisible="{Binding ChannelsTabEnabled}">
<TabItem Header="Channels">
<views:ChannelsView />
</TabItem>
</TabControl>
Expand All @@ -57,7 +57,8 @@
</Styles>
</StackPanel.Styles>

<StackPanel Orientation="Horizontal" Spacing="8" IsVisible="{Binding DownloadManager.ActiveDownloads.Count}">
<StackPanel Orientation="Horizontal" Spacing="8"
IsVisible="{Binding DownloadManager.ActiveDownloads.Count}">
<PathIcon Data="{StaticResource speedometer}" Width="18" Height="18" />
<TextBlock
Text="{Binding DownloadSpeed, Converter={StaticResource IntFilesizeConverter}, StringFormat={}{0}/s}"
Expand Down

0 comments on commit c5c61ed

Please sign in to comment.