mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
@@ -132,6 +132,7 @@
|
||||
<PackageReference Include="Stylet" Version="1.3.6" />
|
||||
<PackageReference Include="System.Management" Version="8.0.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||
<PackageReference Include="WindowsAPICodePack" Version="8.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -18,6 +18,7 @@ using System.Windows.Media;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Main;
|
||||
using Microsoft.WindowsAPICodePack.Taskbar;
|
||||
using Stylet;
|
||||
|
||||
namespace MaaWpfGui.ViewModels.UI
|
||||
@@ -90,17 +91,28 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
set => SetAndNotify(ref _windowTitle, value);
|
||||
}
|
||||
|
||||
private double _progress;
|
||||
private (int Current, int Max)? _taskProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the progress.
|
||||
/// Gets or sets the TaskProgress.
|
||||
/// 0.0 to 1.0.
|
||||
/// 置 0 以隐藏进度条.
|
||||
/// </summary>
|
||||
public double Progress
|
||||
public (int Current, int Max)? TaskProgress
|
||||
{
|
||||
get => _progress;
|
||||
set => SetAndNotify(ref _progress, value);
|
||||
get => _taskProgress;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _taskProgress, value);
|
||||
if (value is null)
|
||||
{
|
||||
TaskbarManager.Instance.SetProgressValue(0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskbarManager.Instance.SetProgressValue(value.Value.Current, value.Value.Max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _windowTitleScrollable = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.WindowTitleScrollable, bool.FalseString));
|
||||
|
||||
@@ -1143,7 +1143,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
var rvm = (RootViewModel)this.Parent;
|
||||
if (MainTasksSelectedCount == 0)
|
||||
{
|
||||
rvm.Progress = 0;
|
||||
rvm.TaskProgress = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1151,12 +1151,11 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
if (MainTasksCompletedCount >= MainTasksSelectedCount)
|
||||
{
|
||||
rvm.Progress = 0;
|
||||
rvm.TaskProgress = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var progress = MainTasksCompletedCount / (double)MainTasksSelectedCount;
|
||||
rvm.Progress = progress;
|
||||
rvm.TaskProgress = (MainTasksCompletedCount, MainTasksSelectedCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,6 @@
|
||||
Foreground="{Binding WindowTopMostButtonForeground}" />
|
||||
</Grid>
|
||||
</hc:Window.NonClientAreaContent>
|
||||
<Window.TaskbarItemInfo>
|
||||
<TaskbarItemInfo ProgressState="Normal" ProgressValue="{Binding Progress}" />
|
||||
</Window.TaskbarItemInfo>
|
||||
<DockPanel>
|
||||
<local:NotifyIcon x:Name="NotifyIcon" Visibility="Hidden" />
|
||||
<TabControl
|
||||
|
||||
Reference in New Issue
Block a user