Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loading icons to task queue #1173

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added TwitchDownloaderWPF/Images/ppStretch.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions TwitchDownloaderWPF/PageChatDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ private async void SplitBtnDownload_Click(object sender, RoutedEventArgs e)
private void BtnCancel_Click(object sender, RoutedEventArgs e)
{
statusMessage.Text = Translations.Strings.StatusCanceling;
SetImage("Images/ppStretch.gif", true);
try
{
_cancellationTokenSource.Cancel();
Expand Down
1 change: 1 addition & 0 deletions TwitchDownloaderWPF/PageChatRender.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ private void BtnEnqueue_Click(object sender, RoutedEventArgs e)
private void BtnCancel_Click(object sender, RoutedEventArgs e)
{
statusMessage.Text = Translations.Strings.StatusCanceling;
SetImage("Images/ppStretch.gif", true);
try
{
_cancellationTokenSource.Cancel();
Expand Down
1 change: 1 addition & 0 deletions TwitchDownloaderWPF/PageChatUpdate.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ private async void SplitBtnUpdate_Click(object sender, RoutedEventArgs e)
private void BtnCancel_Click(object sender, RoutedEventArgs e)
{
statusMessage.Text = Translations.Strings.StatusCanceling;
SetImage("Images/ppStretch.gif", true);
try
{
_cancellationTokenSource.Cancel();
Expand Down
1 change: 1 addition & 0 deletions TwitchDownloaderWPF/PageClipDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ private ClipDownloadOptions GetOptions(string fileName)
private void BtnCancel_Click(object sender, RoutedEventArgs e)
{
statusMessage.Text = Translations.Strings.StatusCanceling;
SetImage("Images/ppStretch.gif", true);
try
{
_cancellationTokenSource.Cancel();
Expand Down
2 changes: 2 additions & 0 deletions TwitchDownloaderWPF/PageQueue.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:TwitchDownloaderWPF"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
lex:LocalizeDictionary.DesignCulture=""
lex:ResxLocalizationProvider.DefaultAssembly="TwitchDownloaderWPF"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
Expand Down Expand Up @@ -76,6 +77,7 @@
<Button Content="{lex:Loc TaskCancel}" Margin="0,0,4,0" MinWidth="60" Height="28" FontSize="12" Click="BtnCancelTask_Click" IsEnabled="{Binding CanCancel}" Background="{DynamicResource ActionButtonBackground}" Foreground="{DynamicResource ActionButtonText}" BorderBrush="{DynamicResource ActionButtonBorder}" />
<Button Visibility="{Binding Exception.Visibility}" Content="{lex:Loc TaskErrorButton}" Margin="0,0,4,0" MinWidth="60" Height="28" FontSize="12" Click="BtnTaskError_Click" Background="{DynamicResource ActionButtonBackground}" Foreground="{DynamicResource ActionButtonText}" BorderBrush="{DynamicResource ActionButtonBorder}" />
<ProgressBar Height="16" Width="200" Minimum="0" Maximum="100" Value="{Binding Progress, Mode=OneWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Background="{DynamicResource AppElementInnerBackground}" Foreground="{DynamicResource ProgressBarForeground}" />
<Image MaxHeight="20" Margin="5,0" gif:ImageBehavior.AnimatedSource="{Binding StatusImage, Mode=OneWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</StackPanel>
<Button Grid.Column="2" Padding="7, 0" VerticalAlignment="Top" Height="24" FontSize="12" Content="X" Click="BtnRemoveTask_Click" Background="{DynamicResource AppElementBackground}" Foreground="{DynamicResource AppTextDisabled}" BorderBrush="{DynamicResource AppElementBorder}" />
Expand Down
1 change: 1 addition & 0 deletions TwitchDownloaderWPF/PageVodDownload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ private DirectoryInfo[] HandleCacheCleanerCallback(DirectoryInfo[] directories)
private void BtnCancel_Click(object sender, RoutedEventArgs e)
{
statusMessage.Text = Translations.Strings.StatusCanceling;
SetImage("Images/ppStretch.gif", true);
try
{
_cancellationTokenSource.Cancel();
Expand Down
1 change: 1 addition & 0 deletions TwitchDownloaderWPF/TwitchDownloaderWPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<ItemGroup>
<Resource Include="Images\ppOverheat.gif" />
<Resource Include="Images\ppHop.gif" />
<Resource Include="Images\ppStretch.gif" />
<Resource Include="Images\peepoSad.png" />
</ItemGroup>
<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions TwitchDownloaderWPF/TwitchTasks/ChatDownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public string DisplayStatus
private set => SetField(ref _displayStatus, value);
}

private string _statusImage;
public string StatusImage
{
get => _statusImage;
private set => SetField(ref _statusImage, value);
}

public ChatDownloadOptions DownloadOptions { get; init; }
public CancellationTokenSource TokenSource { get; set; } = new CancellationTokenSource();
public ITwitchTask DependantTask { get; set; }
Expand Down Expand Up @@ -90,6 +97,14 @@ public void ChangeStatus(TwitchTaskStatus newStatus)
{
CanCancel = false;
}

StatusImage = newStatus switch
{
TwitchTaskStatus.Running => "Images/ppOverheat.gif",
TwitchTaskStatus.Ready or TwitchTaskStatus.Waiting => "Images/ppHop.gif",
TwitchTaskStatus.Stopping => "Images/ppStretch.gif",
_ => null
};
}

public async Task RunAsync()
Expand Down
15 changes: 15 additions & 0 deletions TwitchDownloaderWPF/TwitchTasks/ChatRenderTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public string DisplayStatus
private set => SetField(ref _displayStatus, value);
}

private string _statusImage;
public string StatusImage
{
get => _statusImage;
private set => SetField(ref _statusImage, value);
}

public ChatRenderOptions DownloadOptions { get; init; }
public CancellationTokenSource TokenSource { get; set; } = new CancellationTokenSource();
public ITwitchTask DependantTask { get; set; }
Expand Down Expand Up @@ -109,6 +116,14 @@ public void ChangeStatus(TwitchTaskStatus newStatus)
{
CanCancel = false;
}

StatusImage = newStatus switch
{
TwitchTaskStatus.Running => "Images/ppOverheat.gif",
TwitchTaskStatus.Ready or TwitchTaskStatus.Waiting => "Images/ppHop.gif",
TwitchTaskStatus.Stopping => "Images/ppStretch.gif",
_ => null
};
}

public async Task RunAsync()
Expand Down
15 changes: 15 additions & 0 deletions TwitchDownloaderWPF/TwitchTasks/ChatUpdateTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public string DisplayStatus
private set => SetField(ref _displayStatus, value);
}

private string _statusImage;
public string StatusImage
{
get => _statusImage;
private set => SetField(ref _statusImage, value);
}

public ChatUpdateOptions UpdateOptions { get; init; }
public CancellationTokenSource TokenSource { get; set; } = new CancellationTokenSource();
public ITwitchTask DependantTask { get; set; }
Expand Down Expand Up @@ -90,6 +97,14 @@ public void ChangeStatus(TwitchTaskStatus newStatus)
{
CanCancel = false;
}

StatusImage = newStatus switch
{
TwitchTaskStatus.Running => "Images/ppOverheat.gif",
TwitchTaskStatus.Ready or TwitchTaskStatus.Waiting => "Images/ppHop.gif",
TwitchTaskStatus.Stopping => "Images/ppStretch.gif",
_ => null
};
}

public async Task RunAsync()
Expand Down
15 changes: 15 additions & 0 deletions TwitchDownloaderWPF/TwitchTasks/ClipDownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public string DisplayStatus
private set => SetField(ref _displayStatus, value);
}

private string _statusImage;
public string StatusImage
{
get => _statusImage;
private set => SetField(ref _statusImage, value);
}

public ClipDownloadOptions DownloadOptions { get; init; }
public CancellationTokenSource TokenSource { get; set; } = new CancellationTokenSource();
public ITwitchTask DependantTask { get; set; }
Expand Down Expand Up @@ -90,6 +97,14 @@ public void ChangeStatus(TwitchTaskStatus newStatus)
{
CanCancel = false;
}

StatusImage = newStatus switch
{
TwitchTaskStatus.Running => "Images/ppOverheat.gif",
TwitchTaskStatus.Ready or TwitchTaskStatus.Waiting => "Images/ppHop.gif",
TwitchTaskStatus.Stopping => "Images/ppStretch.gif",
_ => null
};
}

public async Task RunAsync()
Expand Down
1 change: 1 addition & 0 deletions TwitchDownloaderWPF/TwitchTasks/ITwitchTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public interface ITwitchTask : INotifyPropertyChanged
int Progress { get; }
TwitchTaskStatus Status { get; }
string DisplayStatus { get; }
string StatusImage { get; }
CancellationTokenSource TokenSource { get; set; }
ITwitchTask DependantTask { get; set; }
string TaskType { get; }
Expand Down
15 changes: 15 additions & 0 deletions TwitchDownloaderWPF/TwitchTasks/VodDownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public string DisplayStatus
private set => SetField(ref _displayStatus, value);
}

private string _statusImage;
public string StatusImage
{
get => _statusImage;
private set => SetField(ref _statusImage, value);
}

public VideoDownloadOptions DownloadOptions { get; init; }
public CancellationTokenSource TokenSource { get; set; } = new CancellationTokenSource();
public ITwitchTask DependantTask { get; set; }
Expand Down Expand Up @@ -90,6 +97,14 @@ public void ChangeStatus(TwitchTaskStatus newStatus)
{
CanCancel = false;
}

StatusImage = newStatus switch
{
TwitchTaskStatus.Running => "Images/ppOverheat.gif",
TwitchTaskStatus.Ready or TwitchTaskStatus.Waiting => "Images/ppHop.gif",
TwitchTaskStatus.Stopping => "Images/ppStretch.gif",
_ => null
};
}

public async Task RunAsync()
Expand Down
Loading