This commit is contained in:
DismissedLight
2023-10-02 15:42:56 +08:00
parent e513b8b00b
commit 38bed7318f
3 changed files with 57 additions and 31 deletions

View File

@@ -3,6 +3,7 @@
using Microsoft.UI.Xaml;
using Snap.Hutao.Core.Windowing;
using System.Runtime.CompilerServices;
using Windows.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
@@ -22,6 +23,7 @@ internal sealed partial class MainWindow : Window, IWindowOptionsSource
private readonly WindowOptions windowOptions;
private readonly ILogger<MainWindow> logger;
private readonly TypedEventHandler<object, WindowEventArgs> closedEventHander;
private readonly TypedEventHandler<object, WindowSizeChangedEventArgs> sizeChangedEventHandler;
/// <summary>
/// 构造一个新的主窗体
@@ -35,7 +37,10 @@ internal sealed partial class MainWindow : Window, IWindowOptionsSource
logger = serviceProvider.GetRequiredService<ILogger<MainWindow>>();
closedEventHander = OnClosed;
sizeChangedEventHandler = OnSizeChanged;
Closed += closedEventHander;
SizeChanged += sizeChangedEventHandler;
}
/// <inheritdoc/>
@@ -52,4 +57,8 @@ internal sealed partial class MainWindow : Window, IWindowOptionsSource
{
logger.LogInformation("MainWindow Closed");
}
private void OnSizeChanged(object sender, WindowSizeChangedEventArgs args)
{
}
}

View File

@@ -49,7 +49,10 @@
</mxic:EventTriggerBehavior>
</mxi:Interaction.Behaviors>
<FlyoutBase.AttachedFlyout>
<Flyout LightDismissOverlayMode="On" Placement="Full">
<Flyout
LightDismissOverlayMode="On"
Placement="Full"
ShouldConstrainToRootBounds="False">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="Padding" Value="0"/>

View File

@@ -2,6 +2,7 @@
x:Class="Snap.Hutao.View.UserView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cwb="using:CommunityToolkit.WinUI.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
@@ -187,36 +188,6 @@
Icon="{shcm:FontIcon Glyph=&#xF133;}"
Label="{shcm:ResourceString Name=ViewUserCookieOperationSignInRewardAction}"
Style="{StaticResource DefaultAppBarButtonStyle}"/>
<AppBarButton
Width="{StaticResource LargeAppBarButtonWidth}"
MaxWidth="{StaticResource LargeAppBarButtonWidth}"
Margin="2,-4"
Icon="{shcm:FontIcon Glyph=&#xEC26;}"
Label="{shcm:ResourceString Name=ViewUserCookieOperationGameRecordIndexAction}"
Style="{StaticResource DefaultAppBarButtonStyle}">
<mxi:Interaction.Behaviors>
<mxic:EventTriggerBehavior EventName="Click">
<shcb:OpenAttachedFlyoutAction/>
</mxic:EventTriggerBehavior>
</mxi:Interaction.Behaviors>
<FlyoutBase.AttachedFlyout>
<Flyout LightDismissOverlayMode="On" Placement="Full">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
</Style>
</Flyout.FlyoutPresenterStyle>
<Grid>
<shvc:WebViewer>
<shvc:WebViewer.SourceProvider>
<shvc:StaticWebview2ViewerSource Source="https://webstatic.mihoyo.com/app/community-game-records/index.html"/>
</shvc:WebViewer.SourceProvider>
</shvc:WebViewer>
</Grid>
</Flyout>
</FlyoutBase.AttachedFlyout>
</AppBarButton>
<AppBarButton
Width="{StaticResource LargeAppBarButtonWidth}"
MaxWidth="{StaticResource LargeAppBarButtonWidth}"
@@ -228,6 +199,49 @@
<Grid Grid.Column="1" Width="280">
<StackPanel Visibility="{Binding Users.Count, Converter={StaticResource Int32ToVisibilityConverter}}">
<Button
Margin="8"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch">
<mxi:Interaction.Behaviors>
<mxic:EventTriggerBehavior EventName="Click">
<shcb:OpenAttachedFlyoutAction/>
</mxic:EventTriggerBehavior>
</mxi:Interaction.Behaviors>
<Button.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<FontIcon
Grid.Column="0"
Margin="0,0,12,0"
Glyph="&#xEC26;"/>
<TextBlock Grid.Column="1" Text="{shcm:ResourceString Name=ViewUserCookieOperationGameRecordIndexAction}"/>
</Grid>
</Button.Content>
<FlyoutBase.AttachedFlyout>
<Flyout
LightDismissOverlayMode="On"
Placement="Full"
ShouldConstrainToRootBounds="False">
<Flyout.FlyoutPresenterStyle>
<Style BasedOn="{StaticResource DefaultFlyoutPresenterStyle}" TargetType="FlyoutPresenter">
<Setter Property="Padding" Value="0"/>
<Setter Property="CornerRadius" Value="0"/>
</Style>
</Flyout.FlyoutPresenterStyle>
<Grid>
<shvc:WebViewer>
<shvc:WebViewer.SourceProvider>
<shvc:StaticWebview2ViewerSource Source="https://webstatic.mihoyo.com/app/community-game-records/index.html"/>
</shvc:WebViewer.SourceProvider>
</shvc:WebViewer>
</Grid>
</Flyout>
</FlyoutBase.AttachedFlyout>
</Button>
<TextBlock
Margin="10,6,0,6"
Style="{StaticResource BaseTextBlockStyle}"