Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Taskbar - Count as Long + Count Icon On Windows #37

Merged
merged 18 commits into from
Sep 29, 2023
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
6 changes: 4 additions & 2 deletions Nickvision.Aura/Nickvision.Aura.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>Nickvision.Aura</PackageId>
<Version>2023.9.7</Version>
<Version>2023.10.0</Version>
<Company>Nickvision</Company>
<Authors>Nickvision</Authors>
<Description>A cross-platform base for Nickvision applications</Description>
Expand All @@ -14,7 +14,8 @@
<Copyright>(c) Nickvision 2021-2023</Copyright>
<PackageProjectUrl>https://nickvision.org</PackageProjectUrl>
<RepositoryUrl>https://github.com/NickvisionApps/Aura</RepositoryUrl>
<PackageReleaseNotes>- Taskbar bug fixes</PackageReleaseNotes>
<PackageReleaseNotes>- TaskbarItem's Count property is now long type instead of int to match specs
- TaskbarItem's Count property can now be used on Windows systems</PackageReleaseNotes>
<PackageIcon>logo-r.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
Expand All @@ -24,6 +25,7 @@
<PackageReference Include="Markdig" Version="0.33.0" />
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.4.2" />
<PackageReference Include="Octokit" Version="8.0.0" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="Tmds.DBus" Version="0.15.0" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.11" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.6" />
Expand Down
77 changes: 41 additions & 36 deletions Nickvision.Aura/Taskbar/LauncherEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ internal class LauncherEntry : ILauncherEntry
/// <summary>
/// A number to display on the launcher icon
/// </summary>
public int Count
public long Count
{
get
{
if (_properties.ContainsKey("count"))
{
return (int)_properties["count"];
}
return 0;
_properties.TryGetValue("count", out var count);
return (long?)count ?? 0;
}

set
{
_properties["count"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"count", _properties["count"]} }));
_properties.TryGetValue("count", out var current);
if ((long?)current != value)
{
_properties["count"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"count", _properties["count"]} }));
}
}
}

Expand All @@ -46,17 +47,18 @@ public bool CountVisible
{
get
{
if (_properties.ContainsKey("count-visible"))
{
return (bool)_properties["count-visible"];
}
return false;
_properties.TryGetValue("count-visible", out var countVisible);
return (bool?)countVisible ?? false;
}

set
{
_properties["count-visible"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"count-visible", _properties["count-visible"]} }));
_properties.TryGetValue("count-visible", out var current);
if ((bool?)current != value)
{
_properties["count-visible"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"count-visible", _properties["count-visible"]} }));
}
}
}

Expand All @@ -68,17 +70,18 @@ public double Progress
{
get
{
if (_properties.ContainsKey("progress"))
{
return (double)_properties["progress"];
}
return 0.0;
_properties.TryGetValue("progress", out var progress);
return (double?)progress ?? 0.0;
}

set
{
_properties["progress"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"progress", _properties["progress"]} }));
_properties.TryGetValue("progress", out var current);
if (current == null || Math.Abs((double)current - value) >= 0.01)
{
_properties["progress"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"progress", _properties["progress"]} }));
}
}
}

Expand All @@ -89,17 +92,18 @@ public bool ProgressVisible
{
get
{
if (_properties.ContainsKey("progress-visible"))
{
return (bool)_properties["progress-visible"];
}
return false;
_properties.TryGetValue("progress-visible", out var progressVisible);
return (bool?)progressVisible ?? false;
}

set
{
_properties["progress-visible"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"progress-visible", _properties["progress-visible"]} }));
_properties.TryGetValue("progress-visible", out var current);
if ((bool?) current != value)
{
_properties["progress-visible"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"progress-visible", _properties["progress-visible"]} }));
}
}
}

Expand All @@ -110,17 +114,18 @@ public bool Urgent
{
get
{
if (_properties.ContainsKey("urgent"))
{
return (bool)_properties["urgent"];
}
return false;
_properties.TryGetValue("urgemt", out var urgent);
return (bool?)urgent ?? false;
}

set
{
_properties["urgent"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"urgent", _properties["urgent"]} }));
_properties.TryGetValue("urgent", out var current);
if ((bool?)current != value)
{
_properties["urgent"] = value;
OnUpdate?.Invoke((_appUri, new Dictionary<string, object> { {"urgent", _properties["urgent"]} }));
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion Nickvision.Aura/Taskbar/ProgressFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ namespace Nickvision.Aura.Taskbar;
/// Flags that control the current state of the progress button.
/// Specify only one of the following flags; all states are mutually exclusive of all others.
/// </summary>
public enum ProgressFlags {
public enum ProgressFlags
{
NoProgress = 0,
Indeterminate = 0x1,
Normal = 0x2,
Expand Down
Loading