mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
impl #929
This commit is contained in:
@@ -11,8 +11,8 @@ public sealed partial class FrameworkElementHelper
|
|||||||
{
|
{
|
||||||
private static void OnSquareLengthChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
|
private static void OnSquareLengthChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
Microsoft.UI.Xaml.Controls.Control control = (Microsoft.UI.Xaml.Controls.Control)dp;
|
FrameworkElement element = (FrameworkElement)dp;
|
||||||
control.Width = (double)e.NewValue;
|
element.Width = (double)e.NewValue;
|
||||||
control.Height = (double)e.NewValue;
|
element.Height = (double)e.NewValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
12
src/Snap.Hutao/Snap.Hutao/Control/Helper/InfoBarHelper.cs
Normal file
12
src/Snap.Hutao/Snap.Hutao/Control/Helper/InfoBarHelper.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Control.Helper;
|
||||||
|
|
||||||
|
[DependencyProperty("IsTextSelectionEnabled", typeof(bool), false, IsAttached = true, AttachedType = typeof(InfoBar))]
|
||||||
|
public sealed partial class InfoBarHelper
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:shch="using:Snap.Hutao.Control.Helper">
|
||||||
<FontFamily x:Key="MiSans">ms-appx:///Resource/Font/MiSans-Regular.ttf#MiSans</FontFamily>
|
<FontFamily x:Key="MiSans">ms-appx:///Resource/Font/MiSans-Regular.ttf#MiSans</FontFamily>
|
||||||
<FontFamily x:Key="CascadiaMonoAndMiSans">ms-appx:///Resource/Font/CascadiaMono.ttf#Cascadia Mono, ms-appx:///Resource/Font/MiSans-Regular.ttf#MiSans</FontFamily>
|
<FontFamily x:Key="CascadiaMonoAndMiSans">ms-appx:///Resource/Font/CascadiaMono.ttf#Cascadia Mono, ms-appx:///Resource/Font/MiSans-Regular.ttf#MiSans</FontFamily>
|
||||||
|
|
||||||
@@ -99,6 +102,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
<!-- TODO: When will DefaultInfoBarStyle added -->
|
<!-- TODO: When will DefaultInfoBarStyle added -->
|
||||||
<Style TargetType="InfoBar">
|
<Style TargetType="InfoBar">
|
||||||
|
<Setter Property="shch:InfoBarHelper.IsTextSelectionEnabled" Value="False"/>
|
||||||
<Setter Property="FontFamily" Value="{StaticResource MiSans}"/>
|
<Setter Property="FontFamily" Value="{StaticResource MiSans}"/>
|
||||||
<Setter Property="IsTabStop" Value="False"/>
|
<Setter Property="IsTabStop" Value="False"/>
|
||||||
<Setter Property="CloseButtonStyle" Value="{StaticResource InfoBarCloseButtonStyle}"/>
|
<Setter Property="CloseButtonStyle" Value="{StaticResource InfoBarCloseButtonStyle}"/>
|
||||||
@@ -181,6 +185,7 @@
|
|||||||
Foreground="{ThemeResource InfoBarTitleForeground}"
|
Foreground="{ThemeResource InfoBarTitleForeground}"
|
||||||
InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarTitleHorizontalOrientationMargin}"
|
InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarTitleHorizontalOrientationMargin}"
|
||||||
InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarTitleVerticalOrientationMargin}"
|
InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarTitleVerticalOrientationMargin}"
|
||||||
|
IsTextSelectionEnabled="{TemplateBinding shch:InfoBarHelper.IsTextSelectionEnabled}"
|
||||||
Text="{TemplateBinding Title}"
|
Text="{TemplateBinding Title}"
|
||||||
TextWrapping="WrapWholeWords"/>
|
TextWrapping="WrapWholeWords"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
@@ -190,6 +195,7 @@
|
|||||||
Foreground="{ThemeResource InfoBarMessageForeground}"
|
Foreground="{ThemeResource InfoBarMessageForeground}"
|
||||||
InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarMessageHorizontalOrientationMargin}"
|
InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarMessageHorizontalOrientationMargin}"
|
||||||
InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarMessageVerticalOrientationMargin}"
|
InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarMessageVerticalOrientationMargin}"
|
||||||
|
IsTextSelectionEnabled="{TemplateBinding shch:InfoBarHelper.IsTextSelectionEnabled}"
|
||||||
Text="{TemplateBinding Message}"
|
Text="{TemplateBinding Message}"
|
||||||
TextWrapping="WrapWholeWords"/>
|
TextWrapping="WrapWholeWords"/>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Snap.Hutao.Model.Metadata;
|
|||||||
|
|
||||||
internal static class MonsterRelationship
|
internal static class MonsterRelationship
|
||||||
{
|
{
|
||||||
public static MonsterRelationshipId Normalize(MonsterRelationshipId id)
|
public static MonsterRelationshipId Normalize(in MonsterRelationshipId id)
|
||||||
{
|
{
|
||||||
return (uint)id switch
|
return (uint)id switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
<None Remove="View\Control\SkillPivot.xaml" />
|
<None Remove="View\Control\SkillPivot.xaml" />
|
||||||
<None Remove="View\Control\StatisticsCard.xaml" />
|
<None Remove="View\Control\StatisticsCard.xaml" />
|
||||||
<None Remove="View\Control\StatisticsSegmented.xaml" />
|
<None Remove="View\Control\StatisticsSegmented.xaml" />
|
||||||
<None Remove="View\Control\Webview2Viewer.xaml" />
|
<None Remove="View\Control\WebViewer.xaml" />
|
||||||
<None Remove="View\Dialog\AchievementArchiveCreateDialog.xaml" />
|
<None Remove="View\Dialog\AchievementArchiveCreateDialog.xaml" />
|
||||||
<None Remove="View\Dialog\AchievementImportDialog.xaml" />
|
<None Remove="View\Dialog\AchievementImportDialog.xaml" />
|
||||||
<None Remove="View\Dialog\CultivateProjectDialog.xaml" />
|
<None Remove="View\Dialog\CultivateProjectDialog.xaml" />
|
||||||
@@ -328,7 +328,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Update="View\Control\Webview2Viewer.xaml">
|
<Page Update="View\Control\WebViewer.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Snap.Hutao.ViewModel.User;
|
|||||||
|
|
||||||
namespace Snap.Hutao.View.Control;
|
namespace Snap.Hutao.View.Control;
|
||||||
|
|
||||||
internal interface IWebview2ViewerSource
|
internal interface IWebViewerSource
|
||||||
{
|
{
|
||||||
string GetSource(UserAndUid userAndUid);
|
string GetSource(UserAndUid userAndUid);
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ using Snap.Hutao.ViewModel.User;
|
|||||||
namespace Snap.Hutao.View.Control;
|
namespace Snap.Hutao.View.Control;
|
||||||
|
|
||||||
[DependencyProperty("Source", typeof(string))]
|
[DependencyProperty("Source", typeof(string))]
|
||||||
internal sealed partial class StaticWebview2ViewerSource : DependencyObject, IWebview2ViewerSource
|
internal sealed partial class StaticWebview2ViewerSource : DependencyObject, IWebViewerSource
|
||||||
{
|
{
|
||||||
public string GetSource(UserAndUid userAndUid)
|
public string GetSource(UserAndUid userAndUid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Snap.Hutao.View.Control.Webview2Viewer"
|
x:Class="Snap.Hutao.View.Control.WebViewer"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="using:Snap.Hutao.View.Control"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Transitions>
|
<UserControl.Transitions>
|
||||||
@@ -13,8 +13,8 @@ using Snap.Hutao.Web.Bridge;
|
|||||||
|
|
||||||
namespace Snap.Hutao.View.Control;
|
namespace Snap.Hutao.View.Control;
|
||||||
|
|
||||||
[DependencyProperty("SourceProvider", typeof(IWebview2ViewerSource))]
|
[DependencyProperty("SourceProvider", typeof(IWebViewerSource))]
|
||||||
internal partial class Webview2Viewer : UserControl, IRecipient<UserChangedMessage>
|
internal partial class WebViewer : UserControl, IRecipient<UserChangedMessage>
|
||||||
{
|
{
|
||||||
private readonly IServiceProvider serviceProvider;
|
private readonly IServiceProvider serviceProvider;
|
||||||
private readonly RoutedEventHandler loadEventHandler;
|
private readonly RoutedEventHandler loadEventHandler;
|
||||||
@@ -23,7 +23,7 @@ internal partial class Webview2Viewer : UserControl, IRecipient<UserChangedMessa
|
|||||||
private MiHoYoJSInterface? jsInterface;
|
private MiHoYoJSInterface? jsInterface;
|
||||||
private bool isFirstNavigate = true;
|
private bool isFirstNavigate = true;
|
||||||
|
|
||||||
public Webview2Viewer()
|
public WebViewer()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
serviceProvider = Ioc.Default;
|
serviceProvider = Ioc.Default;
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
xmlns:shc="using:Snap.Hutao.Control"
|
xmlns:shc="using:Snap.Hutao.Control"
|
||||||
xmlns:shca="using:Snap.Hutao.Control.Animation"
|
xmlns:shca="using:Snap.Hutao.Control.Animation"
|
||||||
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
||||||
|
xmlns:shch="using:Snap.Hutao.Control.Helper"
|
||||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||||
xmlns:shvco="using:Snap.Hutao.View.Control"
|
xmlns:shvco="using:Snap.Hutao.View.Control"
|
||||||
@@ -167,13 +168,15 @@
|
|||||||
<TextBlock Margin="16,0" Text="{Binding UserOptions.UserName}"/>
|
<TextBlock Margin="16,0" Text="{Binding UserOptions.UserName}"/>
|
||||||
|
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
Margin="16,16,12,0"
|
Margin="16,8,12,0"
|
||||||
ItemsSource="{Binding HutaoAnnouncements}"
|
ItemsSource="{Binding HutaoAnnouncements}"
|
||||||
Visibility="{Binding HutaoAnnouncements.Count, Converter={StaticResource Int32ToVisibilityConverter}}">
|
Visibility="{Binding HutaoAnnouncements.Count, Converter={StaticResource Int32ToVisibilityConverter}}">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<InfoBar
|
<InfoBar
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
|
Margin="0,8,0,0"
|
||||||
|
shch:InfoBarHelper.IsTextSelectionEnabled="True"
|
||||||
CloseButtonCommand="{Binding DismissCommand}"
|
CloseButtonCommand="{Binding DismissCommand}"
|
||||||
CloseButtonCommandParameter="{Binding}"
|
CloseButtonCommandParameter="{Binding}"
|
||||||
IsOpen="True"
|
IsOpen="True"
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
|
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</Flyout.FlyoutPresenterStyle>
|
</Flyout.FlyoutPresenterStyle>
|
||||||
<shvc:Webview2Viewer SourceProvider="{Binding VerifyUrlSource, Mode=OneWay}"/>
|
<shvc:WebViewer SourceProvider="{Binding VerifyUrlSource, Mode=OneWay}"/>
|
||||||
</Flyout>
|
</Flyout>
|
||||||
</FlyoutBase.AttachedFlyout>
|
</FlyoutBase.AttachedFlyout>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -32,11 +32,11 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Flyout.FlyoutPresenterStyle>
|
</Flyout.FlyoutPresenterStyle>
|
||||||
<Grid>
|
<Grid>
|
||||||
<shvc:Webview2Viewer>
|
<shvc:WebViewer>
|
||||||
<shvc:Webview2Viewer.SourceProvider>
|
<shvc:WebViewer.SourceProvider>
|
||||||
<shvc:StaticWebview2ViewerSource Source="http://webstatic.mihoyo.com/ys/event/e20200923adopt_calculator/index.html?bbs_presentation_style=fullscreen&bbs_auth_required=true&utm_source=bbs&utm_medium=mys&utm_campaign=GameRecord"/>
|
<shvc:StaticWebview2ViewerSource Source="http://webstatic.mihoyo.com/ys/event/e20200923adopt_calculator/index.html?bbs_presentation_style=fullscreen&bbs_auth_required=true&utm_source=bbs&utm_medium=mys&utm_campaign=GameRecord"/>
|
||||||
</shvc:Webview2Viewer.SourceProvider>
|
</shvc:WebViewer.SourceProvider>
|
||||||
</shvc:Webview2Viewer>
|
</shvc:WebViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Flyout>
|
</Flyout>
|
||||||
</FlyoutBase.AttachedFlyout>
|
</FlyoutBase.AttachedFlyout>
|
||||||
@@ -57,11 +57,11 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Flyout.FlyoutPresenterStyle>
|
</Flyout.FlyoutPresenterStyle>
|
||||||
<Grid>
|
<Grid>
|
||||||
<shvc:Webview2Viewer>
|
<shvc:WebViewer>
|
||||||
<shvc:Webview2Viewer.SourceProvider>
|
<shvc:WebViewer.SourceProvider>
|
||||||
<shvc:StaticWebview2ViewerSource Source="https://webstatic.mihoyo.com/app/community-game-records/index.html"/>
|
<shvc:StaticWebview2ViewerSource Source="https://webstatic.mihoyo.com/app/community-game-records/index.html"/>
|
||||||
</shvc:Webview2Viewer.SourceProvider>
|
</shvc:WebViewer.SourceProvider>
|
||||||
</shvc:Webview2Viewer>
|
</shvc:WebViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Flyout>
|
</Flyout>
|
||||||
</FlyoutBase.AttachedFlyout>
|
</FlyoutBase.AttachedFlyout>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ internal sealed partial class DailyNoteViewModel : Abstraction.ViewModel
|
|||||||
|
|
||||||
public RuntimeOptions RuntimeOptions { get => runtimeOptions; }
|
public RuntimeOptions RuntimeOptions { get => runtimeOptions; }
|
||||||
|
|
||||||
public IWebview2ViewerSource VerifyUrlSource { get => new DailyNoteWebview2ViewerSource(); }
|
public IWebViewerSource VerifyUrlSource { get => new DailyNoteWebViewerSource(); }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户与角色集合
|
/// 用户与角色集合
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using Snap.Hutao.Web.Request.QueryString;
|
|||||||
|
|
||||||
namespace Snap.Hutao.ViewModel.DailyNote;
|
namespace Snap.Hutao.ViewModel.DailyNote;
|
||||||
|
|
||||||
internal sealed class DailyNoteWebview2ViewerSource : IWebview2ViewerSource
|
internal sealed class DailyNoteWebViewerSource : IWebViewerSource
|
||||||
{
|
{
|
||||||
public string GetSource(UserAndUid userAndUid)
|
public string GetSource(UserAndUid userAndUid)
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user