Skip to content

Commit a94cdaa

Browse files
committed
fix: 配置页面保存按钮圆角的设置
1 parent 79df349 commit a94cdaa

3 files changed

Lines changed: 27 additions & 7 deletions

File tree

OpenGptChat/OpenGptChat.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<PropertyGroup>
14-
<Version>1.1.6.3</Version>
14+
<Version>1.1.6.4</Version>
1515
<ImplicitUsings>disable</ImplicitUsings>
1616
<ApplicationManifest>app.manifest</ApplicationManifest>
1717
<StartupObject>OpenGptChat.EntryPoint</StartupObject>

OpenGptChat/Properties/PublishProfiles/win64-standalone.pubxml renamed to OpenGptChat/Properties/PublishProfiles/win32.pubxml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
66
<PropertyGroup>
77
<Configuration>Release</Configuration>
88
<Platform>Any CPU</Platform>
9-
<PublishDir>bin\Release\net6.0-windows\publish\win-x64\</PublishDir>
9+
<PublishDir>bin\Release\net6.0-windows\publish\win-x86\</PublishDir>
1010
<PublishProtocol>FileSystem</PublishProtocol>
1111
<_TargetId>Folder</_TargetId>
1212
<TargetFramework>net6.0-windows</TargetFramework>
13-
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
14-
<SelfContained>true</SelfContained>
13+
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
14+
<SelfContained>false</SelfContained>
1515
<PublishSingleFile>true</PublishSingleFile>
1616
<PublishReadyToRun>false</PublishReadyToRun>
1717
</PropertyGroup>

OpenGptChat/Utilities/UiUtils.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,24 @@ private static void CornerRadiusChanged(DependencyObject d, DependencyPropertyCh
3131
if (d is not FrameworkElement ele)
3232
return;
3333

34-
if (GetBorderFromControl(ele) is not Border border)
35-
return;
34+
void ApplyBorder(FrameworkElement ele)
35+
{
36+
if (GetBorderFromControl(ele) is not Border border)
37+
return;
3638

37-
border.CornerRadius = (CornerRadius)e.NewValue;
39+
border.CornerRadius = (CornerRadius)e.NewValue;
40+
}
41+
42+
void LoadedOnce(object? sender, RoutedEventArgs _e)
43+
{
44+
ApplyBorder(ele);
45+
ele.Loaded -= LoadedOnce;
46+
}
47+
48+
if (ele.IsLoaded)
49+
ApplyBorder(ele);
50+
else
51+
ele.Loaded += LoadedOnce;
3852
}
3953

4054
private static Border? GetBorderFromControl(FrameworkElement control)
@@ -46,8 +60,14 @@ private static void CornerRadiusChanged(DependencyObject d, DependencyPropertyCh
4660
for (int i = 0; i < childrenCount; i++)
4761
{
4862
DependencyObject child = VisualTreeHelper.GetChild(control, i);
63+
if (child is not FrameworkElement childElement)
64+
continue;
65+
4966
if (child is Border borderChild)
5067
return borderChild;
68+
69+
if (GetBorderFromControl(childElement) is Border childBorderChild)
70+
return childBorderChild;
5171
}
5272

5373
return null;

0 commit comments

Comments
 (0)