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
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. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using ManagedCommon; using ManagedCommon;
using Microsoft.VisualBasic.Devices;
using Windows.ApplicationModel;
using Windows.Management.Deployment; using Windows.Management.Deployment;
namespace WorkspacesLauncherUI.Models namespace WorkspacesLauncherUI.Models
@@ -74,13 +69,23 @@ namespace WorkspacesLauncherUI.Models
public string LaunchState { get; set; } public string LaunchState { get; set; }
public string StateImageSource public string StateGlyph
{ {
get => LaunchState switch get => LaunchState switch
{ {
"launched" => "../images/checkmark.png", "launched" => "\U0000E73E",
"failed" => "../images/failed.png", "failed" => "\U0000E711",
_ => "../images/failed.png", _ => "\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" VerticalAlignment="Center"
IsActive="True" IsActive="True"
Visibility="{Binding Loading, Mode=OneWay, Converter={StaticResource BoolToVis}, UpdateSourceTrigger=PropertyChanged}" /> Visibility="{Binding Loading, Mode=OneWay, Converter={StaticResource BoolToVis}, UpdateSourceTrigger=PropertyChanged}" />
<Image <TextBlock
Grid.Column="2" Grid.Column="2"
Width="20" Width="20"
Height="20" Height="20"
Margin="10" Margin="10"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="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}" /> Visibility="{Binding Loading, Mode=OneWay, Converter={StaticResource BooleanToInvertedVisibilityConverter}, UpdateSourceTrigger=PropertyChanged}" />
</Grid> </Grid>
</DataTemplate> </DataTemplate>

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB