Skip to content

The progress bar indication to an app icon on the task bar. #1104

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

Merged
merged 1 commit into from
Nov 11, 2022
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
3 changes: 3 additions & 0 deletions UndertaleModTool/Windows/LoaderDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
xmlns:local="clr-namespace:UndertaleModTool"
mc:Ignorable="d"
Title="{Binding MessageTitle}" Height="150" Width="400" WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize">
<Window.TaskbarItemInfo>
<TaskbarItemInfo ProgressState="Indeterminate"/>
</Window.TaskbarItemInfo>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
Expand Down
8 changes: 8 additions & 0 deletions UndertaleModTool/Windows/LoaderDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Windows.Shell;

namespace UndertaleModTool
{
Expand All @@ -42,7 +43,12 @@ public double? Maximum
{
ProgressBar.IsIndeterminate = !value.HasValue;
if (value.HasValue)
{
ProgressBar.Maximum = value.Value;
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;
}
else
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate;
}
}
public bool IsClosed { get; set; } = false;
Expand Down Expand Up @@ -152,6 +158,8 @@ public void UpdateValue(double value)
DoubleAnimation animation = new(value, TimeSpan.FromMilliseconds(100)); //time is the same as in "ProgressUpdater()"
ProgressBar.BeginAnimation(ProgressBar.ValueProperty, animation); //smooth progress change
}

TaskbarItemInfo.ProgressValue = value / ProgressBar.Maximum;
}

public void ReportProgress(string status, double value)
Expand Down