Workspaces using glyphs (#34449)

* Replacing images by glyphs.

* Removing not needed image files

* xaml formatting

* changing colors

---------

Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
This commit is contained in:
Laszlo Nemeth 2024-08-28 10:32:06 +02:00 committed by GitHub
parent 4413089af4
commit e882487d32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 23 deletions

View File

@ -3,22 +3,17 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using ManagedCommon;
using Microsoft.VisualBasic.Devices;
using Windows.ApplicationModel;
using Windows.Management.Deployment;
namespace WorkspacesLauncherUI.Models
@ -74,13 +69,23 @@ namespace WorkspacesLauncherUI.Models
public string LaunchState { get; set; }
public string StateImageSource
public string StateGlyph
{
get => LaunchState switch
{
"launched" => "../images/checkmark.png",
"failed" => "../images/failed.png",
_ => "../images/failed.png",
"launched" => "\U0000E73E",
"failed" => "\U0000E711",
_ => "\U0000E711",
};
}
public System.Windows.Media.Brush StateColor
{
get => LaunchState switch
{
"launched" => new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 0, 128, 0)),
"failed" => new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 254, 0, 0)),
_ => new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 254, 0, 0)),
};
}

View File

@ -71,14 +71,17 @@
VerticalAlignment="Center"
IsActive="True"
Visibility="{Binding Loading, Mode=OneWay, Converter={StaticResource BoolToVis}, UpdateSourceTrigger=PropertyChanged}" />
<Image
<TextBlock
Grid.Column="2"
Width="20"
Height="20"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="{Binding StateImageSource}"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="20"
Foreground="{Binding StateColor}"
Text="{Binding StateGlyph}"
Visibility="{Binding Loading, Mode=OneWay, Converter={StaticResource BooleanToInvertedVisibilityConverter}, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</DataTemplate>

View File

@ -30,9 +30,7 @@
<AssemblyName>PowerToys.WorkspacesLauncherUI</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Remove="images\checkmark.png" />
<None Remove="images\DefaultIcon.ico" />
<None Remove="images\failed.png" />
<None Remove="images\Workspaces.ico" />
</ItemGroup>
<ItemGroup>
@ -86,15 +84,6 @@
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
<ProjectReference Include="..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="images\checkmark.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="images\failed.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB