Skip to content
Open
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
10 changes: 10 additions & 0 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
#if DEBUG
using LeXtudio.DevFlow.Agent.Uno;
#endif

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
Expand All @@ -11,6 +14,9 @@ namespace WinIconFinder;
/// </summary>
public partial class App : Application
{
#if DEBUG
private UnoAgentService? _devFlowAgent;
#endif
/// <summary>
/// The main application window. Use <c>App.Window</c> from any class that needs
/// the window reference (for dialogs, pickers, interop, etc.).
Expand Down Expand Up @@ -46,6 +52,10 @@ public App()
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
#if DEBUG
_devFlowAgent = new UnoAgentService();
_devFlowAgent.Start();
#endif
Window = new MainWindow();
DispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
Window.Activate();
Expand Down
7 changes: 5 additions & 2 deletions MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,12 @@ private void MapCanvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
VerticalAlignment = Microsoft.Graphics.Canvas.Text.CanvasVerticalAlignment.Top
};

float lx = Math.Clamp(hx, 60, W - 60);
float textWidth = label.Length * labelFmt.FontSize * 0.62f;
float boxWidth = Math.Clamp(textWidth + 16f, 120f, Math.Max(120f, W - 16f));
float halfBox = boxWidth / 2f;
float lx = Math.Clamp(hx, halfBox + 4f, W - halfBox - 4f);
float ly = Math.Min(hy + halfCell + 3f, H - 18);
ds.FillRoundedRectangle(lx - 60, ly - 1, 120, 16, 3, 3,
ds.FillRoundedRectangle(lx - halfBox, ly - 1, boxWidth, 16, 3, 3,
Windows.UI.Color.FromArgb(160, 20, 20, 20));
ds.DrawText(label, lx, ly,
Windows.UI.Color.FromArgb(230, 240, 240, 240), labelFmt);
Expand Down
20 changes: 20 additions & 0 deletions Platforms/Desktop/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Threading.Tasks;
using Uno.UI.Hosting;

namespace WinIconFinder;

internal class Program
{
[STAThread]
public static async Task Main(string[] args)
{
var host = UnoPlatformHostBuilder.Create()
.App(() => new App())
.UseWin32()
.UseX11()
.UseMacOS()
.Build();

await host.RunAsync();
}
}
32 changes: 24 additions & 8 deletions WinIconFinder.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Uno.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
<TargetFrameworks>net10.0-desktop;net10.0-windows10.0.19041.0</TargetFrameworks>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>WinIconFinder</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</RuntimeIdentifier>
<PublishProfile Condition="Exists('Properties\PublishProfiles\win-$(Platform).pubxml')">win-$(Platform).pubxml</PublishProfile>
<UnoSingleProject>true</UnoSingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UnoFeatures>SkiaRenderer;</UnoFeatures>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0-windows10.0.19041.0'">
<UseWinUI>true</UseWinUI>
<WinUISDKReferences>false</WinUISDKReferences>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<EnableMsixTooling>true</EnableMsixTooling>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);WINDOWS_APP_SDK</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Remove="obj\**" />
Expand Down Expand Up @@ -60,17 +69,24 @@
Set <EnableWinAppRunSupport>false</EnableWinAppRunSupport> in a
<PropertyGroup> above to opt out.
-->
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0-windows10.0.19041.0'">
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.4.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.1839" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.1.3" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools.WinApp" Version="0.3.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0-desktop'">
<PackageReference Include="LeXtudio.Win2D.UnoCompat" Version="0.1.0" />
</ItemGroup>

<ItemGroup Condition="''$(Configuration)' == 'Debug'">
<PackageReference Include="LeXtudio.DevFlow.Agent.Uno" Version="0.1.10" />
</ItemGroup>

<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"msbuild-sdks": {
"Uno.Sdk": "6.5.31"
}
}