简化重构 (#491)

* 简化代码

* 替换Tapped为Click

* 修复搜索页跳转错误类型

* 文本框格式

* 优化TagsPage

* 更新MarkupExtension

* 使用TitleBar
This commit is contained in:
Poker 2024-06-05 11:55:21 +08:00 committed by GitHub
parent 854fa30ab2
commit 210670f1a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
94 changed files with 852 additions and 1098 deletions

View File

@ -32,7 +32,7 @@
Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Center"
FontSize="16"
FontSize="{StaticResource SmallIconFontSize}"
Foreground="{StaticResource TextSecondaryAccentColor}"
Symbol="{x:Bind Symbol, Mode=OneWay}" />
<TextBlock

View File

@ -128,7 +128,7 @@ public partial class CardControl : ButtonBase
PointerCaptureLost += Control_PointerCaptureLost;
PointerCanceled += Control_PointerCanceled;
PreviewKeyDown += Control_PreviewKeyDown;
Tapped += Control_Tapped;
Click += Control_Clicked;
}
private void DisableButtonInteraction()
@ -140,10 +140,10 @@ public partial class CardControl : ButtonBase
PointerCanceled -= Control_PointerCanceled;
PreviewKeyDown -= Control_PreviewKeyDown;
PreviewKeyUp -= Control_PreviewKeyUp;
Tapped -= Control_Tapped;
Click -= Control_Clicked;
}
private void Control_Tapped(object sender, TappedRoutedEventArgs e)
private void Control_Clicked(object sender, RoutedEventArgs e)
{
if (IsSelectEnabled && IsEnabled)
{

View File

@ -15,7 +15,7 @@
<fluent:SymbolIcon
Grid.Column="0"
VerticalAlignment="Center"
FontSize="16"
FontSize="{StaticResource SmallIconFontSize}"
Symbol="{x:Bind Symbol, Mode=OneWay}" />
<TextBlock
Grid.Column="1"

View File

@ -1,81 +0,0 @@
#region Copyright
// GPL v3 License
//
// Pixeval/Pixeval.Controls
// Copyright (c) 2024 Pixeval.Controls/SymbolIconBaseExtension.cs
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#endregion
using Windows.UI.Text;
using FluentIcons.Common;
using Microsoft.UI.Text;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Media;
using WinUI3Utilities.Controls;
namespace FluentIcons.WinUI;
/// <summary>
/// An abstract <see cref="MarkupExtension"/> which to produce text-based icons.
/// </summary>
public abstract class SymbolIconBaseExtension : MarkupExtension
{
/// <summary>
/// Gets or sets if the icon is filled.
/// </summary>
public bool IsFilled { get; set; }
/// <summary>
/// Gets or sets the size of the icon to display.
/// </summary>
public double FontSize { get; set; }
/// <summary>
/// Gets or sets the symbol of the icon to display.
/// </summary>
public Symbol Symbol { get; set; }
/// <summary>
/// Gets or sets the size of the icon to display. Priority is higher than <see cref="FontSize"/>.
/// </summary>
public FontSizeType Size { get; set; }
/// <summary>
/// Gets or sets the thickness of the icon glyph.
/// </summary>
public FontWeight FontWeight { get; set; } = FontWeights.Normal;
/// <summary>
/// Gets or sets the font style for the icon glyph.
/// </summary>
public FontStyle FontStyle { get; set; } = FontStyle.Normal;
/// <summary>
/// Gets or sets the foreground <see cref="Brush"/> for the icon.
/// </summary>
public Brush? Foreground { get; set; }
/// <summary>
/// Gets or sets a value indicating whether automatic text enlargement, to reflect the system text size setting, is enabled.
/// </summary>
public bool IsTextScaleFactorEnabled { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the icon is mirrored when the flow direction is right to left.
/// </summary>
public bool MirroredWhenRightToLeft { get; set; }
}

View File

@ -1,62 +0,0 @@
#region Copyright
// GPL v3 License
//
// Pixeval/Pixeval.Controls
// Copyright (c) 2024 Pixeval.Controls/SymbolIconExtension.cs
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#endregion
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Markup;
using WinUI3Utilities.Controls;
namespace FluentIcons.WinUI;
/// <summary>
/// Symbol icon markup extension
/// </summary>
[MarkupExtensionReturnType(ReturnType = typeof(SymbolIcon))]
public class SymbolIconExtension : SymbolIconBaseExtension
{
/// <inheritdoc cref="FrameworkElement.FlowDirection"/>
public FlowDirection FlowDirection { get; set; }
/// <inheritdoc />
protected override object ProvideValue()
{
var icon = new SymbolIcon
{
IsFilled = IsFilled,
Symbol = Symbol,
FontWeight = FontWeight,
FontStyle = FontStyle,
IsTextScaleFactorEnabled = IsTextScaleFactorEnabled,
MirroredWhenRightToLeft = MirroredWhenRightToLeft,
FlowDirection = FlowDirection
};
if (Size is not FontSizeType.None)
icon.FontSize = (int)Size;
else if (FontSize > 0)
icon.FontSize = FontSize;
if (Foreground is not null)
icon.Foreground = Foreground;
return icon;
}
}

View File

@ -1,57 +0,0 @@
#region Copyright
// GPL v3 License
//
// Pixeval/Pixeval.Controls
// Copyright (c) 2024 Pixeval.Controls/SymbolIconSourceExtension.cs
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#endregion
using Microsoft.UI.Xaml.Markup;
using WinUI3Utilities.Controls;
namespace FluentIcons.WinUI;
/// <summary>
/// Symbol icon source markup extension
/// </summary>
[MarkupExtensionReturnType(ReturnType = typeof(SymbolIconSource))]
public class SymbolIconSourceExtension : SymbolIconBaseExtension
{
/// <inheritdoc />
protected override object ProvideValue()
{
var icon = new SymbolIconSource
{
IsFilled = IsFilled,
Symbol = Symbol,
FontWeight = FontWeight,
FontStyle = FontStyle,
IsTextScaleFactorEnabled = IsTextScaleFactorEnabled,
MirroredWhenRightToLeft = MirroredWhenRightToLeft
};
if (Size is not FontSizeType.None)
icon.FontSize = (int)Size;
else if (FontSize > 0)
icon.FontSize = FontSize;
if (Foreground is not null)
icon.Foreground = Foreground;
return icon;
}
}

View File

@ -10,7 +10,7 @@
Padding="{StaticResource CardControlPadding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Tapped="ContentContainerOnTapped">
Click="ContentContainerOnClicked">
<Grid RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="2.3*" />
@ -26,7 +26,7 @@
<StackPanel Grid.Row="1" HorizontalAlignment="Center">
<TextBlock
HorizontalAlignment="Center"
FontSize="{StaticResource PixevalContentFontSize}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind PersonNickname, Mode=OneWay}" />
<TextBlock
HorizontalAlignment="Center"

View File

@ -22,6 +22,7 @@ using System;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Windows.System;
using Microsoft.UI.Xaml;
using WinUI3Utilities.Attributes;
namespace Pixeval.Controls;
@ -37,5 +38,5 @@ public partial class PersonView
{
public PersonView() => InitializeComponent();
private async void ContentContainerOnTapped(object sender, TappedRoutedEventArgs e) => await Launcher.LaunchUriAsync(PersonProfileNavigateUri);
private async void ContentContainerOnClicked(object sender, RoutedEventArgs e) => await Launcher.LaunchUriAsync(PersonProfileNavigateUri);
}

View File

@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Labs.WinUI.Shimmer" Version="0.1.240517-build.1678" />
<PackageReference Include="FluentIcons.WinUI" Version="1.1.240" />
<PackageReference Include="FluentIcons.WinUI" Version="1.1.242" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.2.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
<PrivateAssets>all</PrivateAssets>

View File

@ -25,10 +25,8 @@
<!-- ReSharper disable once UnusedMember.Local -->
<TextBlock
x:Name="BadgeTextBlock"
Margin="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="7"
Text="{x:Bind Text, Mode=OneWay}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">

View File

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Pixeval.Controls">
<x:Double x:Key="SmallIconFontSize">16</x:Double>
<Thickness x:Key="CardControlPadding">16</Thickness>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">

View File

@ -1,31 +0,0 @@
<Grid
x:Class="Pixeval.Controls.TitleBarIconText"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Pixeval.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- ReSharper disable Xaml.PathError -->
<Image
x:Name="Image"
Grid.Column="0"
Width="20"
Height="20"
Margin="14,0"
Source="ms-appx:///Assets/Images/logo.svg" />
<!-- ReSharper restore Xaml.PathError -->
<TextBlock
x:Name="TextBlock"
Grid.Column="1"
MaxWidth="200"
VerticalAlignment="Center"
FontSize="{StaticResource PixevalContentFontSize}"
Text="{x:Bind Title, Mode=OneWay}"
TextTrimming="CharacterEllipsis" />
</Grid>

View File

@ -1,14 +0,0 @@
using Microsoft.UI.Xaml.Controls;
using WinUI3Utilities.Attributes;
namespace Pixeval.Controls;
[DependencyProperty<string>("Title")]
public sealed partial class TitleBarIconText : Grid
{
public Image Icon => Image;
public TextBlock TitleBlock => TextBlock;
public TitleBarIconText() => InitializeComponent();
}

View File

@ -139,10 +139,11 @@ public partial class MakoClient
.RemoveNovelBookmarkAsync(new RemoveNovelBookmarkRequest(id))
.ConfigureAwait(false));
public Task<PixivRelatedUsersResponse> RelatedUserAsync(long id, TargetFilter filter = TargetFilter.ForAndroid)
=> RunWithLoggerAsync(async t => await t
.RelatedUserAsync(filter, id)
.ConfigureAwait(false));
public Task<User[]> RelatedUserAsync(long id, TargetFilter filter = TargetFilter.ForAndroid)
=> RunWithLoggerAsync(async t => (await t
.RelatedUserAsync(filter, id)
.ConfigureAwait(false))
.Users);
public Task<HttpResponseMessage> PostFollowUserAsync(long id, PrivacyPolicy privacyPolicy)
=> RunWithLoggerAsync(async t => await t
@ -154,19 +155,17 @@ public partial class MakoClient
.RemoveFollowUserAsync(new RemoveFollowUserRequest(id))
.ConfigureAwait(false));
public Task<IEnumerable<TrendingTag>> GetTrendingTagsAsync(TargetFilter targetFilter)
public Task<TrendingTag[]> GetTrendingTagsAsync(TargetFilter targetFilter)
=> RunWithLoggerAsync(async t => (await t
.GetTrendingTagsAsync(targetFilter)
.ConfigureAwait(false))
.TrendTags
.Select(tag => new TrendingTag(tag.TagStr, tag.TranslatedName, tag.Illust)));
.GetTrendingTagsAsync(targetFilter)
.ConfigureAwait(false))
.TrendTags);
public Task<IEnumerable<TrendingTag>> GetTrendingTagsForNovelAsync(TargetFilter targetFilter)
public Task<TrendingTag[]> GetTrendingTagsForNovelAsync(TargetFilter targetFilter)
=> RunWithLoggerAsync(async t => (await t
.GetTrendingTagsForNovelAsync(targetFilter)
.ConfigureAwait(false))
.TrendTags
.Select(tag => new TrendingTag(tag.TagStr, tag.TranslatedName, tag.Illust)));
.GetTrendingTagsForNovelAsync(targetFilter)
.ConfigureAwait(false))
.TrendTags);
public Task<UgoiraMetadataResponse> GetUgoiraMetadataAsync(long id)
=> RunWithLoggerAsync(async t => await t

View File

@ -18,6 +18,19 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System.Text.Json.Serialization;
namespace Pixeval.CoreApi.Model;
public record TrendingTag(string Tag, string Translation, Illustration Illustration);
[Factory]
public partial record TrendingTag
{
[JsonPropertyName("tag")]
public required string Tag { get; set; } = "";
[JsonPropertyName("translated_name")]
public required string TranslatedName { get; set; } = "";
[JsonPropertyName("illust")]
public required Illustration Illustration { get; set; }
}

View File

@ -27,19 +27,5 @@ namespace Pixeval.CoreApi.Net.Response;
internal partial record TrendingTagResponse
{
[JsonPropertyName("trend_tags")]
public required TrendTag[] TrendTags { get; set; } = [];
}
[Factory]
internal partial record TrendTag
{
[JsonPropertyName("tag")]
public required string TagStr { get; set; } = "";
[JsonPropertyName("translated_name")]
public required string TranslatedName { get; set; } = "";
[JsonPropertyName("illust")]
public required Illustration Illust { get; set; }
public required TrendingTag[] TrendTags { get; set; } = [];
}

View File

@ -1,8 +1,7 @@
<Application
x:Class="Pixeval.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Pixeval.Controls">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@ -12,16 +11,10 @@
<ResourceDictionary Source="ms-appx:///Pixeval.Controls/Themes/Controls.xaml" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<x:Double x:Key="PixevalTitleFontSize">28</x:Double>
<x:Double x:Key="PixevalSubtitleFontSize">18</x:Double>
<x:Double x:Key="PixevalSubSubtitleFontSize">16</x:Double>
<x:Double x:Key="PixevalContentFontSize">14</x:Double>
<x:Double x:Key="PixevalBaseFontSize">12</x:Double>
<x:Double x:Key="PixevalSubscriptFontSize">11</x:Double>
<x:Double x:Key="PixevalCaptionFontSize">10</x:Double>
<x:Double x:Key="CollapsedAppBarButtonWidth">45</x:Double>
<x:Double x:Key="CommandBarHeight">48</x:Double>
<x:Double x:Key="TitleBarHeight">48</x:Double>
<x:Double x:Key="SmallIconFontSize">16</x:Double>
<x:Double x:Key="NegativeTitleBarHeight">-48</x:Double>
<Thickness x:Key="ComboBoxLeftIndent">10,0,0,0</Thickness>
<!-- Gap between different entries -->

View File

@ -128,7 +128,7 @@ public partial record AppSettings() : IWindowSettings
[SettingsEntry(Symbol.Key, nameof(ReverseSearchApiKeyEntryHeader), nameof(ReverseSearchApiKeyEntryDescriptionHyperlinkButtonContent))]
public string ReverseSearchApiKey { get; set; } = "";
[SettingsEntry(Symbol.Filter, nameof(ReverseSearchResultSimilarityThresholdEntryHeader), nameof(ReverseSearchResultSimilarityThresholdEntryDescription))]
[SettingsEntry(Symbol.TargetArrow, nameof(ReverseSearchResultSimilarityThresholdEntryHeader), nameof(ReverseSearchResultSimilarityThresholdEntryDescription))]
public int ReverseSearchResultSimilarityThreshold { get; set; } = 80;
[SettingsEntry(Symbol.History, nameof(MaximumSuggestionBoxSearchHistoryEntryHeader), nameof(MaximumSuggestionBoxSearchHistoryEntryDescription))]
@ -152,6 +152,7 @@ public partial record AppSettings() : IWindowSettings
[SettingsEntry(Symbol.Router, nameof(ProxyTypeEntryHeader), nameof(ProxyTypeEntryDescription))]
public ProxyType ProxyType { get; set; }
[SettingsEntry(Symbol.Server, nameof(ProxyTextBoxEntryHeader), nameof(ProxyTextBoxEntryDescription))]
public string Proxy { get; set; } = "";
/// <summary>
@ -174,6 +175,15 @@ public partial record AppSettings() : IWindowSettings
[AttributeIgnore(typeof(ResetAttribute))]
public DateTimeOffset LastCheckedUpdate { get; set; } = DateTimeOffset.MinValue;
[SettingsEntry(Symbol.Box, nameof(PixivNameResolverHeaderText), nameof(PixivNameResolverDescriptionText))]
public string[] PixivAppApiNameResolver { get; set; } =
[
"210.140.131.199",
"210.140.131.219",
"210.140.131.223",
"210.140.131.226"
];
public string[] PixivWebApiNameResolver { get; set; } =
[
"210.140.131.219",
@ -195,14 +205,6 @@ public partial record AppSettings() : IWindowSettings
"210.140.131.226"
];
public string[] PixivAppApiNameResolver { get; set; } =
[
"210.140.131.199",
"210.140.131.219",
"210.140.131.223",
"210.140.131.226"
];
public string[] PixivImageNameResolver { get; set; } =
[
"210.140.92.144",

View File

@ -33,7 +33,7 @@
HorizontalContentAlignment="Left"
Background="Transparent"
BorderThickness="0"
Tapped="PosterPersonPicture_OnTapped">
Click="PosterPersonPicture_OnClicked">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@ -54,14 +54,14 @@
<TextBlock
Grid.Row="0"
Grid.Column="1"
FontSize="{StaticResource PixevalContentFontSize}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.Poster, Mode=OneWay}" />
<!-- TipTextColor -->
<TextBlock
Grid.Row="2"
Grid.Column="1"
FontSize="{StaticResource PixevalCaptionFontSize}"
Foreground="{ThemeResource PixevalTipTextForeground}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.PostDate, Converter={StaticResource CultureDateConverter}, Mode=OneWay}" />
</Grid>
</Button>
@ -71,15 +71,15 @@
DefaultLabelPosition="Right"
OverflowButtonVisibility="Collapsed">
<AppBarButton
Click="DeleteReplyHyperlinkButton_OnClicked"
Icon="{fluent:SymbolIcon Symbol=Delete}"
LabelPosition="Collapsed"
Tapped="DeleteReplyHyperlinkButton_OnTapped"
Visibility="{x:Bind ViewModel.IsMe, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" />
<AppBarButton
Click="OpenRepliesHyperlinkButton_OnClicked"
Icon="{fluent:SymbolIcon Symbol=Chat}"
Label="{x:Bind ViewModel.RepliesCount, Mode=OneWay}"
LabelPosition="{x:Bind ViewModel.RepliesCount, Converter={StaticResource LabelNullableVisibilityConverter}, Mode=OneWay}"
Tapped="OpenRepliesHyperlinkButton_OnTapped" />
LabelPosition="{x:Bind ViewModel.RepliesCount, Converter={StaticResource LabelNullableVisibilityConverter}, Mode=OneWay}" />
</CommandBar>
<controls1:SwitchPresenter
Grid.Row="1"
@ -102,7 +102,7 @@
</controls1:Case.Value>
<RichTextBlock
x:Name="CommentContent"
FontSize="{StaticResource PixevalBaseFontSize}"
FontSize="{StaticResource CaptionTextBlockFontSize}"
LineHeight="14.4"
TextWrapping="Wrap" />
</controls1:Case>

View File

@ -35,9 +35,9 @@ public sealed partial class CommentBlock
{
public CommentBlock() => InitializeComponent();
public event Action<CommentBlockViewModel>? RepliesHyperlinkButtonTapped;
public event Action<CommentBlockViewModel>? RepliesHyperlinkButtonClick;
public event Action<CommentBlockViewModel>? DeleteHyperlinkButtonTapped;
public event Action<CommentBlockViewModel>? DeleteHyperlinkButtonClick;
private static async void OnViewModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@ -60,12 +60,12 @@ public sealed partial class CommentBlock
}
}
private async void PosterPersonPicture_OnTapped(object sender, TappedRoutedEventArgs e)
private async void PosterPersonPicture_OnClicked(object sender, RoutedEventArgs e)
{
await IllustratorViewerHelper.CreateWindowWithPageAsync(ViewModel.PosterId);
}
private void OpenRepliesHyperlinkButton_OnTapped(object sender, TappedRoutedEventArgs e) => RepliesHyperlinkButtonTapped?.Invoke(ViewModel);
private void OpenRepliesHyperlinkButton_OnClicked(object sender, RoutedEventArgs e) => RepliesHyperlinkButtonClick?.Invoke(ViewModel);
private void DeleteReplyHyperlinkButton_OnTapped(object sender, TappedRoutedEventArgs e) => DeleteHyperlinkButtonTapped?.Invoke(ViewModel);
private void DeleteReplyHyperlinkButton_OnClicked(object sender, RoutedEventArgs e) => DeleteHyperlinkButtonClick?.Invoke(ViewModel);
}

View File

@ -30,7 +30,7 @@
<TextBlock
x:Uid="/EntryView/ResultIsEmptyTextBlock"
HorizontalAlignment="Center"
FontSize="{StaticResource PixevalTitleFontSize}" />
Style="{StaticResource TitleTextBlockStyle}" />
</StackPanel>
<local:SkeletonView x:Name="SkeletonView" Grid.Row="0" />
<local:AdvancedItemsView
@ -46,8 +46,8 @@
<ItemContainer>
<local:CommentBlock
Margin="{StaticResource CardControlPadding}"
DeleteHyperlinkButtonTapped="CommentBlock_OnDeleteHyperlinkButtonTapped"
RepliesHyperlinkButtonTapped="CommentBlock_OnRepliesHyperlinkButtonTapped"
DeleteHyperlinkButtonClick="CommentBlock_OnDeleteHyperlinkButtonClick"
RepliesHyperlinkButtonClick="CommentBlock_OnRepliesHyperlinkButtonClick"
ViewModel="{x:Bind}" />
</ItemContainer>
</DataTemplate>

View File

@ -32,18 +32,18 @@ public sealed partial class CommentList
{
public CommentList() => InitializeComponent();
public event Action<CommentBlockViewModel>? RepliesHyperlinkButtonTapped;
public event Action<CommentBlockViewModel>? RepliesHyperlinkButtonClick;
public event Action<CommentBlockViewModel>? DeleteHyperlinkButtonTapped;
public event Action<CommentBlockViewModel>? DeleteHyperlinkButtonClick;
private void CommentBlock_OnRepliesHyperlinkButtonTapped(CommentBlockViewModel viewModel)
private void CommentBlock_OnRepliesHyperlinkButtonClick(CommentBlockViewModel viewModel)
{
RepliesHyperlinkButtonTapped?.Invoke(viewModel);
RepliesHyperlinkButtonClick?.Invoke(viewModel);
}
private void CommentBlock_OnDeleteHyperlinkButtonTapped(CommentBlockViewModel viewModel)
private void CommentBlock_OnDeleteHyperlinkButtonClick(CommentBlockViewModel viewModel)
{
DeleteHyperlinkButtonTapped?.Invoke(viewModel);
DeleteHyperlinkButtonClick?.Invoke(viewModel);
}
private void CommentList_OnUnloaded(object sender, RoutedEventArgs e)

View File

@ -20,7 +20,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{fluent:SymbolIcon Symbol=Emoji,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
Style="{StaticResource PixevalRoundedButtonStyle}">
<Button.Flyout>
<Flyout>
@ -63,7 +63,7 @@
Height="32"
Padding="0"
Content="{fluent:SymbolIcon Symbol=Send,
Size=Small}"
Tapped="SendButton_OnTapped" />
FontSize={StaticResource SmallIconFontSize}}"
Click="SendButton_OnClicked" />
</Grid>
</UserControl>

View File

@ -36,17 +36,17 @@ public sealed partial class PixivReplyBar
public PixivReplyBar()
{
InitializeComponent();
StickerTapped += (_, _) => EmojiButton.Flyout.Hide();
StickerClick += (_, _) => EmojiButton.Flyout.Hide();
}
public event EventHandler<SendButtonTappedEventArgs>? SendButtonTapped;
public event EventHandler<SendButtonClickEventArgs>? SendButtonClick;
public event EventHandler<StickerTappedEventArgs>? StickerTapped;
public event EventHandler<StickerClickEventArgs>? StickerClick;
private void PixivReplyBar_OnLoaded(object sender, RoutedEventArgs e)
{
EmojiButtonFlyoutEmojiSectionNavigationViewItem.Tag = new NavigationViewTag(typeof(PixivReplyEmojiListPage), this);
EmojiButtonFlyoutStickersSectionNavigationViewItem.Tag = new NavigationViewTag(typeof(PixivReplyStickerListPage), (Guid.NewGuid(), StickerTapped) /* just to support the serialization, see https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.frame.navigate?view=winui-3.0#Microsoft_UI_Xaml_Controls_Frame_Navigate_Windows_UI_Xaml_Interop_TypeName_System_Object_Microsoft_UI_Xaml_Media_Animation_NavigationTransitionInfo_ */);
EmojiButtonFlyoutStickersSectionNavigationViewItem.Tag = new NavigationViewTag(typeof(PixivReplyStickerListPage), (Guid.NewGuid(), StickerClick) /* just to support the serialization, see https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.frame.navigate?view=winui-3.0#Microsoft_UI_Xaml_Controls_Frame_Navigate_Windows_UI_Xaml_Interop_TypeName_System_Object_Microsoft_UI_Xaml_Media_Animation_NavigationTransitionInfo_ */);
}
private void EmojiButtonFlyoutNavigationView_OnSelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
@ -59,7 +59,7 @@ public sealed partial class PixivReplyBar
});
}
private void SendButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void SendButton_OnClicked(object sender, RoutedEventArgs e)
{
ReplyContentRichEditBox.Document.GetText(TextGetOptions.UseObjectText, out var content);
if (content.Length is 0 or > 140)
@ -69,7 +69,7 @@ public sealed partial class PixivReplyBar
return;
}
SendButtonTapped?.Invoke(this, new SendButtonTappedEventArgs(e, content));
SendButtonClick?.Invoke(this, new SendButtonClickEventArgs(e, content));
ReplyContentRichEditBox.ClearContent();
}
@ -80,19 +80,19 @@ public sealed partial class PixivReplyBar
}
}
public class SendButtonTappedEventArgs(TappedRoutedEventArgs tappedEventArgs,
public class SendButtonClickEventArgs(RoutedEventArgs tappedEventArgs,
string replyContentRichEditBoxStringContent)
: EventArgs
{
public TappedRoutedEventArgs TappedEventArgs { get; } = tappedEventArgs;
public RoutedEventArgs ClickEventArgs { get; } = tappedEventArgs;
public string ReplyContentRichEditBoxStringContent { get; } = replyContentRichEditBoxStringContent;
}
public class StickerTappedEventArgs(TappedRoutedEventArgs tappedEventArgs, PixivReplyStickerViewModel stickerViewModel)
public class StickerClickEventArgs(RoutedEventArgs tappedEventArgs, PixivReplyStickerViewModel stickerViewModel)
: EventArgs
{
public TappedRoutedEventArgs TappedEventArgs { get; } = tappedEventArgs;
public RoutedEventArgs ClickEventArgs { get; } = tappedEventArgs;
public PixivReplyStickerViewModel StickerViewModel { get; } = stickerViewModel;
}

View File

@ -9,10 +9,10 @@
<StackPanel Spacing="10">
<TextBlock x:Uid="/CheckExitedContentDialog/MainTextBlock" TextWrapping="WrapWholeWords" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/ClearConfig" Tapped="ClearConfig_OnTapped" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/ClearContext" Tapped="ClearContext_OnTapped" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/OpenLocalFolder" Tapped="OpenLocalFolder_OnTapped" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/OpenRoamingFolder" Tapped="OpenRoamingFolder_OnTapped" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/OpenLogFolder" Tapped="OpenLogFolder_OnTapped" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/ClearConfig" Click="ClearConfig_OnClicked" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/ClearContext" Click="ClearContext_OnClicked" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/OpenLocalFolder" Click="OpenLocalFolder_OnClicked" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/OpenRoamingFolder" Click="OpenRoamingFolder_OnClicked" />
<HyperlinkButton x:Uid="/CheckExitedContentDialog/OpenLogFolder" Click="OpenLogFolder_OnClicked" />
</StackPanel>
</UserControl>

View File

@ -1,8 +1,8 @@
using System;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Pixeval.AppManagement;
using Windows.System;
using Microsoft.UI.Xaml;
namespace Pixeval.Controls.DialogContent;
@ -10,13 +10,13 @@ public sealed partial class CheckExitedDialog : UserControl
{
public CheckExitedDialog() => InitializeComponent();
private void ClearConfig_OnTapped(object sender, TappedRoutedEventArgs e) => AppInfo.ClearConfig();
private void ClearConfig_OnClicked(object sender, RoutedEventArgs e) => AppInfo.ClearConfig();
private void ClearContext_OnTapped(object sender, TappedRoutedEventArgs e) => AppInfo.ClearLoginContext();
private void ClearContext_OnClicked(object sender, RoutedEventArgs e) => AppInfo.ClearLoginContext();
private async void OpenLocalFolder_OnTapped(object sender, TappedRoutedEventArgs e) => await Launcher.LaunchFolderAsync(AppKnownFolders.Local.Self);
private async void OpenLocalFolder_OnClicked(object sender, RoutedEventArgs e) => await Launcher.LaunchFolderAsync(AppKnownFolders.Local.Self);
private async void OpenRoamingFolder_OnTapped(object sender, TappedRoutedEventArgs e) => await Launcher.LaunchFolderAsync(AppKnownFolders.Roaming.Self);
private async void OpenRoamingFolder_OnClicked(object sender, RoutedEventArgs e) => await Launcher.LaunchFolderAsync(AppKnownFolders.Roaming.Self);
private async void OpenLogFolder_OnTapped(object sender, TappedRoutedEventArgs e) => await Launcher.LaunchFolderAsync(AppKnownFolders.Log.Self);
private async void OpenLogFolder_OnClicked(object sender, RoutedEventArgs e) => await Launcher.LaunchFolderAsync(AppKnownFolders.Log.Self);
}

View File

@ -23,7 +23,7 @@
Source="{x:Bind _viewModel.Thumbnail, Mode=OneWay}" />
<TextBlock
VerticalAlignment="Center"
FontSize="{StaticResource PixevalBaseFontSize}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind _viewModel.Name, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />

View File

@ -30,7 +30,7 @@
<TextBlock
x:Uid="/EntryView/ResultIsEmptyTextBlock"
HorizontalAlignment="Center"
FontSize="{StaticResource PixevalTitleFontSize}" />
Style="{StaticResource TitleTextBlockStyle}" />
</StackPanel>
<local:SkeletonView x:Name="SkeletonView" Grid.Row="0" />
<ContentPresenter Grid.Row="0" Content="{x:Bind Content, Mode=OneWay}" />

View File

@ -21,11 +21,11 @@
Grid.Row="0"
HasNoItem="{x:Bind ViewModel.RepliesIsNotNull, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
ItemsSource="{x:Bind ViewModel.Replies, Mode=OneWay}"
RepliesHyperlinkButtonTapped="CommentList_OnRepliesHyperlinkButtonTapped" />
RepliesHyperlinkButtonClick="CommentList_OnRepliesHyperlinkButtonClick" />
<controls:PixivReplyBar
x:Name="ReplyBar"
Grid.Row="1"
Margin="10"
SendButtonTapped="ReplyBar_OnSendButtonTapped"
StickerTapped="ReplyBar_OnStickerTapped" />
SendButtonClick="ReplyBar_OnSendButtonClick"
StickerClick="ReplyBar_OnStickerClick" />
</Grid>

View File

@ -36,12 +36,12 @@ public sealed partial class CommentRepliesBlock
{
public CommentRepliesBlock() => InitializeComponent();
private void CommentList_OnRepliesHyperlinkButtonTapped(CommentBlockViewModel viewModel)
private void CommentList_OnRepliesHyperlinkButtonClick(CommentBlockViewModel viewModel)
{
_ = ReplyBar.FindDescendant<RichEditBox>()?.Focus(FocusState.Programmatic);
}
private async void ReplyBar_OnSendButtonTapped(object? sender, SendButtonTappedEventArgs e)
private async void ReplyBar_OnSendButtonClick(object? sender, SendButtonClickEventArgs e)
{
using var result = ViewModel.EntryType switch
{
@ -59,7 +59,7 @@ public sealed partial class CommentRepliesBlock
await AddComment(result);
}
private async void ReplyBar_OnStickerTapped(object? sender, StickerTappedEventArgs e)
private async void ReplyBar_OnStickerClick(object? sender, StickerClickEventArgs e)
{
using var result = ViewModel.EntryType switch
{

View File

@ -12,7 +12,7 @@
<AutoSuggestBox
x:Uid="/IPListInput/AddItemAutoSuggestBox"
QueryIcon="{fluent:SymbolIcon Symbol=Add,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
QuerySubmitted="AddItem"
TextChanged="TextChanged" />
<InfoBar x:Name="ErrorInfoBar" IsClosable="True" />

View File

@ -43,7 +43,7 @@
<Grid.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Command="{x:Bind ViewModel.BookmarkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<MenuFlyoutItem Click="AddToBookmark_OnTapped" Command="{x:Bind ViewModel.AddToBookmarkCommand, Mode=OneWay}" />
<MenuFlyoutItem Click="AddToBookmark_OnClicked" Command="{x:Bind ViewModel.AddToBookmarkCommand, Mode=OneWay}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem Command="{x:Bind ViewModel.SaveCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<MenuFlyoutSeparator />

View File

@ -72,7 +72,7 @@ public sealed partial class IllustrationItem
};
}
private void AddToBookmark_OnTapped(object sender, RoutedEventArgs e)
private void AddToBookmark_OnClicked(object sender, RoutedEventArgs e)
{
RequestAddToBookmark?.Invoke(this, ViewModel);
}

View File

@ -48,12 +48,12 @@
<ContentControl
VerticalAlignment="Center"
Content="{fluent:SymbolIcon Symbol=Guest,
FontSize=11}"
FontSize=12}"
Foreground="{StaticResource TextSecondaryAccentColor}" />
<TextBlock
VerticalAlignment="Center"
Foreground="{StaticResource TextSecondaryAccentColor}"
Style="{StaticResource SubscriptTextBlockStyle}"
Style="{StaticResource CaptionStrongTextBlockStyle}"
Text="{x:Bind ViewModel.UserId, Mode=OneWay}" />
<local:PixevalBadge
Mode="Following"

View File

@ -66,7 +66,7 @@
x:Name="TitleTextBlock"
controls:DockPanel.Dock="Top"
MaxLines="3"
Style="{StaticResource ContentStrongTextBlockStyle}"
Style="{StaticResource CaptionStrongTextBlockStyle}"
Text="{x:Bind ViewModel.Title, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords" />
@ -75,7 +75,7 @@
controls:DockPanel.Dock="Right"
Foreground="DarkGray"
MaxLines="1"
Style="{StaticResource ContentTextBlockStyle}"
Style="{StaticResource BodyTextBlockStyle}"
Text="{x:Bind ViewModel.PublishDate, Converter={StaticResource CultureDateConverter}, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords" />
@ -83,7 +83,7 @@
x:Name="AuthorTextBlock"
Foreground="DarkGray"
MaxLines="1"
Style="{StaticResource ContentTextBlockStyle}"
Style="{StaticResource BodyTextBlockStyle}"
Text="{x:Bind ViewModel.User.Name, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords" />
@ -133,7 +133,7 @@
Padding="2"
Background="#7F7F7F7F"
CornerRadius="{StaticResource ControlCornerRadius}">
<TextBlock FontSize="{StaticResource PixevalSubscriptFontSize}" Text="{x:Bind Name}" />
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="{x:Bind Name}" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
@ -182,8 +182,8 @@
HorizontalAlignment="Left"
DefaultLabelPosition="Collapsed"
OverflowButtonVisibility="Collapsed">
<AppBarButton Command="{x:Bind OpenNovelCommand}" Tapped="OpenNovel_OnTapped" />
<AppBarButton Command="{x:Bind ViewModel.AddToBookmarkCommand, Mode=OneWay}" Tapped="AddToBookmark_OnTapped" />
<AppBarButton Click="OpenNovel_OnClicked" Command="{x:Bind OpenNovelCommand}" />
<AppBarButton Click="AddToBookmark_OnClicked" Command="{x:Bind ViewModel.AddToBookmarkCommand, Mode=OneWay}" />
<AppBarButton Command="{x:Bind ViewModel.SaveCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind ViewModel.OpenInWebBrowserCommand, Mode=OneWay}" />
</CommandBar>
@ -196,7 +196,7 @@
x:Name="PopupTitleTextBlock"
controls:DockPanel.Dock="Top"
MaxLines="1"
Style="{StaticResource ContentStrongTextBlockStyle}"
Style="{StaticResource CaptionStrongTextBlockStyle}"
Text="{x:Bind ViewModel.Title, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords" />
@ -205,7 +205,7 @@
controls:DockPanel.Dock="Top"
Foreground="DarkGray"
MaxLines="1"
Style="{StaticResource ContentTextBlockStyle}"
Style="{StaticResource BodyTextBlockStyle}"
Text="{x:Bind ViewModel.User.Name, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords" />
@ -225,9 +225,9 @@
<Button
Padding="2"
Background="#7F7F7F7F"
CornerRadius="{StaticResource ControlCornerRadius}"
Tapped="TagButton_OnTapped">
<TextBlock FontSize="{StaticResource PixevalSubscriptFontSize}" Text="{x:Bind Name}" />
Click="TagButton_OnClicked"
CornerRadius="{StaticResource ControlCornerRadius}">
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="{x:Bind Name}" />
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>

View File

@ -98,9 +98,8 @@ public sealed partial class NovelItem
}
}
private void TagButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void TagButton_OnClicked(object sender, RoutedEventArgs e)
{
e.Handled = true;
_ = WeakReferenceMessenger.Default.Send(new WorkTagClickedMessage(SimpleWorkType.Novel, ((TextBlock)((Button)sender).Content).Text));
}
@ -121,14 +120,14 @@ public sealed partial class NovelItem
IsPointerOver += 1;
}
private void OpenNovel_OnTapped(object sender, TappedRoutedEventArgs e)
private void OpenNovel_OnClicked(object sender, RoutedEventArgs e)
{
OpenNovelRequested?.Invoke(this, ViewModel);
}
private XamlUICommand OpenNovelCommand { get; } = EntryItemResources.OpenNovel.GetCommand(Symbol.BookOpen);
private void AddToBookmark_OnTapped(object sender, TappedRoutedEventArgs e)
private void AddToBookmark_OnClicked(object sender, RoutedEventArgs e)
{
RequestAddToBookmark?.Invoke(this, ViewModel);
}

View File

@ -26,8 +26,8 @@
Height="100"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Click="NextButton_OnClicked"
RightTapped="NextButton_OnRightTapped"
Tapped="NextButton_OnTapped"
ToolTipService.ToolTip="{x:Bind ToolTip, Mode=OneWay}"
Visibility="{x:Bind ButtonVisibility, Mode=OneWay}">
<Image x:Name="Image" RenderTransformOrigin="0.5,0.5">

View File

@ -12,11 +12,11 @@ public sealed partial class PageButton
{
public PageButton() => InitializeComponent();
public event TappedEventHandler? ButtonTapped;
public event RoutedEventHandler? ButtonClick;
public event RightTappedEventHandler? ButtonRightTapped;
private void NextButton_OnTapped(object sender, TappedRoutedEventArgs e) => ButtonTapped?.Invoke(sender, e);
private void NextButton_OnClicked(object sender, RoutedEventArgs e) => ButtonClick?.Invoke(sender, e);
private void NextButton_OnRightTapped(object sender, RightTappedRoutedEventArgs e) => ButtonRightTapped?.Invoke(sender, e);

View File

@ -13,7 +13,7 @@
<RadioButton
Content="{x:Bind StringRepresentation}"
Tag="{x:Bind}"
Tapped="RadioButton_OnTapped" />
Click="RadioButton_OnClicked" />
</DataTemplate>
</RadioButtons.ItemTemplate>
</RadioButtons>

View File

@ -42,7 +42,7 @@ public sealed partial class SettingRadioButtons : UserControl
public SettingRadioButtons() => InitializeComponent();
private void RadioButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void RadioButton_OnClicked(object sender, RoutedEventArgs e)
{
var select = sender.To<RadioButton>().GetTag<StringRepresentableItem>();
if (!Equals(SelectedItem, select.Item))

View File

@ -25,7 +25,7 @@
<labs:TokenView
IsItemClickEnabled="True"
IsWrapped="True"
ItemClick="PathMacroTokenInputBox_OnTokenTapped"
ItemClick="PathMacroTokenInputBox_OnTokenClick"
ItemsSource="{x:Bind models:DownloadMacroAppSettingsEntry.AvailableMacros}"
SelectionMode="None">
<labs:TokenView.ItemTemplate>

View File

@ -113,7 +113,7 @@ public sealed partial class DownloadMacroSettingsExpander
e.Handled = true;
}
private void PathMacroTokenInputBox_OnTokenTapped(object sender, ItemClickEventArgs e)
private void PathMacroTokenInputBox_OnTokenClick(object sender, ItemClickEventArgs e)
{
UiHelper.ClipboardSetText(e.ClickedItem.To<StringRepresentableItem>().StringRepresentation);
WindowFactory.GetWindowForElement(this).HWnd.SuccessGrowl(SettingsPageResources.MacroCopiedToClipboard);

View File

@ -22,7 +22,7 @@
<HyperlinkButton
Content="{x:Bind Entry.Description}"
Tag="ms-settings:fonts"
Tapped="OpenLinkViaTag_OnTapped" />
Click="OpenLinkViaTag_OnClicked" />
</controls:SettingsCard.Description>
<ComboBox
x:Uid="/SettingsPage/AppFontFamilyComboBox"

View File

@ -14,7 +14,7 @@ public sealed partial class FontSettingsCard
public FontSettingsCard() => InitializeComponent();
private async void OpenLinkViaTag_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenLinkViaTag_OnClicked(object sender, RoutedEventArgs e)
{
_ = await Launcher.LaunchUriAsync(new Uri(sender.To<FrameworkElement>().GetTag<string>()));
}

View File

@ -18,22 +18,23 @@
</controls:SettingsExpander.HeaderIcon>
<ToggleSwitch IsOn="{x:Bind Entry.Settings.EnableDomainFronting, Mode=TwoWay}" Toggled="ToggleSwitch_OnToggled" />
<controls:SettingsExpander.Items>
<controls:SettingsCard HorizontalContentAlignment="Stretch" ContentAlignment="Left">
<StackPanel Spacing="10">
<TextBlock x:Uid="/SettingsPage/PixivNameResolverHeader" />
<TextBlock
x:Uid="/SettingsPage/PixivNameResolverDescription"
Foreground="{StaticResource TextSecondaryAccentColor}"
Style="{StaticResource BaseTextBlockStyle}" />
<controls:WrapPanel HorizontalSpacing="10" VerticalSpacing="10">
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.AppApiHost}" ItemsSource="{x:Bind Entry.PixivAppApiNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.ImageHost}" ItemsSource="{x:Bind Entry.PixivImageNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.ImageHost2}" ItemsSource="{x:Bind Entry.PixivImageNameResolver2, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.OAuthHost}" ItemsSource="{x:Bind Entry.PixivOAuthNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.AccountHost}" ItemsSource="{x:Bind Entry.PixivAccountNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.WebApiHost}" ItemsSource="{x:Bind Entry.PixivWebApiNameResolver, Mode=OneWay}" />
</controls:WrapPanel>
</StackPanel>
<controls:SettingsCard
HorizontalContentAlignment="Left"
ContentAlignment="Vertical"
Description="{x:Bind Entry.DescriptionControl2}"
Header="{x:Bind Entry.Header2}"
Tag="{x:Bind Entry.Attribute2}">
<controls:SettingsCard.HeaderIcon>
<fluent:SymbolIcon Symbol="{x:Bind Entry.HeaderIcon2}" />
</controls:SettingsCard.HeaderIcon>
<controls:WrapPanel HorizontalSpacing="10" VerticalSpacing="10">
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.AppApiHost}" ItemsSource="{x:Bind Entry.PixivAppApiNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.ImageHost}" ItemsSource="{x:Bind Entry.PixivImageNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.ImageHost2}" ItemsSource="{x:Bind Entry.PixivImageNameResolver2, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.OAuthHost}" ItemsSource="{x:Bind Entry.PixivOAuthNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.AccountHost}" ItemsSource="{x:Bind Entry.PixivAccountNameResolver, Mode=OneWay}" />
<controls1:IPListInput Header="{x:Bind coreApi:MakoHttpOptions.WebApiHost}" ItemsSource="{x:Bind Entry.PixivWebApiNameResolver, Mode=OneWay}" />
</controls:WrapPanel>
</controls:SettingsCard>
</controls:SettingsExpander.Items>
</controls:SettingsExpander>

View File

@ -15,7 +15,7 @@
<HyperlinkButton
x:Uid="/SettingsPage/OpenLanguageSettingsHyperlinkButton"
Tag="ms-settings:regionlanguage"
Tapped="OpenLinkViaTag_OnTapped" />
Click="OpenLinkViaTag_OnClicked" />
</controls:SettingsCard.Description>
<ComboBox
x:Uid="/SettingsPage/AppLanguageEntryComboBox"

View File

@ -13,7 +13,7 @@ public sealed partial class LanguageSettingsCard
public LanguageSettingsCard() => InitializeComponent();
private async void OpenLinkViaTag_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenLinkViaTag_OnClicked(object sender, RoutedEventArgs e)
{
_ = await Launcher.LaunchUriAsync(new Uri(sender.To<FrameworkElement>().GetTag<string>()));
}

View File

@ -21,7 +21,14 @@
SelectionChanged="EnumComboBox_OnSelectionChanged"
Style="{StaticResource SettingsEnumComboBoxStyle}" />
<controls:SettingsExpander.Items>
<controls:SettingsCard x:Uid="/SettingsPage/ProxyTextBoxEntry" HorizontalContentAlignment="Stretch">
<controls:SettingsCard
HorizontalContentAlignment="Stretch"
Description="{x:Bind Entry.DescriptionControl2}"
Header="{x:Bind Entry.Header2}"
Tag="{x:Bind Entry.Attribute2}">
<controls:SettingsCard.HeaderIcon>
<fluent:SymbolIcon Symbol="{x:Bind Entry.HeaderIcon2}" />
</controls:SettingsCard.HeaderIcon>
<TextBox
MinWidth="200"
LostFocus="TextBox_OnLostFocus"

View File

@ -30,11 +30,11 @@
ToolTipService.ToolTip="{x:Bind Tooltip, Mode=OneWay}">
<TextBlock Text="{x:Bind TokenContent}" />
<fluent:SymbolIcon
FontSize="16"
FontSize="{StaticResource SmallIconFontSize}"
Symbol="TextChangeCase"
Visibility="{x:Bind CaseSensitive, Converter={StaticResource BoolToVisibilityConverter}}" />
<fluent:SymbolIcon
FontSize="16"
FontSize="{StaticResource SmallIconFontSize}"
Symbol="Code"
Visibility="{x:Bind IsRegularExpression, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>

View File

@ -20,6 +20,7 @@
using System;
using Windows.System;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using WinUI3Utilities.Attributes;
@ -61,18 +62,18 @@ public partial class TokenInputTextBox : Control
if (_submitButton is not null)
{
_submitButton.Tapped -= SubmitButtonOnTapped;
_submitButton.Click -= SubmitButtonOnClicked;
}
if ((_submitButton = GetTemplateChild(PartSubmitButton) as Button) is not null)
{
_submitButton.Tapped += SubmitButtonOnTapped;
_submitButton.Click += SubmitButtonOnClicked;
}
base.OnApplyTemplate();
}
private void SubmitButtonOnTapped(object sender, TappedRoutedEventArgs e)
private void SubmitButtonOnClicked(object sender, RoutedEventArgs e)
{
SubmitToken();
}

View File

@ -25,7 +25,7 @@
Padding="0"
controls:DockPanel.Dock="Right"
Content="{fluent:SymbolIcon Symbol=ArrowTurnDownLeft,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SubmitEnable, Mode=OneWay}" />
<ToggleButton
x:Uid="/TokenInputTextBox/IsRegularExpressionCheckBox"
@ -34,7 +34,7 @@
Padding="0"
controls:DockPanel.Dock="Right"
Content="{fluent:SymbolIcon Symbol=Code,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Token.IsRegularExpression, Mode=TwoWay}" />
<ToggleButton
x:Uid="/TokenInputTextBox/CaseSensitiveCheckBox"
@ -43,7 +43,7 @@
Padding="0"
controls:DockPanel.Dock="Right"
Content="{fluent:SymbolIcon Symbol=TextChangeCase,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Token.CaseSensitive, Mode=TwoWay}" />
<!-- ReSharper disable once UnusedMember.Local -->
<TextBox

View File

@ -40,7 +40,7 @@
Width="250"
VerticalAlignment="Center"
QueryIcon="{fluent:SymbolIcon Symbol=Filter,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
QuerySubmitted="FilterAutoSuggestBox_QuerySubmitted" />
</StackPanel>
<CommandBar controls1:DockPanel.Dock="Right" DefaultLabelPosition="Right">
@ -57,28 +57,28 @@
Icon="{fluent:SymbolIcon Symbol=SelectAllOff}"
IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}"
Label="{x:Bind WorkView.ViewModel.SelectionLabel, Mode=OneWay}"
Tapped="CancelSelectionButton_OnTapped" />
Click="CancelSelectionButton_OnClicked" />
<AppBarButton
x:Uid="/WorkContainer/SelectAllButton"
Icon="{fluent:SymbolIcon Symbol=SelectAllOn}"
Tapped="SelectAllToggleButton_OnTapped" />
Click="SelectAllToggleButton_OnClicked" />
<AppBarSeparator />
<AppBarButton
x:Name="AddAllToBookmarkButton"
x:Uid="/WorkContainer/AddAllToBookmarkButton"
Icon="{fluent:SymbolIcon Symbol=Bookmark}"
IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}"
Tapped="AddAllToBookmarkButton_OnTapped" />
Click="AddAllToBookmarkButton_OnClicked" />
<AppBarButton
x:Uid="/WorkContainer/SaveAllButton"
Icon="{fluent:SymbolIcon Symbol=Save}"
IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}"
Tapped="SaveAllButton_OnTapped" />
Click="SaveAllButton_OnClicked" />
<AppBarButton
x:Uid="/WorkContainer/OpenAllInBrowserButton"
Icon="{fluent:SymbolIcon Symbol=GlobeArrowUp}"
IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}"
Tapped="OpenAllInBrowserButton_OnTapped" />
Click="OpenAllInBrowserButton_OnClicked" />
</CommandBar>
</controls1:DockPanel>
<controls:WorkView

View File

@ -88,7 +88,7 @@ public partial class WorkContainer : IScrollViewHost
private void WorkContainer_OnLoaded(object sender, RoutedEventArgs e) => _ = WorkView.Focus(FocusState.Programmatic);
private void SelectAllToggleButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void SelectAllToggleButton_OnClicked(object sender, RoutedEventArgs e)
{
WorkView.AdvancedItemsView.SelectAll();
}
@ -121,9 +121,9 @@ public partial class WorkContainer : IScrollViewHost
_ = scrollView.ScrollTo(0, 0);
}
private void AddAllToBookmarkButton_OnTapped(object sender, TappedRoutedEventArgs e) => AddToBookmarkTeachingTip.IsOpen = true;
private void AddAllToBookmarkButton_OnClicked(object sender, RoutedEventArgs e) => AddToBookmarkTeachingTip.IsOpen = true;
private async void SaveAllButton_OnTapped(object sender, TappedRoutedEventArgs e)
private async void SaveAllButton_OnClicked(object sender, RoutedEventArgs e)
{
if (ViewModel.SelectedEntries.Count >= 20 && await this.CreateOkCancelAsync(WorkContainerResources.SelectedTooManyItemsTitle,
WorkContainerResources.SelectedTooManyItemsForSaveContent) is not ContentDialogResult.Primary)
@ -135,7 +135,7 @@ public partial class WorkContainer : IScrollViewHost
HWnd.InfoGrowl(WorkContainerResources.DownloadItemsQueuedFormatted.Format(ViewModel.SelectedEntries.Count));
}
private async void OpenAllInBrowserButton_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenAllInBrowserButton_OnClicked(object sender, RoutedEventArgs e)
{
if (ViewModel.SelectedEntries.Count > 15 && await this.CreateOkCancelAsync(
WorkContainerResources.SelectedTooManyItemsTitle,
@ -161,7 +161,7 @@ public partial class WorkContainer : IScrollViewHost
HWnd.SuccessGrowl(WorkContainerResources.AddedAllToBookmarkContentFormatted.Format(c));
}
private void CancelSelectionButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void CancelSelectionButton_OnClicked(object sender, RoutedEventArgs e)
{
WorkView.AdvancedItemsView.DeselectAll();
}

View File

@ -12,9 +12,7 @@
DisplayMode="Overlay"
IsPaneOpen="{x:Bind IsPaneOpen, Mode=TwoWay}"
OpenPaneLength="{x:Bind local:WorkViewerSplitView.OpenPaneLength}"
PaneBackground="Transparent"
PaneClosed="SplitView_OnPaneOpenedOrClosed"
PaneOpened="SplitView_OnPaneOpenedOrClosed">
PaneBackground="Transparent">
<SplitView.Pane>
<Grid Background="{StaticResource SystemControlBackgroundChromeMediumLowBrush}" Translation="0,0,40">
<NavigationView

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.UI.Xaml;
@ -16,8 +15,6 @@ namespace Pixeval.Controls;
[DependencyProperty<bool>("PinPane", "false", nameof(OnPinPaneChanged))]
public sealed partial class WorkViewerSplitView
{
public event EventHandler? RaiseSetTitleBarDragRegion;
public const double OpenPaneLength = 330;
public WorkViewerSplitView() => InitializeComponent();
@ -34,8 +31,6 @@ public sealed partial class WorkViewerSplitView
_ = PaneFrame.Navigate(tag.NavigateTo, tag.Parameter, info);
}
private void SplitView_OnPaneOpenedOrClosed(SplitView sender, object e) => RaiseSetTitleBarDragRegion?.Invoke(this, EventArgs.Empty);
private static void OnIsPaneOpenChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
if (o is WorkViewerSplitView { IsPaneOpen: false, PinPane: true } splitView)

View File

@ -15,7 +15,7 @@ public sealed partial class RelatedUsersPage : IScrollViewHost
userId = App.AppViewModel.PixivUid;
var engine = App.AppViewModel.MakoClient.Computed((await App.AppViewModel.MakoClient.RelatedUserAsync(userId))
.Users.ToAsyncEnumerable());
.ToAsyncEnumerable());
IllustratorView.ViewModel.ResetEngine(engine);
}

View File

@ -5,14 +5,12 @@
xmlns:controls="using:Pixeval.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pixeval="using:Pixeval"
Loaded="SearchWorksPage_OnLoaded"
mc:Ignorable="d">
<controls:WorkContainer x:Name="WorkContainer">
<controls:WorkContainer.CommandBarElements>
<controls:EnumComboBox
x:Name="SimpleWorkTypeComboBox"
SelectedEnum="{x:Bind pixeval:App.AppViewModel.AppSettings.SimpleWorkType}"
SelectionChanged="ComboBox_OnSelectionChanged"
Style="{StaticResource SimpleWorkTypeComboBoxStyle}" />
</controls:WorkContainer.CommandBarElements>

View File

@ -29,13 +29,13 @@
VerticalAlignment="Center"
Spacing="1">
<TextBlock
FontSize="{StaticResource PixevalBaseFontSize}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.Title, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
<TextBlock
FontSize="{StaticResource PixevalCaptionFontSize}"
Foreground="{ThemeResource PixevalTipTextForeground}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.User.Name, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
@ -51,8 +51,8 @@
ShowPaused="{x:Bind ViewModel.IsPaused, Mode=OneWay}"
Value="{x:Bind ViewModel.DownloadTask.ProgressPercentage, Mode=OneWay}" />
<TextBlock
FontSize="{StaticResource PixevalSubscriptFontSize}"
Foreground="{ThemeResource PixevalTipTextForeground}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.ProgressMessage, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
@ -64,33 +64,33 @@
DefaultLabelPosition="Right"
OverflowButtonVisibility="Visible">
<!-- Width="125" 是试出来刚好只显示一个按钮的宽度 -->
<AppBarButton Label="{x:Bind ViewModel.ActionButtonContent, Mode=OneWay}" Tapped="ActionButton_OnTapped">
<AppBarButton Click="ActionButton_OnClicked" Label="{x:Bind ViewModel.ActionButtonContent, Mode=OneWay}">
<AppBarButton.Icon>
<fluent:SymbolIcon Symbol="{x:Bind ViewModel.ActionButtonSymbol, Mode=OneWay}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton
x:Uid="/DownloadListEntry/RedownloadItem"
Click="RedownloadItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=ArrowDownload}"
IsEnabled="{x:Bind ViewModel.IsRedownloadItemEnabled, Mode=OneWay}"
Tapped="RedownloadItem_OnTapped" />
IsEnabled="{x:Bind ViewModel.IsRedownloadItemEnabled, Mode=OneWay}" />
<AppBarButton
x:Uid="/DownloadListEntry/CancelDownloadItem"
Click="CancelDownloadItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=Dismiss}"
IsEnabled="{x:Bind ViewModel.IsCancelItemEnabled, Mode=OneWay}"
Tapped="CancelDownloadItem_OnTapped" />
IsEnabled="{x:Bind ViewModel.IsCancelItemEnabled, Mode=OneWay}" />
<AppBarButton
x:Uid="/DownloadListEntry/OpenDownloadLocationItem"
Icon="{fluent:SymbolIcon Symbol=FolderArrowRight}"
Tapped="OpenDownloadLocationItem_OnTapped" />
Click="OpenDownloadLocationItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=FolderArrowRight}" />
<AppBarButton
x:Uid="/DownloadListEntry/GoToPageItem"
Icon="{fluent:SymbolIcon Symbol=OpenFolder}"
Tapped="GoToPageItem_OnTapped" />
Click="GoToPageItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=OpenFolder}" />
<AppBarButton
x:Uid="/DownloadListEntry/CheckErrorMessageInDetailItem"
Click="CheckErrorMessageInDetail_OnClicked"
Icon="{fluent:SymbolIcon Symbol=DocumentError}"
IsEnabled="{x:Bind ViewModel.IsError, Mode=OneWay}"
Tapped="CheckErrorMessageInDetail_OnTapped" />
IsEnabled="{x:Bind ViewModel.IsError, Mode=OneWay}" />
</CommandBar>
</Grid>

View File

@ -48,9 +48,8 @@ public sealed partial class DownloadListEntry
public DownloadListEntry() => InitializeComponent();
private async void ActionButton_OnTapped(object sender, TappedRoutedEventArgs e)
private async void ActionButton_OnClicked(object sender, RoutedEventArgs e)
{
e.Handled = true;
switch (ViewModel.DownloadTask.CurrentState)
{
case DownloadState.Queued:
@ -79,25 +78,25 @@ public sealed partial class DownloadListEntry
}
}
private async void RedownloadItem_OnTapped(object sender, TappedRoutedEventArgs e)
private async void RedownloadItem_OnClicked(object sender, RoutedEventArgs e)
{
await ViewModel.DownloadTask.ResetAsync();
_ = App.AppViewModel.DownloadManager.TryExecuteInline(ViewModel.DownloadTask);
}
private void CancelDownloadItem_OnTapped(object sender, TappedRoutedEventArgs e)
private void CancelDownloadItem_OnClicked(object sender, RoutedEventArgs e)
{
ViewModel.DownloadTask.CancellationHandle.Cancel();
}
private async void OpenDownloadLocationItem_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenDownloadLocationItem_OnClicked(object sender, RoutedEventArgs e)
{
_ = await Launcher.LaunchFolderPathAsync(Path.GetDirectoryName(ViewModel.DownloadTask.Destination));
}
private void GoToPageItem_OnTapped(object sender, TappedRoutedEventArgs e) => OpenIllustrationRequested?.Invoke(this, ViewModel);
private void GoToPageItem_OnClicked(object sender, RoutedEventArgs e) => OpenIllustrationRequested?.Invoke(this, ViewModel);
private async void CheckErrorMessageInDetail_OnTapped(object sender, TappedRoutedEventArgs e)
private async void CheckErrorMessageInDetail_OnClicked(object sender, RoutedEventArgs e)
{
_ = await this.CreateAcknowledgementAsync(DownloadListEntryResources.ErrorMessageDialogTitle, ViewModel.DownloadTask.ErrorCause?.ToString());
}

View File

@ -44,7 +44,7 @@
VerticalAlignment="Center"
ItemsSource="{x:Bind _viewModel.FilteredTasks}"
QueryIcon="{fluent:SymbolIcon Symbol=Search,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
QuerySubmitted="FilterAutoSuggestBox_OnQuerySubmitted"
SuggestionChosen="FilterAutoSuggestBox_OnSuggestionChosen"
TextChanged="FilterAutoSuggestBox_OnTextChanged">
@ -59,32 +59,32 @@
Icon="{fluent:SymbolIcon Symbol=SelectAllOff}"
IsEnabled="{x:Bind _viewModel.IsAnyEntrySelected, Mode=OneWay}"
Label="{x:Bind _viewModel.SelectionLabel, Mode=OneWay}"
Tapped="CancelSelectButton_OnTapped" />
Click="CancelSelectButton_OnClicked" />
<AppBarButton
x:Uid="/DownloadListPage/SelectAllButton"
Icon="{fluent:SymbolIcon Symbol=SelectAllOn}"
Tapped="SelectAllButton_OnTapped" />
Click="SelectAllButton_OnClicked" />
<AppBarSeparator />
<AppBarButton
x:Uid="/DownloadListPage/ResumeButton"
Icon="{fluent:SymbolIcon Symbol=Play}"
IsEnabled="{x:Bind _viewModel.IsAnyEntrySelected, Mode=OneWay}"
Tapped="ResumeAllButton_OnTapped" />
Click="ResumeAllButton_OnClicked" />
<AppBarButton
x:Uid="/DownloadListPage/PauseButton"
Icon="{fluent:SymbolIcon Symbol=Pause}"
IsEnabled="{x:Bind _viewModel.IsAnyEntrySelected, Mode=OneWay}"
Tapped="PauseAllButton_OnTapped" />
Click="PauseAllButton_OnClicked" />
<AppBarButton
x:Uid="/DownloadListPage/StopButton"
Icon="{fluent:SymbolIcon Symbol=Stop}"
IsEnabled="{x:Bind _viewModel.IsAnyEntrySelected, Mode=OneWay}"
Tapped="CancelAllButton_OnTapped" />
Click="CancelAllButton_OnClicked" />
<AppBarButton
x:Uid="/DownloadListPage/DeleteButton"
Icon="{fluent:SymbolIcon Symbol=Delete}"
IsEnabled="{x:Bind _viewModel.IsAnyEntrySelected, Mode=OneWay}"
Tapped="ClearDownloadListButton_OnTapped" />
Click="ClearDownloadListButton_OnClicked" />
</CommandBar>
</Grid>
<controls:AdvancedItemsView

View File

@ -46,22 +46,22 @@ public sealed partial class DownloadListPage
_viewModel.ResetFilter();
}
private void PauseAllButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void PauseAllButton_OnClicked(object sender, RoutedEventArgs e)
{
_viewModel.PauseSelectedItems();
}
private void ResumeAllButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void ResumeAllButton_OnClicked(object sender, RoutedEventArgs e)
{
_viewModel.ResumeSelectedItems();
}
private void CancelAllButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void CancelAllButton_OnClicked(object sender, RoutedEventArgs e)
{
_viewModel.CancelSelectedItems();
}
private async void ClearDownloadListButton_OnTapped(object sender, TappedRoutedEventArgs e)
private async void ClearDownloadListButton_OnClicked(object sender, RoutedEventArgs e)
{
var dialogContent = new DownloadListPageDeleteTasksDialog();
if (await this.CreateOkCancelAsync(
@ -111,12 +111,12 @@ public sealed partial class DownloadListPage
}
}
private void SelectAllButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void SelectAllButton_OnClicked(object sender, RoutedEventArgs e)
{
AdvancedItemsView.SelectAll();
}
private void CancelSelectButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void CancelSelectButton_OnClicked(object sender, RoutedEventArgs e)
{
AdvancedItemsView.DeselectAll();
}

View File

@ -1,8 +1,9 @@
<controls:SupportCustomTitleBarDragRegionPage
<controls:EnhancedWindowPage
x:Class="Pixeval.Pages.IllustrationViewer.IllustrationViewerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Pixeval.Controls"
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:converters1="using:Pixeval.Controls.Converters"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
@ -13,16 +14,16 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Microsoft.Xaml.Interactions.Media"
xmlns:triggers="using:Pixeval.Util.Triggers"
xmlns:windowing="using:Pixeval.Controls.Windowing"
KeyboardAcceleratorPlacementMode="Hidden"
Loaded="IllustrationViewerPage_OnLoaded"
Unloaded="IllustrationViewerPage_OnUnloaded"
mc:Ignorable="d">
<controls:SupportCustomTitleBarDragRegionPage.Resources>
<controls:EnhancedWindowPage.Resources>
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters1:NumberToPercentageConverter x:Key="NumberToPercentageConverter" />
<converters1:NullableToVisibilityConverter x:Key="NullableToVisibilityConverter" />
<converters1:BoolNegationToVisibilityConverter x:Key="BoolNegationToVisibilityConverter" />
<converters1:DisplayIndexConverter x:Key="DisplayIndexConverter" />
<Thickness x:Key="NormalMargin">0,48,0,0</Thickness>
<AcrylicBrush
@ -33,31 +34,28 @@
TintOpacity="0.8" />
<Style
x:Key="TextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
BasedOn="{StaticResource CaptionStrongTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="HorizontalTextAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
</controls:SupportCustomTitleBarDragRegionPage.Resources>
<controls:SupportCustomTitleBarDragRegionPage.KeyboardAccelerators>
</controls:EnhancedWindowPage.Resources>
<controls:EnhancedWindowPage.KeyboardAccelerators>
<KeyboardAccelerator Key="Escape" Invoked="ExitFullScreenKeyboardAccelerator_OnInvoked" />
<KeyboardAccelerator Key="Left" Invoked="PrevButton_OnTapped" />
<KeyboardAccelerator Key="Right" Invoked="NextButton_OnTapped" />
<KeyboardAccelerator Key="Left" Invoked="PrevButton_OnClicked" />
<KeyboardAccelerator Key="Right" Invoked="NextButton_OnClicked" />
<KeyboardAccelerator Key="Up" Invoked="PrevButton_OnRightTapped" />
<KeyboardAccelerator Key="Down" Invoked="NextButton_OnRightTapped" />
</controls:SupportCustomTitleBarDragRegionPage.KeyboardAccelerators>
<controls:WorkViewerSplitView
x:Name="EntryViewerSplitView"
MenuItemsSource="{x:Bind _viewModel.Tags}"
RaiseSetTitleBarDragRegion="Placeholder_OnSizeChanged">
<controls:WorkViewerSplitView.PaneContent>
<Grid x:Name="IllustrationPresenterDockPanel" HorizontalAlignment="Stretch">
<!-- ReSharper disable once UnusedMember.Local -->
<Grid x:Name="MainPanel" Margin="{StaticResource NormalMargin}">
</controls:EnhancedWindowPage.KeyboardAccelerators>
<Grid>
<controls:WorkViewerSplitView
x:Name="EntryViewerSplitView"
Margin="{StaticResource NormalMargin}"
MenuItemsSource="{x:Bind _viewModel.Tags}">
<controls:WorkViewerSplitView.PaneContent>
<Grid>
<Frame
x:Name="IllustrationImageShowcaseFrame"
HorizontalAlignment="Stretch"
@ -73,16 +71,16 @@
<controls:PageButton
Grid.Column="0"
Width="150"
ButtonClick="PrevButton_OnClicked"
ButtonRightTapped="PrevButton_OnRightTapped"
ButtonTapped="PrevButton_OnTapped"
ButtonVisibility="{x:Bind _viewModel.PrevButtonText, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneWay}"
IsPrev="True"
ToolTip="{x:Bind _viewModel.PrevButtonText, Mode=OneWay}" />
<controls:PageButton
Grid.Column="2"
Width="150"
ButtonClick="NextButton_OnClicked"
ButtonRightTapped="NextButton_OnRightTapped"
ButtonTapped="NextButton_OnTapped"
ButtonVisibility="{x:Bind _viewModel.NextButtonText, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneWay}"
IsPrev="False"
ToolTip="{x:Bind _viewModel.NextButtonText, Mode=OneWay}" />
@ -230,122 +228,116 @@
</Grid>
</StackPanel>
</Grid>
<!-- ReSharper disable once UnusedMember.Local -->
<Grid
x:Name="TitleBarBorder"
Height="100"
VerticalAlignment="Top">
<interactivity:Interaction.Behaviors>
<triggers:EventWithConditionTriggerBehavior EventName="PointerEntered" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="0">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
<triggers:EventWithConditionTriggerBehavior EventName="PointerExited" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="{StaticResource NegativeTitleBarHeight}">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
</interactivity:Interaction.Behaviors>
<!-- ReSharper disable once UnusedMember.Local -->
<Grid
x:Name="TitleBarArea"
Height="{StaticResource TitleBarHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top">
<Grid.RenderTransform>
<TranslateTransform x:Name="TopCommandBarTranslation" />
</Grid.RenderTransform>
</controls:WorkViewerSplitView.PaneContent>
</controls:WorkViewerSplitView>
<!-- ReSharper disable once UnusedMember.Local -->
<Grid
x:Name="TitleBarBorder"
Height="100"
VerticalAlignment="Top">
<interactivity:Interaction.Behaviors>
<triggers:EventWithConditionTriggerBehavior EventName="PointerEntered" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="0">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
<triggers:EventWithConditionTriggerBehavior EventName="PointerExited" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="{StaticResource NegativeTitleBarHeight}">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
</interactivity:Interaction.Behaviors>
<!-- ReSharper disable once UnusedMember.Local -->
<controls1:TitleBar
x:Name="TitleBarArea"
Title="{x:Bind _viewModel.CurrentIllustration.Title, Mode=OneWay}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
CompactStateBreakpoint="1120"
DisplayMode="Tall"
Window="{x:Bind windowing:WindowFactory.GetForkedWindows(HWnd)}">
<controls1:TitleBar.Icon>
<ImageIcon Source="ms-appx:///Assets/Images/logo.svg" />
</controls1:TitleBar.Icon>
<controls1:TitleBar.RenderTransform>
<TranslateTransform x:Name="TopCommandBarTranslation" />
</controls1:TitleBar.RenderTransform>
<controls1:TitleBar.Content>
<CommandBar Margin="0,-4" DefaultLabelPosition="Collapsed">
<AppBarToggleButton
Command="{x:Bind _viewModel.InfoAndCommentsCommand}"
IsChecked="{x:Bind EntryViewerSplitView.IsPaneOpen, Mode=TwoWay}"
RightTapped="OpenPane_OnRightTapped" />
<AppBarButton Command="{x:Bind _viewModel.CurrentImage.PlayGifCommand, Mode=OneWay}" Visibility="{x:Bind _viewModel.CurrentIllustration.IsUgoira, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" />
<AppBarSeparator />
<AppBarButton
Command="{x:Bind _viewModel.CurrentPage.CopyCommand, Mode=OneWay}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}"
IsEnabled="{x:Bind _viewModel.CurrentImage.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentPage.SaveCommand, Mode=OneWay}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}"
IsEnabled="{x:Bind _viewModel.CurrentImage.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentPage.SaveAsCommand, Mode=OneWay}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}"
IsEnabled="{x:Bind _viewModel.CurrentImage.LoadSuccessfully, Mode=OneWay}" />
<AppBarSeparator />
<AppBarButton Command="{x:Bind _viewModel.CurrentImage.SetAsCommand, Mode=OneWay}">
<AppBarButton.Flyout>
<MenuFlyout>
<MenuFlyoutItem Command="{x:Bind _viewModel.CurrentImage.SetAsBackgroundCommand, Mode=OneWay}" />
<MenuFlyoutItem Command="{x:Bind _viewModel.CurrentImage.SetAsLockScreenCommand, Mode=OneWay}" />
</MenuFlyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarSeparator />
<AppBarButton
x:Name="AddToBookmarkButton"
Click="AddToBookmarkButton_OnClicked"
Command="{x:Bind _viewModel.AddToBookmarkCommand}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentIllustration.GenerateLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentIllustration.GenerateWebLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentIllustration.OpenInWebBrowserCommand, Mode=OneWay}" />
<AppBarButton
x:Name="ShowQrCodeButton"
Command="{x:Bind _viewModel.CurrentIllustration.ShowQrCodeCommand, Mode=OneWay}"
CommandParameter="{x:Bind ShowQrCodeTeachingTip}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentImage.ShareCommand, Mode=OneWay}" />
</CommandBar>
</controls1:TitleBar.Content>
<controls1:TitleBar.Footer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<!-- ReSharper disable once UnusedMember.Local -->
<ColumnDefinition x:Name="TitleControlButtonsColumn" Width="150" />
</Grid.ColumnDefinitions>
<controls:TitleBarIconText
x:Name="TitleBar"
Title="{x:Bind _viewModel.CurrentIllustration.Title, Mode=OneWay}"
Grid.Column="0"
Visibility="{x:Bind EntryViewerSplitView.PinPane, Converter={StaticResource BoolNegationToVisibilityConverter}, Mode=OneWay}" />
<Rectangle
Grid.Column="1"
HorizontalAlignment="Stretch"
SizeChanged="Placeholder_OnSizeChanged" />
<CommandBar
x:Name="IllustrationViewerCommandBar"
Grid.Column="1"
HorizontalAlignment="Center"
DefaultLabelPosition="Collapsed">
<AppBarToggleButton
Command="{x:Bind _viewModel.InfoAndCommentsCommand}"
IsChecked="{x:Bind EntryViewerSplitView.IsPaneOpen, Mode=TwoWay}"
RightTapped="OpenPane_OnRightTapped" />
<AppBarButton Command="{x:Bind _viewModel.CurrentImage.PlayGifCommand, Mode=OneWay}" Visibility="{x:Bind _viewModel.CurrentIllustration.IsUgoira, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" />
<AppBarSeparator />
<AppBarButton
Command="{x:Bind _viewModel.CurrentPage.CopyCommand, Mode=OneWay}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}"
IsEnabled="{x:Bind _viewModel.CurrentImage.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentPage.SaveCommand, Mode=OneWay}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}"
IsEnabled="{x:Bind _viewModel.CurrentImage.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentPage.SaveAsCommand, Mode=OneWay}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}"
IsEnabled="{x:Bind _viewModel.CurrentImage.LoadSuccessfully, Mode=OneWay}" />
<AppBarSeparator />
<AppBarButton Command="{x:Bind _viewModel.CurrentImage.SetAsCommand, Mode=OneWay}">
<AppBarButton.Flyout>
<MenuFlyout>
<MenuFlyoutItem Command="{x:Bind _viewModel.CurrentImage.SetAsBackgroundCommand, Mode=OneWay}" />
<MenuFlyoutItem Command="{x:Bind _viewModel.CurrentImage.SetAsLockScreenCommand, Mode=OneWay}" />
</MenuFlyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarSeparator />
<AppBarButton
x:Name="AddToBookmarkButton"
Command="{x:Bind _viewModel.AddToBookmarkCommand}"
CommandParameter="{x:Bind _viewModel.CurrentImage.DownloadParameter, Mode=OneWay}"
Tapped="AddToBookmarkButton_OnTapped" />
<AppBarButton Command="{x:Bind _viewModel.CurrentIllustration.GenerateLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentIllustration.GenerateWebLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentIllustration.OpenInWebBrowserCommand, Mode=OneWay}" />
<AppBarButton
x:Name="ShowQrCodeButton"
Command="{x:Bind _viewModel.CurrentIllustration.ShowQrCodeCommand, Mode=OneWay}"
CommandParameter="{x:Bind ShowQrCodeTeachingTip}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentImage.ShareCommand, Mode=OneWay}" />
</CommandBar>
<TextBlock
Grid.Column="2"
Grid.Column="0"
Style="{StaticResource TextBlockStyle}"
Visibility="{x:Bind _viewModel.CurrentIllustration.IsManga, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
<Run Text="{x:Bind _viewModel.CurrentPageIndex, Converter={StaticResource DisplayIndexConverter}, Mode=OneWay}" />
@ -354,7 +346,8 @@
</TextBlock>
<CommandBar
x:Name="IllustrationViewerSubCommandBar"
Grid.Column="3"
Grid.Column="1"
Margin="0,-4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
DefaultLabelPosition="Collapsed">
@ -364,40 +357,38 @@
<AppBarButton Command="{x:Bind _viewModel.CurrentImage.ZoomInCommand, Mode=OneWay}" />
</CommandBar>
<TextBlock
Grid.Column="4"
Grid.Column="2"
Width="60"
Margin="-5,-3,0,0"
Style="{StaticResource TextBlockStyle}"
Text="{x:Bind _viewModel.CurrentImage.Scale, Converter={StaticResource NumberToPercentageConverter}, ConverterParameter=2, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind _viewModel.CurrentImage.Scale, Converter={StaticResource NumberToPercentageConverter}, ConverterParameter=2, Mode=OneWay}" />
<TeachingTip
x:Name="ShowQrCodeTeachingTip"
x:Uid="/EntryViewerPage/QrCodeTeachingTip"
Grid.Column="0"
IsLightDismissEnabled="True"
Tag="{x:Bind ShowQrCodeButton}">
<TeachingTip.HeroContent>
<Image Loading="Content_OnLoading" Tag="{x:Bind ShowQrCodeTeachingTip}" />
</TeachingTip.HeroContent>
</TeachingTip>
<TeachingTip
x:Name="AddToBookmarkTeachingTip"
x:Uid="/EntryViewerPage/AddToBookmarkTeachingTip"
Grid.Column="0"
CloseButtonClick="AddToBookmarkTeachingTip_OnCloseButtonClick"
IsLightDismissEnabled="True"
Tag="{x:Bind AddToBookmarkButton}">
<flyoutContent:BookmarkTagSelector
x:Name="BookmarkTagSelector"
MaxHeight="{StaticResource TeachingTipContentMaxHeightWithTarget}"
Loading="Content_OnLoading"
Tag="{x:Bind AddToBookmarkTeachingTip}"
Type="IllustAndManga" />
</TeachingTip>
</Grid>
</Grid>
</Grid>
</controls:WorkViewerSplitView.PaneContent>
</controls1:TitleBar.Footer>
</controls1:TitleBar>
</Grid>
<TeachingTip
x:Name="ShowQrCodeTeachingTip"
x:Uid="/EntryViewerPage/QrCodeTeachingTip"
IsLightDismissEnabled="True"
Tag="{x:Bind ShowQrCodeButton}">
<TeachingTip.HeroContent>
<Image Loading="Content_OnLoading" Tag="{x:Bind ShowQrCodeTeachingTip}" />
</TeachingTip.HeroContent>
</TeachingTip>
<TeachingTip
x:Name="AddToBookmarkTeachingTip"
x:Uid="/EntryViewerPage/AddToBookmarkTeachingTip"
CloseButtonClick="AddToBookmarkTeachingTip_OnCloseButtonClick"
IsLightDismissEnabled="True"
Tag="{x:Bind AddToBookmarkButton}">
<flyoutContent:BookmarkTagSelector
x:Name="BookmarkTagSelector"
MaxHeight="{StaticResource TeachingTipContentMaxHeightWithTarget}"
Loading="Content_OnLoading"
Tag="{x:Bind AddToBookmarkTeachingTip}"
Type="IllustAndManga" />
</TeachingTip>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="Normal">
@ -405,9 +396,8 @@
<StateTrigger IsActive="{x:Bind _viewModel.IsFullScreen, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="MainPanel.Margin" Value="{StaticResource NormalMargin}" />
<Setter Target="EntryViewerSplitView.Margin" Value="{StaticResource NormalMargin}" />
<Setter Target="TopCommandBarTranslation.Y" Value="0" />
<Setter Target="TitleControlButtonsColumn.Width" Value="150" />
<Setter Target="TitleBarArea.Background" Value="{x:Null}" />
<Setter Target="TitleBarBorder.Background" Value="{x:Null}" />
</VisualState.Setters>
@ -417,14 +407,13 @@
<StateTrigger IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="MainPanel.Margin" Value="0" />
<Setter Target="EntryViewerSplitView.Margin" Value="0" />
<Setter Target="TopCommandBarTranslation.Y" Value="{StaticResource NegativeTitleBarHeight}" />
<Setter Target="TitleControlButtonsColumn.Width" Value="0" />
<Setter Target="TitleBarArea.Background" Value="{StaticResource PixevalAppAcrylicBrush}" />
<Setter Target="TitleBarBorder.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</controls:WorkViewerSplitView>
</controls:SupportCustomTitleBarDragRegionPage>
</Grid>
</controls:EnhancedWindowPage>

View File

@ -22,9 +22,7 @@ using System;
using System.Numerics;
using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;
using Windows.Graphics;
using Windows.Storage;
using Microsoft.UI.Input;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
@ -42,7 +40,7 @@ using Pixeval.Controls.Windowing;
namespace Pixeval.Pages.IllustrationViewer;
public sealed partial class IllustrationViewerPage : SupportCustomTitleBarDragRegionPage
public sealed partial class IllustrationViewerPage
{
private bool _pointerNotInArea = true;
@ -74,21 +72,6 @@ public sealed partial class IllustrationViewerPage : SupportCustomTitleBarDragRe
}
}
protected override void SetTitleBarDragRegion(InputNonClientPointerSource sender, SizeInt32 windowSize, double scaleFactor, out int titleBarHeight)
{
if (_viewModel.IsFullScreen)
{
titleBarHeight = 0;
return;
}
var leftIndent = new RectInt32(0, 0, EntryViewerSplitView.IsPaneOpen ? (int)WorkViewerSplitView.OpenPaneLength : 0, (int)TitleBarArea.ActualHeight);
if (TitleBar.Visibility is Visibility.Visible)
sender.SetRegionRects(NonClientRegionKind.Icon, [GetScaledRect(TitleBar.Icon)]);
sender.SetRegionRects(NonClientRegionKind.Passthrough, [GetScaledRect(leftIndent), GetScaledRect(IllustrationViewerCommandBar), GetScaledRect(IllustrationViewerSubCommandBar)]);
titleBarHeight = 48;
}
public override void OnPageActivated(NavigationEventArgs e, object? parameter)
{
// 此处this.XamlRoot为null
@ -132,8 +115,6 @@ public sealed partial class IllustrationViewerPage : SupportCustomTitleBarDragRe
{
var window = WindowFactory.ForkedWindows[HWnd];
window.AppWindow.SetPresenter(vm.IsFullScreen ? AppWindowPresenterKind.FullScreen : AppWindowPresenterKind.Default);
// 加载完之后设置标题栏
_ = Task.Delay(500).ContinueWith(_ => RaiseSetTitleBarDragRegion(window), TaskScheduler.FromCurrentSynchronizationContext());
break;
}
}
@ -199,9 +180,9 @@ public sealed partial class IllustrationViewerPage : SupportCustomTitleBarDragRe
HWnd.SuccessGrowl(EntryViewerPageResources.AddedToBookmark);
}
private void AddToBookmarkButton_OnTapped(object sender, TappedRoutedEventArgs e) => AddToBookmarkTeachingTip.IsOpen = true;
private void AddToBookmarkButton_OnClicked(object sender, RoutedEventArgs e) => AddToBookmarkTeachingTip.IsOpen = true;
private void NextButton_OnTapped(object sender, IWinRTObject e)
private void NextButton_OnClicked(object sender, IWinRTObject e)
{
switch (_viewModel.NextButtonAction)
{
@ -218,7 +199,7 @@ public sealed partial class IllustrationViewerPage : SupportCustomTitleBarDragRe
++ThumbnailItemsView.SelectedIndex;
}
private void PrevButton_OnTapped(object sender, IWinRTObject e)
private void PrevButton_OnClicked(object sender, IWinRTObject e)
{
switch (_viewModel.PrevButtonAction)
{
@ -240,15 +221,13 @@ public sealed partial class IllustrationViewerPage : SupportCustomTitleBarDragRe
e.Handled = true;
switch (e.Key)
{
case VirtualKey.Left: PrevButton_OnTapped(null!, null!); break;
case VirtualKey.Right: NextButton_OnTapped(null!, null!); break;
case VirtualKey.Left: PrevButton_OnClicked(null!, null!); break;
case VirtualKey.Right: NextButton_OnClicked(null!, null!); break;
case VirtualKey.Up: PrevButton_OnRightTapped(null!, null!); break;
case VirtualKey.Down: NextButton_OnRightTapped(null!, null!); break;
}
}
private void Placeholder_OnSizeChanged(object sender, object e) => RaiseSetTitleBarDragRegion(WindowFactory.ForkedWindows[HWnd]);
private async void IllustrationImageShowcaseFrame_OnTapped(object sender, TappedRoutedEventArgs e)
{
BottomCommandSection.Translation = new Vector3();
@ -264,5 +243,5 @@ public sealed partial class IllustrationViewerPage : SupportCustomTitleBarDragRe
teachingTip.Target = appBarButton.IsInOverflow ? null : appBarButton;
}
private void OpenPane_OnRightTapped(object sender, RightTappedRoutedEventArgs rightTappedRoutedEventArgs) => EntryViewerSplitView.PinPane = true;
private void OpenPane_OnRightTapped(object sender, RightTappedRoutedEventArgs e) => EntryViewerSplitView.PinPane = true;
}

View File

@ -60,7 +60,7 @@
Command="{x:Bind _viewModel.ShowQrCodeCommand}"
x:Uid="/ImageViewerPage/ShowQRCode"
Icon="{ui:FontIcon Glyph=QRCodeED14}"
Tapped="ShowQrCodeCommandOnExecuteRequested" />-->
Click="ShowQrCodeCommandOnExecuteRequested" />-->
</CommandBarFlyout.SecondaryCommands>
</CommandBarFlyout>
</controls:ZoomableImage.ContextFlyout>
@ -76,7 +76,7 @@
Height="50"
IsIndeterminate="False"
Value="{x:Bind _viewModel.LoadingProgress, Mode=OneWay}" />
<TextBlock FontSize="{StaticResource PixevalSubscriptFontSize}" Text="{x:Bind _viewModel.LoadingText, Mode=OneWay}" />
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="{x:Bind _viewModel.LoadingText, Mode=OneWay}" />
</StackPanel>
</Grid>
</Grid>

View File

@ -405,7 +405,7 @@ public partial class ImageViewerPageViewModel : UiObservableObject, IDisposable
public (ulong, GetImageStream) DownloadParameter => (HWnd, GetImageStreamAsync);
public XamlUICommand PlayGifCommand { get; } = "".GetCommand(Symbol.Stop);
public XamlUICommand PlayGifCommand { get; } = "".GetCommand(Symbol.Pause);
public XamlUICommand ZoomOutCommand { get; } = EntryViewerPageResources.ZoomOut.GetCommand(
Symbol.ZoomOut, VirtualKey.Subtract);

View File

@ -85,7 +85,7 @@
<TextBlock
x:Name="Blurb"
Grid.Row="2"
FontSize="16"
FontSize="{StaticResource SmallIconFontSize}"
IsTextSelectionEnabled="True"
MaxLines="3"
Text="{x:Bind _viewModel.Comment}"
@ -115,7 +115,7 @@
<StackPanel Padding="5,0" Spacing="2">
<TextBlock
MaxWidth="80"
Style="{StaticResource ContentStrongTextBlockStyle}"
Style="{StaticResource CaptionStrongTextBlockStyle}"
Text="{x:Bind _viewModel.Name}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />

View File

@ -24,6 +24,7 @@
Title="{x:Bind app:AppInfo.AppIdentifier}"
VerticalAlignment="Top"
controls2:DockPanel.Dock="Top"
DisplayMode="Tall"
Window="{x:Bind windowing:WindowFactory.GetForkedWindows(HWnd)}">
<controls2:TitleBar.Icon>
<ImageIcon Source="ms-appx:///Assets/Images/logo.svg" />
@ -52,7 +53,7 @@
Visibility="{x:Bind _viewModel.ProcessingRingVisible, Mode=OneWay}" />
<TextBlock
HorizontalAlignment="Center"
FontSize="10"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind util:LocalizedResourceAttributeHelper.GetLocalizedResourceContent(_viewModel.LoginPhase), Mode=OneWay}" />
</StackPanel>
<controls2:DockPanel Grid.Column="1" LastChildFill="False">
@ -81,20 +82,20 @@
x:Uid="/LoginPage/SubmitButton"
Height="33"
controls2:DockPanel.Dock="Right"
Click="TokenLogin_OnTapped"
Click="TokenLogin_OnClicked"
IsEnabled="{x:Bind _viewModel.IsEnabled, Mode=OneWay}" />
<ToggleSwitch x:Uid="/LoginPage/DisableDomainFrontingToggleSwitch" IsOn="{x:Bind _viewModel.EnableDomainFronting, Mode=TwoWay}" />
</controls2:DockPanel>
<HyperlinkButton
x:Uid="/LoginPage/BrowserButton"
controls2:DockPanel.Dock="Top"
Tag="{x:Bind local:LoginPage.Browser}"
Tapped="SwitchPresenterButton_OnTapped" />
Click="SwitchPresenterButton_OnClicked"
Tag="{x:Bind local:LoginPage.Browser}" />
<HyperlinkButton
x:Uid="/LoginPage/WebViewButton"
controls2:DockPanel.Dock="Top"
Tag="{x:Bind local:LoginPage.WebView}"
Tapped="SwitchPresenterButton_OnTapped" />
Click="SwitchPresenterButton_OnClicked"
Tag="{x:Bind local:LoginPage.WebView}" />
</controls2:DockPanel>
</controls2:Case>
<controls2:Case Value="{x:Bind local:LoginPage.Browser}">
@ -118,19 +119,19 @@
x:Uid="/LoginPage/SubmitButton"
Height="33"
controls2:DockPanel.Dock="Right"
Tapped="BrowserLogin_OnTapped" />
Click="BrowserLogin_OnClicked" />
<ToggleSwitch x:Uid="/LoginPage/DisableDomainFrontingToggleSwitch" IsOn="{x:Bind _viewModel.EnableDomainFronting, Mode=TwoWay}" />
</controls2:DockPanel>
<HyperlinkButton
x:Uid="/LoginPage/RefreshTokenButton"
controls2:DockPanel.Dock="Top"
Tag="{x:Bind local:LoginPage.RefreshToken}"
Tapped="SwitchPresenterButton_OnTapped" />
Click="SwitchPresenterButton_OnClicked"
Tag="{x:Bind local:LoginPage.RefreshToken}" />
<HyperlinkButton
x:Uid="/LoginPage/WebViewButton"
controls2:DockPanel.Dock="Top"
Tag="{x:Bind local:LoginPage.WebView}"
Tapped="SwitchPresenterButton_OnTapped" />
Click="SwitchPresenterButton_OnClicked"
Tag="{x:Bind local:LoginPage.WebView}" />
</controls2:DockPanel>
</controls2:Case>
<controls2:Case Value="{x:Bind local:LoginPage.WebView}">
@ -139,7 +140,7 @@
LastChildFill="False"
VerticalSpacing="10">
<controls2:DockPanel.KeyboardAccelerators>
<KeyboardAccelerator Key="Enter" Invoked="WebViewLogin_OnTapped" />
<KeyboardAccelerator Key="Enter" Invoked="WebViewLogin_OnClicked" />
</controls2:DockPanel.KeyboardAccelerators>
<InfoBar
x:Uid="/LoginPage/WebViewLoginTip"
@ -166,10 +167,10 @@
x:Uid="/LoginPage/SubmitButton"
Height="33"
controls2:DockPanel.Dock="Right"
Click="WebViewLogin_OnTapped">
Click="WebViewLogin_OnClicked">
<SplitButton.Flyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="/LoginPage/SubmitWithNewAccountButton" Click="WebViewLoginNewAccount_OnTapped" />
<MenuFlyoutItem x:Uid="/LoginPage/SubmitWithNewAccountButton" Click="WebViewLoginNewAccount_OnClicked" />
</MenuFlyout>
</SplitButton.Flyout>
</SplitButton>
@ -178,13 +179,13 @@
<HyperlinkButton
x:Uid="/LoginPage/RefreshTokenButton"
controls2:DockPanel.Dock="Top"
Tag="{x:Bind local:LoginPage.RefreshToken}"
Tapped="SwitchPresenterButton_OnTapped" />
Click="SwitchPresenterButton_OnClicked"
Tag="{x:Bind local:LoginPage.RefreshToken}" />
<HyperlinkButton
x:Uid="/LoginPage/BrowserButton"
controls2:DockPanel.Dock="Top"
Tag="{x:Bind local:LoginPage.Browser}"
Tapped="SwitchPresenterButton_OnTapped" />
Click="SwitchPresenterButton_OnClicked"
Tag="{x:Bind local:LoginPage.Browser}" />
</controls2:DockPanel>
</controls2:Case>
</controls2:SwitchPresenter>

View File

@ -121,25 +121,25 @@ public sealed partial class LoginPage
AppInfo.SaveContext();
}
private void SwitchPresenterButton_OnTapped(object sender, TappedRoutedEventArgs e) => SwitchPresenter.Value = sender.To<FrameworkElement>().GetTag<string>();
private void SwitchPresenterButton_OnClicked(object sender, RoutedEventArgs e) => SwitchPresenter.Value = sender.To<FrameworkElement>().GetTag<string>();
#region Token
private void TokenLogin_OnTapped(object sender, object e) => Refresh(_viewModel.RefreshToken);
private void TokenLogin_OnClicked(object sender, object e) => Refresh(_viewModel.RefreshToken);
#endregion
#region Browser
private void BrowserLogin_OnTapped(object sender, RoutedEventArgs e) => _viewModel.BrowserLogin();
private void BrowserLogin_OnClicked(object sender, RoutedEventArgs e) => _viewModel.BrowserLogin();
#endregion
#region WebView
private async void WebViewLogin_OnTapped(object sender, object e) => await WebView2LoginAsync(false);
private async void WebViewLogin_OnClicked(object sender, object e) => await WebView2LoginAsync(false);
private async void WebViewLoginNewAccount_OnTapped(object sender, RoutedEventArgs e) => await WebView2LoginAsync(true);
private async void WebViewLoginNewAccount_OnClicked(object sender, RoutedEventArgs e) => await WebView2LoginAsync(true);
private async Task WebView2LoginAsync(bool useNewAccount)
{

View File

@ -2,7 +2,6 @@
x:Class="Pixeval.Pages.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedVisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:controls="using:Pixeval.Controls"
xmlns:controls2="using:CommunityToolkit.WinUI.Controls"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
@ -36,14 +35,14 @@
Spacing="1">
<TextBlock
MaxHeight="35"
FontSize="{StaticResource PixevalBaseFontSize}"
Style="{StaticResource BodyTextBlockStyle}"
Text="{x:Bind Name}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords" />
<TextBlock
MaxHeight="15"
FontSize="{StaticResource PixevalCaptionFontSize}"
Foreground="{ThemeResource PixevalTipTextForeground}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind TranslatedName}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords"
@ -159,8 +158,7 @@
VerticalAlignment="Top"
DisplayMode="Tall"
IsPaneButtonVisible="True"
PaneButtonClick="TitleBar_OnPaneButtonClick"
Visibility="{x:Bind pixeval:AppInfo.CustomizeTitleBarSupported, Converter={StaticResource BoolToVisibilityConverter}}"
PaneButtonClick="TitleBar_OnPaneButtonClicked"
Window="{x:Bind windowing:WindowFactory.GetForkedWindows(HWnd)}">
<controls2:TitleBar.Icon>
<ImageIcon Source="ms-appx:///Assets/Images/logo.svg" />
@ -192,7 +190,7 @@
ItemsSource="{x:Bind _viewModel.SuggestionProvider.Suggestions, Mode=OneWay}"
KeyDown="KeywordAutoSuggestionBox_OnKeyDown"
QueryIcon="{fluent:SymbolIcon Symbol=Search,
Size=Small}"
FontSize={StaticResource SmallIconFontSize}}"
QuerySubmitted="KeywordAutoSuggestBox_QuerySubmitted"
SuggestionChosen="KeywordAutoSuggestBox_OnSuggestionChosen"
TextChanged="KeywordAutoSuggestBox_OnTextChanged">
@ -209,12 +207,12 @@
OverflowButtonVisibility="Collapsed">
<AppBarButton
x:Uid="/MainPage/ReverseSearchButton"
Content="{fluent:SymbolIcon Symbol=ImageSearch}"
Tapped="ReverseSearchButton_OnTapped" />
Click="ReverseSearchButton_OnClicked"
Content="{fluent:SymbolIcon Symbol=ImageSearch}" />
<AppBarButton
x:Uid="/MainPage/OpenSearchSettingButton"
Content="{fluent:SymbolIcon Symbol=Settings}"
Tapped="OpenSearchSettingButton_OnTapped" />
Click="OpenSearchSettingButton_OnClicked"
Content="{fluent:SymbolIcon Symbol=Settings}" />
</CommandBar>
</Grid>
</controls2:TitleBar.Content>

View File

@ -255,7 +255,7 @@ public sealed partial class MainPage
NavigationView.SelectedItem = null;
}
private async void OpenSearchSettingButton_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenSearchSettingButton_OnClicked(object sender, RoutedEventArgs e)
{
await NavigateToSettingEntryAsync(ReverseSearchApiKeyAttribute.Value);
}
@ -301,7 +301,7 @@ public sealed partial class MainPage
}
}
private async void ReverseSearchButton_OnTapped(object sender, TappedRoutedEventArgs e)
private async void ReverseSearchButton_OnClicked(object sender, RoutedEventArgs e)
{
if (App.AppViewModel.AppSettings.ReverseSearchApiKey is { Length: > 0 })
{
@ -349,12 +349,12 @@ public sealed partial class MainPage
}
}
private async void SelfAvatar_OnTapped(object sender, TappedRoutedEventArgs e)
private async void SelfAvatar_OnTapped(object sender, RoutedEventArgs e)
{
await IllustratorViewerHelper.CreateWindowWithPageAsync(App.AppViewModel.PixivUid);
}
private void TitleBar_OnPaneButtonClick(object? sender, RoutedEventArgs e)
private void TitleBar_OnPaneButtonClicked(object? sender, RoutedEventArgs e)
{
NavigationView.IsPaneOpen = !NavigationView.IsPaneOpen;
}

View File

@ -22,7 +22,7 @@
<TextBlock x:Uid="/AboutPage/SpecialThanksSubtitleTextBlock" Style="{StaticResource SubtitleTextBlockStyle}" />
<TextBlock
x:Uid="/AboutPage/SpecialThanksContentTextBlock"
FontSize="{StaticResource PixevalContentFontSize}"
Style="{StaticResource CaptionTextBlockStyle}"
TextWrapping="Wrap" />
<controls:UniformGrid
x:Name="UniformGrid"
@ -54,7 +54,7 @@
<TextBlock
x:Uid="/AboutPage/DependenciesContentTextBlock"
Margin="0,10"
FontSize="{StaticResource PixevalContentFontSize}"
Style="{StaticResource CaptionTextBlockStyle}"
TextWrapping="Wrap" />
<ItemsRepeater ItemsSource="{x:Bind local:DependencyViewModel.DependencyViewModels}">
<ItemsRepeater.Layout>
@ -65,9 +65,9 @@
<controls:SettingsCard
MinHeight="0"
ActionIcon="{fluent:SymbolIcon Symbol=Open}"
Click="LaunchUri"
IsClickEnabled="True"
Tag="{x:Bind Url}"
Tapped="LaunchUri">
Tag="{x:Bind Url}">
<controls:SettingsCard.Header>
<TextBlock>
<Run FontWeight="Bold" Text="{x:Bind Name}" />
@ -82,7 +82,7 @@
</StackPanel>
<StackPanel Spacing="10">
<TextBlock x:Uid="/AboutPage/SupportMeSubtitleTextBlock" Style="{StaticResource SubtitleTextBlockStyle}" />
<TextBlock FontSize="{StaticResource PixevalContentFontSize}" TextWrapping="Wrap">
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="Wrap">
<Run x:Uid="/AboutPage/SupportMeContentPartI" />
<Hyperlink NavigateUri="https://afdian.net/@dylech30th">
<Hyperlink.Inlines>
@ -94,7 +94,7 @@
</StackPanel>
<StackPanel Spacing="10">
<TextBlock x:Uid="/AboutPage/OpenSourceLicenseSubtitleTextBlock" Style="{StaticResource SubtitleTextBlockStyle}" />
<TextBlock FontSize="{StaticResource PixevalContentFontSize}" TextWrapping="Wrap">
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="Wrap">
<Run x:Uid="/AboutPage/OpenSourceLicenseContentPartI" />
<Hyperlink NavigateUri="https://www.gnu.org/licenses/gpl-3.0.en.html">
<Hyperlink.Inlines>

View File

@ -62,7 +62,7 @@ public sealed partial class AboutPage
}
}
private async void LaunchUri(object sender, TappedRoutedEventArgs e)
private async void LaunchUri(object sender, RoutedEventArgs e)
{
_ = await Launcher.LaunchUriAsync(new Uri(sender.To<FrameworkElement>().GetTag<string>()));
}

View File

@ -13,7 +13,7 @@
<controls2:EnhancedPage.Resources>
<Style
x:Key="HelpHeaderTextBlockStyle"
BasedOn="{StaticResource SubSubtitleTextBlockStyle}"
BasedOn="{StaticResource SubtitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="0,10" />
</Style>

View File

@ -87,7 +87,7 @@
<HyperlinkButton
Padding="0"
Content="{x:Bind appManagement:AppInfo.AppVersion.CurrentVersion}"
Tapped="ReleaseNotesHyperlink_OnTapped" />
Click="ReleaseNotesHyperlink_OnClicked" />
</controls:SettingsExpander.Header>
<controls:SettingsExpander.Description>
<StackPanel Spacing="3">
@ -111,7 +111,7 @@
<Button
x:Uid="/SettingsPage/CheckForUpdatesButton"
IsEnabled="{x:Bind ViewModel.CheckingUpdate, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Tapped="CheckForUpdateButton_OnTapped" />
Click="CheckForUpdateButton_OnClicked" />
</StackPanel>
<controls:SettingsExpander.Items>
<controls:SettingsCard
@ -120,20 +120,20 @@
HeaderIcon="{fluent:SymbolIcon Symbol=FolderLightning}"
IsClickEnabled="True"
Tag="Temp"
Tapped="OpenFolder_OnTapped" />
Click="OpenFolder_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/MsStoreCheckForUpdatesEntry"
Description="ms-windows-store://pdp/?ProductId=9P1RZL9Z8454"
HeaderIcon="{fluent:SymbolIcon Symbol=StoreMicrosoft}"
IsClickEnabled="True"
Tag="ms-windows-store://pdp/?ProductId=9P1RZL9Z8454"
Tapped="OpenLinkViaTag_OnTapped" />
Click="OpenLinkViaTag_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/GitHubCheckForUpdatesEntry"
Description="https://github.com/Pixeval/Pixeval/releases"
IsClickEnabled="True"
Tag="https://github.com/Pixeval/Pixeval/releases"
Tapped="OpenLinkViaTag_OnTapped">
Click="OpenLinkViaTag_OnClicked">
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="{x:Bind pixeval:SvgResources.GitHub}" />
</controls:SettingsCard.HeaderIcon>
@ -151,7 +151,7 @@
<HyperlinkButton
x:Uid="/SettingsPage/ReleaseNotesHyperlinkButton"
Tag="Newest"
Tapped="ReleaseNotesHyperlink_OnTapped"
Click="ReleaseNotesHyperlink_OnClicked"
Visibility="{x:Bind ViewModel.NewestVersion, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneWay}" />
</InfoBar.ActionButton>
</InfoBar>
@ -170,7 +170,7 @@
<AppBarButton
x:Uid="/SettingsPage/GitHubBugReportEntry"
Tag="https://github.com/Pixeval/Pixeval/issues/new/choose"
Tapped="OpenLinkViaTag_OnTapped">
Click="OpenLinkViaTag_OnClicked">
<AppBarButton.Icon>
<PathIcon Data="{x:Bind pixeval:SvgResources.GitHub}" />
</AppBarButton.Icon>
@ -179,11 +179,11 @@
x:Uid="/SettingsPage/EMailBugReportEntry"
Icon="{fluent:SymbolIcon Symbol=Mail}"
Tag="mailto:decem0730@hotmail.com"
Tapped="OpenLinkViaTag_OnTapped" />
Click="OpenLinkViaTag_OnClicked" />
<AppBarButton
x:Uid="/SettingsPage/QQBugReportEntry"
Tag="https://jq.qq.com/?_wv=1027&amp;k=trDeCrog"
Tapped="OpenLinkViaTag_OnTapped">
Click="OpenLinkViaTag_OnClicked">
<AppBarButton.Icon>
<PathIcon Data="{x:Bind pixeval:SvgResources.QQ}" />
</AppBarButton.Icon>
@ -196,28 +196,28 @@
HeaderIcon="{fluent:SymbolIcon Symbol=FolderList}"
IsClickEnabled="True"
Tag="Log"
Tapped="OpenFolder_OnTapped" />
Click="OpenFolder_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/OpenTempEntry"
ActionIcon="{fluent:SymbolIcon Symbol=Open}"
HeaderIcon="{fluent:SymbolIcon Symbol=FolderLightning}"
IsClickEnabled="True"
Tag="Temp"
Tapped="OpenFolder_OnTapped" />
Click="OpenFolder_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/OpenLocalEntry"
ActionIcon="{fluent:SymbolIcon Symbol=Open}"
HeaderIcon="{fluent:SymbolIcon Symbol=FolderBriefcase}"
IsClickEnabled="True"
Tag="Local"
Tapped="OpenFolder_OnTapped" />
Click="OpenFolder_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/OpenRoamingEntry"
ActionIcon="{fluent:SymbolIcon Symbol=Open}"
HeaderIcon="{fluent:SymbolIcon Symbol=FolderGlobe}"
IsClickEnabled="True"
Tag="Roaming"
Tapped="OpenFolder_OnTapped" />
Click="OpenFolder_OnClicked" />
</controls:SettingsExpander.Items>
</controls:SettingsExpander>
@ -227,7 +227,7 @@
HeaderIcon="{fluent:SymbolIcon Symbol=Star}"
IsClickEnabled="True"
Tag="ms-windows-store://pdp/?ProductId=9P1RZL9Z8454"
Tapped="OpenLinkViaTag_OnTapped" />
Click="OpenLinkViaTag_OnClicked" />
<TextBlock
x:Uid="/SettingsPage/SessionSettingsGroup"
@ -239,7 +239,7 @@
HeaderIcon="{fluent:SymbolIcon Symbol=SignOut}"
IsClickEnabled="True"
Tag="{x:Bind misc:SettingsEntryAttribute.SignOut}"
Tapped="PerformSignOutButton_OnTapped" />
Click="PerformSignOutButton_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/ResetDefaultSettingsEntry"
@ -258,22 +258,22 @@
x:Uid="/SettingsPage/DeleteFileCacheEntry"
HeaderIcon="{fluent:SymbolIcon Symbol=HistoryDismiss}"
IsClickEnabled="True"
Tapped="DeleteFileCacheEntryButton_OnTapped" />
Click="DeleteFileCacheEntryButton_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/DeleteSearchHistoriesEntry"
HeaderIcon="{fluent:SymbolIcon Symbol=HistoryDismiss}"
IsClickEnabled="True"
Tapped="DeleteSearchHistoriesButton_OnTapped" />
Click="DeleteSearchHistoriesButton_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/DeleteBrowseHistoriesEntry"
HeaderIcon="{fluent:SymbolIcon Symbol=HistoryDismiss}"
IsClickEnabled="True"
Tapped="DeleteBrowseHistoriesButton_OnTapped" />
Click="DeleteBrowseHistoriesButton_OnClicked" />
<controls:SettingsCard
x:Uid="/SettingsPage/DeleteDownloadHistoriesEntry"
HeaderIcon="{fluent:SymbolIcon Symbol=HistoryDismiss}"
IsClickEnabled="True"
Tapped="DeleteDownloadHistoriesButton_OnTapped" />
Click="DeleteDownloadHistoriesButton_OnClicked" />
</controls:SettingsExpander.Items>
</controls:SettingsExpander>
<!-- 设置项插入处 -->

View File

@ -54,17 +54,17 @@ public sealed partial class SettingsPage : IScrollViewHost, IDisposable
private void SettingsPage_OnUnloaded(object sender, RoutedEventArgs e) => Dispose();
private void CheckForUpdateButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void CheckForUpdateButton_OnClicked(object sender, RoutedEventArgs e)
{
ViewModel.CheckForUpdate();
}
private async void OpenLinkViaTag_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenLinkViaTag_OnClicked(object sender, RoutedEventArgs e)
{
_ = await Launcher.LaunchUriAsync(new Uri(sender.To<FrameworkElement>().GetTag<string>()));
}
private async void ReleaseNotesHyperlink_OnTapped(object sender, TappedRoutedEventArgs e)
private async void ReleaseNotesHyperlink_OnClicked(object sender, RoutedEventArgs e)
{
_ = await this.CreateAcknowledgementAsync(SettingsPageResources.ReleaseNotesHyperlinkButtonContent,
new ScrollView
@ -79,7 +79,7 @@ public sealed partial class SettingsPage : IScrollViewHost, IDisposable
});
}
private async void PerformSignOutButton_OnTapped(object sender, TappedRoutedEventArgs e)
private async void PerformSignOutButton_OnClicked(object sender, RoutedEventArgs e)
{
if (await this.CreateOkCancelAsync(SettingsPageResources.SignOutConfirmationDialogTitle,
SettingsPageResources.SignOutConfirmationDialogContent) is ContentDialogResult.Primary)
@ -104,34 +104,34 @@ public sealed partial class SettingsPage : IScrollViewHost, IDisposable
}
}
private void DeleteFileCacheEntryButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void DeleteFileCacheEntryButton_OnClicked(object sender, RoutedEventArgs e)
{
_ = AppKnownFolders.Cache.ClearAsync();
ViewModel.ShowClearData(ClearDataKind.FileCache);
}
private void DeleteSearchHistoriesButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void DeleteSearchHistoriesButton_OnClicked(object sender, RoutedEventArgs e)
{
var manager = App.AppViewModel.AppServiceProvider.GetRequiredService<SearchHistoryPersistentManager>();
manager.Clear();
ViewModel.ShowClearData(ClearDataKind.SearchHistory);
}
private void DeleteBrowseHistoriesButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void DeleteBrowseHistoriesButton_OnClicked(object sender, RoutedEventArgs e)
{
var manager = App.AppViewModel.AppServiceProvider.GetRequiredService<BrowseHistoryPersistentManager>();
manager.Clear();
ViewModel.ShowClearData(ClearDataKind.BrowseHistory);
}
private void DeleteDownloadHistoriesButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void DeleteDownloadHistoriesButton_OnClicked(object sender, RoutedEventArgs e)
{
var manager = App.AppViewModel.AppServiceProvider.GetRequiredService<DownloadHistoryPersistentManager>();
manager.Clear();
ViewModel.ShowClearData(ClearDataKind.DownloadHistory);
}
private void OpenFolder_OnTapped(object sender, TappedRoutedEventArgs e)
private void OpenFolder_OnClicked(object sender, RoutedEventArgs e)
{
var folder = sender.To<FrameworkElement>().GetTag<string>() switch
{

View File

@ -1,10 +1,9 @@
<controls:SupportCustomTitleBarDragRegionPage
<controls:EnhancedWindowPage
x:Class="Pixeval.Pages.NovelViewer.NovelViewerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Pixeval.Controls"
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
xmlns:fluent="using:FluentIcons.WinUI"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:converters1="using:Pixeval.Controls.Converters"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
@ -14,23 +13,20 @@
xmlns:local="using:Pixeval.Pages.NovelViewer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Microsoft.Xaml.Interactions.Media"
xmlns:options="using:Pixeval.Options"
xmlns:triggers="using:Pixeval.Util.Triggers"
xmlns:winUi="using:CommunityToolkit.WinUI"
xmlns:windowing="using:Pixeval.Controls.Windowing"
KeyboardAcceleratorPlacementMode="Hidden"
Loaded="NovelViewerPage_OnLoaded"
Unloaded="NovelViewerPage_OnUnloaded"
mc:Ignorable="d">
<controls:SupportCustomTitleBarDragRegionPage.Resources>
<controls:EnhancedWindowPage.Resources>
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters1:NullableToVisibilityConverter x:Key="NullableToVisibilityConverter" />
<converters1:UIntToColorConverter x:Key="UIntToColorConverter" />
<converters1:DisplayIndexConverter x:Key="DisplayIndexConverter" />
<converters1:UIntToBrushConverter x:Key="UIntToBrushConverter" />
<converters1:FontWeightConverter x:Key="FontWeightConverter" />
<converters1:StringToFontFamilyConverter x:Key="StringToFontFamilyConverter" />
<converters1:BoolNegationToVisibilityConverter x:Key="BoolNegationToVisibilityConverter" />
<Thickness x:Key="NormalMargin">0,48,0,0</Thickness>
<AcrylicBrush
x:Key="BottomCommandSectionBackground"
@ -40,54 +36,47 @@
TintOpacity="0.8" />
<Style
x:Key="TextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
BasedOn="{StaticResource CaptionTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="HorizontalTextAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<Style x:Name="ColorPickerStyle" TargetType="controls1:ColorPicker">
<Setter Property="IsMoreButtonVisible" Value="True" />
<Setter Property="IsAlphaEnabled" Value="True" />
</Style>
</controls:SupportCustomTitleBarDragRegionPage.Resources>
<controls:SupportCustomTitleBarDragRegionPage.KeyboardAccelerators>
</controls:EnhancedWindowPage.Resources>
<controls:EnhancedWindowPage.KeyboardAccelerators>
<KeyboardAccelerator Key="Escape" Invoked="ExitFullScreenKeyboardAccelerator_OnInvoked" />
<KeyboardAccelerator Key="Left" Invoked="PrevButton_OnTapped" />
<KeyboardAccelerator Key="Right" Invoked="NextButton_OnTapped" />
<KeyboardAccelerator Key="Left" Invoked="PrevButton_OnClicked" />
<KeyboardAccelerator Key="Right" Invoked="NextButton_OnClicked" />
<KeyboardAccelerator Key="Up" Invoked="PrevButton_OnRightTapped" />
<KeyboardAccelerator Key="Down" Invoked="NextButton_OnRightTapped" />
</controls:SupportCustomTitleBarDragRegionPage.KeyboardAccelerators>
<controls:WorkViewerSplitView
x:Name="EntryViewerSplitView"
MenuItemsSource="{x:Bind _viewModel.Tags}"
RaiseSetTitleBarDragRegion="Placeholder_OnSizeChanged">
<controls:WorkViewerSplitView.PaneContent>
<SplitView
x:Name="NovelSettingsPane"
DisplayMode="Overlay"
PanePlacement="Right">
<SplitView.Pane>
<controls1:DockPanel>
<ContentPresenter Height="{StaticResource TitleBarHeight}" controls1:DockPanel.Dock="Top">
<TextBlock
x:Uid="/EntryViewerPage/NovelSettingsHeaderTextBlock"
Margin="20,0"
VerticalAlignment="Center"
Style="{StaticResource SubtitleTextBlockStyle}" />
</ContentPresenter>
<ScrollView>
<StackPanel Loaded="Panel_OnLoaded" />
</ScrollView>
</controls1:DockPanel>
</SplitView.Pane>
<!-- ReSharper disable once UnusedMember.Local -->
<Grid x:Name="NovelPresenterDockPanel" Background="{x:Bind _viewModel.NovelBackgroundEntry.Value, Converter={StaticResource UIntToBrushConverter}, Mode=OneWay}">
<!-- ReSharper disable once UnusedMember.Local -->
<Grid x:Name="MainPanel" Margin="{StaticResource NormalMargin}">
</controls:EnhancedWindowPage.KeyboardAccelerators>
<Grid>
<controls:WorkViewerSplitView
x:Name="EntryViewerSplitView"
Margin="{StaticResource NormalMargin}"
MenuItemsSource="{x:Bind _viewModel.Tags}">
<controls:WorkViewerSplitView.PaneContent>
<SplitView
x:Name="NovelSettingsPane"
DisplayMode="Overlay"
PanePlacement="Right">
<SplitView.Pane>
<controls1:DockPanel>
<ContentPresenter Height="{StaticResource TitleBarHeight}" controls1:DockPanel.Dock="Top">
<TextBlock
x:Uid="/EntryViewerPage/NovelSettingsHeaderTextBlock"
Margin="20,0"
VerticalAlignment="Center"
Style="{StaticResource SubtitleTextBlockStyle}" />
</ContentPresenter>
<ScrollView>
<StackPanel Loaded="Panel_OnLoaded" />
</ScrollView>
</controls1:DockPanel>
</SplitView.Pane>
<Grid Background="{x:Bind _viewModel.NovelBackgroundEntry.Value, Converter={StaticResource UIntToBrushConverter}, Mode=OneWay}">
<controls:DocumentViewer
x:Name="DocumentViewer"
ActualThemeChanged="{x:Bind _viewModel.OnFrameworkElementOnActualThemeChanged}"
@ -112,7 +101,7 @@
Width="50"
Height="50"
IsIndeterminate="True" />
<TextBlock x:Uid="/EntryViewerPage/LoadingNovelTextBlock" FontSize="{StaticResource PixevalSubscriptFontSize}" />
<TextBlock x:Uid="/EntryViewerPage/LoadingNovelTextBlock" Style="{StaticResource CaptionTextBlockStyle}" />
</StackPanel>
</Grid>
@ -126,16 +115,16 @@
<controls:PageButton
Grid.Column="0"
Width="150"
ButtonClick="PrevButton_OnClicked"
ButtonRightTapped="PrevButton_OnRightTapped"
ButtonTapped="PrevButton_OnTapped"
ButtonVisibility="{x:Bind _viewModel.PrevButtonText, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneWay}"
IsPrev="True"
ToolTip="{x:Bind _viewModel.PrevButtonText, Mode=OneWay}" />
<controls:PageButton
Grid.Column="2"
Width="150"
ButtonClick="NextButton_OnClicked"
ButtonRightTapped="NextButton_OnRightTapped"
ButtonTapped="NextButton_OnTapped"
ButtonVisibility="{x:Bind _viewModel.NextButtonText, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneWay}"
IsPrev="False"
ToolTip="{x:Bind _viewModel.NextButtonText, Mode=OneWay}" />
@ -281,153 +270,151 @@
</Grid>
</StackPanel>
</Grid>
<!-- ReSharper disable once UnusedMember.Local -->
<Grid
x:Name="TitleBarBorder"
Height="100"
VerticalAlignment="Top">
<interactivity:Interaction.Behaviors>
<triggers:EventWithConditionTriggerBehavior EventName="PointerEntered" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="0">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
<triggers:EventWithConditionTriggerBehavior EventName="PointerExited" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="{StaticResource NegativeTitleBarHeight}">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
</interactivity:Interaction.Behaviors>
<!-- ReSharper disable once UnusedMember.Local -->
<Grid
x:Name="TitleBarArea"
Height="{StaticResource TitleBarHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top">
<Grid.RenderTransform>
<TranslateTransform x:Name="TopCommandBarTranslation" />
</Grid.RenderTransform>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<!-- ReSharper disable once UnusedMember.Local -->
<ColumnDefinition x:Name="TitleControlButtonsColumn" Width="150" />
</Grid.ColumnDefinitions>
<controls:TitleBarIconText
x:Name="TitleBar"
Title="{x:Bind _viewModel.CurrentNovel.Title, Mode=OneWay}"
Grid.Column="0"
Visibility="{x:Bind EntryViewerSplitView.PinPane, Converter={StaticResource BoolNegationToVisibilityConverter}, Mode=OneWay}" />
<Rectangle
Grid.Column="1"
HorizontalAlignment="Stretch"
SizeChanged="Placeholder_OnSizeChanged" />
<CommandBar
x:Name="NovelViewerCommandBar"
Grid.Column="1"
HorizontalAlignment="Center"
DefaultLabelPosition="Collapsed">
<AppBarToggleButton
Command="{x:Bind _viewModel.InfoAndCommentsCommand}"
IsChecked="{x:Bind EntryViewerSplitView.IsPaneOpen, Mode=TwoWay}"
RightTapped="OpenPane_OnRightTapped" />
<AppBarSeparator />
<AppBarButton
Command="{x:Bind _viewModel.CurrentNovel.CopyCommand, Mode=OneWay}"
CommandParameter="{x:Bind DownloadParameter(DocumentViewer.ViewModel), Mode=OneWay}"
IsEnabled="{x:Bind DocumentViewer.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentNovel.SaveCommand, Mode=OneWay}"
CommandParameter="{x:Bind DownloadParameter(DocumentViewer.ViewModel), Mode=OneWay}"
IsEnabled="{x:Bind DocumentViewer.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentNovel.SaveAsCommand, Mode=OneWay}"
CommandParameter="{x:Bind DownloadParameter(DocumentViewer.ViewModel), Mode=OneWay}"
IsEnabled="{x:Bind DocumentViewer.LoadSuccessfully, Mode=OneWay}" />
<AppBarSeparator />
<AppBarButton
x:Name="AddToBookmarkButton"
Command="{x:Bind _viewModel.AddToBookmarkCommand}"
Tapped="AddToBookmarkButton_OnTapped" />
<AppBarButton Command="{x:Bind _viewModel.CurrentNovel.GenerateLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentNovel.GenerateWebLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentNovel.OpenInWebBrowserCommand, Mode=OneWay}" />
<AppBarButton
x:Name="ShowQrCodeButton"
Command="{x:Bind _viewModel.CurrentNovel.ShowQrCodeCommand, Mode=OneWay}"
CommandParameter="{x:Bind ShowQrCodeTeachingTip}" />
<AppBarToggleButton Command="{x:Bind _viewModel.NovelSettingsCommand}" IsChecked="{x:Bind NovelSettingsPane.IsPaneOpen, Mode=TwoWay}" />
</CommandBar>
<TextBlock
Grid.Column="2"
Style="{StaticResource TextBlockStyle}"
Visibility="{x:Bind DocumentViewer.IsMultiPage, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
<Run Text="{x:Bind DocumentViewer.CurrentPage, Converter={StaticResource DisplayIndexConverter}, Mode=OneWay}" />
<Run Text="/" />
<Run Text="{x:Bind DocumentViewer.PageCount, Mode=OneWay}" />
</TextBlock>
<CommandBar
x:Name="NovelViewerSubCommandBar"
Grid.Column="3"
HorizontalAlignment="Right"
VerticalAlignment="Center"
DefaultLabelPosition="Collapsed">
<AppBarButton Command="{x:Bind _viewModel.FullScreenCommand}" />
</CommandBar>
<TeachingTip
x:Name="ShowQrCodeTeachingTip"
x:Uid="/EntryViewerPage/QrCodeTeachingTip"
Grid.Column="0"
IsLightDismissEnabled="True"
Tag="{x:Bind ShowQrCodeButton}">
<TeachingTip.HeroContent>
<Image Loading="Content_OnLoading" Tag="{x:Bind ShowQrCodeTeachingTip}" />
</TeachingTip.HeroContent>
</TeachingTip>
<TeachingTip
x:Name="AddToBookmarkTeachingTip"
x:Uid="/EntryViewerPage/AddToBookmarkTeachingTip"
Grid.Column="0"
CloseButtonClick="AddToBookmarkTeachingTip_OnCloseButtonClick"
IsLightDismissEnabled="True"
Tag="{x:Bind AddToBookmarkButton}">
<flyoutContent:BookmarkTagSelector
x:Name="BookmarkTagSelector"
MaxHeight="{StaticResource TeachingTipContentMaxHeightWithTarget}"
Loading="Content_OnLoading"
Tag="{x:Bind AddToBookmarkTeachingTip}"
Type="Novel" />
</TeachingTip>
</Grid>
</SplitView>
</controls:WorkViewerSplitView.PaneContent>
</controls:WorkViewerSplitView>
<!-- ReSharper disable once UnusedMember.Local -->
<Grid
x:Name="TitleBarBorder"
Height="100"
VerticalAlignment="Top">
<interactivity:Interaction.Behaviors>
<triggers:EventWithConditionTriggerBehavior EventName="PointerEntered" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="0">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
<triggers:EventWithConditionTriggerBehavior EventName="PointerExited" IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}">
<media:ControlStoryboardAction>
<media:ControlStoryboardAction.Storyboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TopCommandBarTranslation"
Storyboard.TargetProperty="Y"
To="{StaticResource NegativeTitleBarHeight}">
<DoubleAnimation.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="7" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</media:ControlStoryboardAction.Storyboard>
</media:ControlStoryboardAction>
</triggers:EventWithConditionTriggerBehavior>
</interactivity:Interaction.Behaviors>
<!-- ReSharper disable once UnusedMember.Local -->
<controls1:TitleBar
x:Name="TitleBarArea"
Title="{x:Bind _viewModel.CurrentNovel.Title, Mode=OneWay}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
CompactStateBreakpoint="1120"
DisplayMode="Tall"
Window="{x:Bind windowing:WindowFactory.GetForkedWindows(HWnd)}">
<controls1:TitleBar.Icon>
<ImageIcon Source="ms-appx:///Assets/Images/logo.svg" />
</controls1:TitleBar.Icon>
<controls1:TitleBar.RenderTransform>
<TranslateTransform x:Name="TopCommandBarTranslation" />
</controls1:TitleBar.RenderTransform>
<controls1:TitleBar.Content>
<CommandBar
x:Name="NovelViewerCommandBar"
Grid.Column="1"
Margin="0,-4"
HorizontalAlignment="Center"
DefaultLabelPosition="Collapsed">
<AppBarToggleButton
Command="{x:Bind _viewModel.InfoAndCommentsCommand}"
IsChecked="{x:Bind EntryViewerSplitView.IsPaneOpen, Mode=TwoWay}"
RightTapped="OpenPane_OnRightTapped" />
<AppBarSeparator />
<AppBarButton
Command="{x:Bind _viewModel.CurrentNovel.CopyCommand, Mode=OneWay}"
CommandParameter="{x:Bind DownloadParameter(DocumentViewer.ViewModel), Mode=OneWay}"
IsEnabled="{x:Bind DocumentViewer.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentNovel.SaveCommand, Mode=OneWay}"
CommandParameter="{x:Bind DownloadParameter(DocumentViewer.ViewModel), Mode=OneWay}"
IsEnabled="{x:Bind DocumentViewer.LoadSuccessfully, Mode=OneWay}" />
<AppBarButton
Command="{x:Bind _viewModel.CurrentNovel.SaveAsCommand, Mode=OneWay}"
CommandParameter="{x:Bind DownloadParameter(DocumentViewer.ViewModel), Mode=OneWay}"
IsEnabled="{x:Bind DocumentViewer.LoadSuccessfully, Mode=OneWay}" />
<AppBarSeparator />
<AppBarButton
x:Name="AddToBookmarkButton"
Click="AddToBookmarkButton_OnClicked"
Command="{x:Bind _viewModel.AddToBookmarkCommand}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentNovel.GenerateLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentNovel.GenerateWebLinkCommand, Mode=OneWay}" CommandParameter="{x:Bind HWnd}" />
<AppBarButton Command="{x:Bind _viewModel.CurrentNovel.OpenInWebBrowserCommand, Mode=OneWay}" />
<AppBarButton
x:Name="ShowQrCodeButton"
Command="{x:Bind _viewModel.CurrentNovel.ShowQrCodeCommand, Mode=OneWay}"
CommandParameter="{x:Bind ShowQrCodeTeachingTip}" />
<AppBarToggleButton Command="{x:Bind _viewModel.NovelSettingsCommand}" IsChecked="{x:Bind NovelSettingsPane.IsPaneOpen, Mode=TwoWay}" />
</CommandBar>
</controls1:TitleBar.Content>
<controls1:TitleBar.Footer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Style="{StaticResource TextBlockStyle}"
Visibility="{x:Bind DocumentViewer.IsMultiPage, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
<Run Text="{x:Bind DocumentViewer.CurrentPage, Converter={StaticResource DisplayIndexConverter}, Mode=OneWay}" />
<Run Text="/" />
<Run Text="{x:Bind DocumentViewer.PageCount, Mode=OneWay}" />
</TextBlock>
<CommandBar
x:Name="NovelViewerSubCommandBar"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
DefaultLabelPosition="Collapsed">
<AppBarButton Command="{x:Bind _viewModel.FullScreenCommand}" />
</CommandBar>
</Grid>
</Grid>
</SplitView>
</controls:WorkViewerSplitView.PaneContent>
</controls1:TitleBar.Footer>
</controls1:TitleBar>
</Grid>
<TeachingTip
x:Name="ShowQrCodeTeachingTip"
x:Uid="/EntryViewerPage/QrCodeTeachingTip"
IsLightDismissEnabled="True"
Tag="{x:Bind ShowQrCodeButton}">
<TeachingTip.HeroContent>
<Image Loading="Content_OnLoading" Tag="{x:Bind ShowQrCodeTeachingTip}" />
</TeachingTip.HeroContent>
</TeachingTip>
<TeachingTip
x:Name="AddToBookmarkTeachingTip"
x:Uid="/EntryViewerPage/AddToBookmarkTeachingTip"
CloseButtonClick="AddToBookmarkTeachingTip_OnCloseButtonClick"
IsLightDismissEnabled="True"
Tag="{x:Bind AddToBookmarkButton}">
<flyoutContent:BookmarkTagSelector
x:Name="BookmarkTagSelector"
MaxHeight="{StaticResource TeachingTipContentMaxHeightWithTarget}"
Loading="Content_OnLoading"
Tag="{x:Bind AddToBookmarkTeachingTip}"
Type="Novel" />
</TeachingTip>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="Normal">
@ -435,9 +422,8 @@
<StateTrigger IsActive="{x:Bind _viewModel.IsFullScreen, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="MainPanel.Margin" Value="{StaticResource NormalMargin}" />
<Setter Target="EntryViewerSplitView.Margin" Value="{StaticResource NormalMargin}" />
<Setter Target="TopCommandBarTranslation.Y" Value="0" />
<Setter Target="TitleControlButtonsColumn.Width" Value="150" />
<Setter Target="TitleBarArea.Background" Value="{x:Null}" />
<Setter Target="TitleBarBorder.Background" Value="{x:Null}" />
</VisualState.Setters>
@ -447,14 +433,13 @@
<StateTrigger IsActive="{x:Bind _viewModel.IsFullScreen, Mode=OneWay}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="MainPanel.Margin" Value="0" />
<Setter Target="EntryViewerSplitView.Margin" Value="0" />
<Setter Target="TopCommandBarTranslation.Y" Value="{StaticResource NegativeTitleBarHeight}" />
<Setter Target="TitleControlButtonsColumn.Width" Value="0" />
<Setter Target="TitleBarArea.Background" Value="{StaticResource PixevalAppAcrylicBrush}" />
<Setter Target="TitleBarBorder.Background" Value="Transparent" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</controls:WorkViewerSplitView>
</controls:SupportCustomTitleBarDragRegionPage>
</Grid>
</controls:EnhancedWindowPage>

View File

@ -1,10 +1,8 @@
using System.Numerics;
using System.Threading.Tasks;
using Windows.Graphics;
using Windows.System;
using WinUI3Utilities;
using Microsoft.UI.Xaml;
using Microsoft.UI.Input;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
@ -47,21 +45,6 @@ public sealed partial class NovelViewerPage
}
}
protected override void SetTitleBarDragRegion(InputNonClientPointerSource sender, SizeInt32 windowSize, double scaleFactor, out int titleBarHeight)
{
if (_viewModel.IsFullScreen)
{
titleBarHeight = 0;
return;
}
var leftIndent = new RectInt32(0, 0, EntryViewerSplitView.IsPaneOpen ? (int)WorkViewerSplitView.OpenPaneLength : 0, (int)TitleBarArea.ActualHeight);
if (TitleBar.Visibility is Visibility.Visible)
sender.SetRegionRects(NonClientRegionKind.Icon, [GetScaledRect(TitleBar.Icon)]);
sender.SetRegionRects(NonClientRegionKind.Passthrough, [GetScaledRect(leftIndent), GetScaledRect(NovelViewerCommandBar), GetScaledRect(NovelViewerSubCommandBar)]);
titleBarHeight = 48;
}
public override void OnPageActivated(NavigationEventArgs e, object? parameter)
{
// 此处this.XamlRoot为null
@ -91,8 +74,6 @@ public sealed partial class NovelViewerPage
{
var window = WindowFactory.ForkedWindows[HWnd];
window.AppWindow.SetPresenter(vm.IsFullScreen ? AppWindowPresenterKind.FullScreen : AppWindowPresenterKind.Default);
// 加载完之后设置标题栏
_ = Task.Delay(500).ContinueWith(_ => RaiseSetTitleBarDragRegion(window), TaskScheduler.FromCurrentSynchronizationContext());
break;
}
}
@ -134,9 +115,9 @@ public sealed partial class NovelViewerPage
_viewModel.CurrentNovel.AddToBookmarkCommand.Execute((BookmarkTagSelector.SelectedTags, BookmarkTagSelector.IsPrivate, DownloadParameter(DocumentViewer.ViewModel)));
}
private void AddToBookmarkButton_OnTapped(object sender, TappedRoutedEventArgs e) => AddToBookmarkTeachingTip.IsOpen = true;
private void AddToBookmarkButton_OnClicked(object sender, RoutedEventArgs e) => AddToBookmarkTeachingTip.IsOpen = true;
private void NextButton_OnTapped(object sender, IWinRTObject e)
private void NextButton_OnClicked(object sender, IWinRTObject e)
{
switch (_viewModel.NextButtonAction)
{
@ -153,7 +134,7 @@ public sealed partial class NovelViewerPage
++ThumbnailItemsView.SelectedIndex;
}
private void PrevButton_OnTapped(object sender, IWinRTObject e)
private void PrevButton_OnClicked(object sender, IWinRTObject e)
{
switch (_viewModel.PrevButtonAction)
{
@ -176,10 +157,10 @@ public sealed partial class NovelViewerPage
switch (e.Key)
{
case VirtualKey.Left:
PrevButton_OnTapped(null!, null!);
PrevButton_OnClicked(null!, null!);
break;
case VirtualKey.Right:
NextButton_OnTapped(null!, null!);
NextButton_OnClicked(null!, null!);
break;
case VirtualKey.Up:
PrevButton_OnRightTapped(null!, null!);
@ -190,8 +171,6 @@ public sealed partial class NovelViewerPage
}
}
private void Placeholder_OnSizeChanged(object sender, object e) => RaiseSetTitleBarDragRegion(WindowFactory.ForkedWindows[HWnd]);
private async void DocumentViewer_OnTapped(object sender, TappedRoutedEventArgs e)
{
BottomCommandSection.Translation = new Vector3();

View File

@ -50,7 +50,7 @@ public class SuggestionModelDataTemplateSelector : DataTemplateSelector
{
var xaml = $$"""
<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock x:Uid="{{header}}" Style="{StaticResource ContentBoldTextBlockStyle}" />
<TextBlock x:Uid="{{header}}" Style="{StaticResource BodyStrongTextBlockStyle}" />
</DataTemplate>
""";
return XamlReader.Load(xaml).To<DataTemplate>();

View File

@ -18,11 +18,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using PininSharp;
@ -40,15 +38,15 @@ public class SuggestionStateMachine
private static readonly TreeSearcher<SettingsEntryAttribute> _settingEntriesTreeSearcher =
new(SearcherLogic.Contain, PinIn.CreateDefault());
private readonly Lazy<Task<IEnumerable<SuggestionModel>>> _illustrationTrendingTagCache =
new(() => App.AppViewModel.MakoClient.GetTrendingTagsAsync(App.AppViewModel.AppSettings.TargetFilter)
.SelectAsync(t => new Tag { Name = t.Tag, TranslatedName = t.Translation })
.SelectAsync(SuggestionModel.FromIllustrationTag), LazyThreadSafetyMode.ExecutionAndPublication);
private readonly AsyncLazy<IEnumerable<SuggestionModel>> _illustrationTrendingTagCache =
new(async () => (await App.AppViewModel.MakoClient.GetTrendingTagsAsync(App.AppViewModel.AppSettings.TargetFilter))
.Select(t => new Tag { Name = t.Tag, TranslatedName = t.TranslatedName })
.Select(SuggestionModel.FromNovelTag));
private readonly Lazy<Task<IEnumerable<SuggestionModel>>> _novelTrendingTagCache =
new(() => App.AppViewModel.MakoClient.GetTrendingTagsForNovelAsync(App.AppViewModel.AppSettings.TargetFilter)
.SelectAsync(t => new Tag { Name = t.Tag, TranslatedName = t.Translation })
.SelectAsync(SuggestionModel.FromNovelTag), LazyThreadSafetyMode.ExecutionAndPublication);
private readonly AsyncLazy<IEnumerable<SuggestionModel>> _novelTrendingTagCache =
new(async () => (await App.AppViewModel.MakoClient.GetTrendingTagsForNovelAsync(App.AppViewModel.AppSettings.TargetFilter))
.Select(t => new Tag { Name = t.Tag, TranslatedName = t.TranslatedName })
.Select(SuggestionModel.FromNovelTag));
static SuggestionStateMachine()
{
@ -110,14 +108,14 @@ public class SuggestionStateMachine
if (prior)
{
newItems.Add(SuggestionModel.IllustrationTrendingTagHeader);
newItems.AddRange(await _illustrationTrendingTagCache.Value);
newItems.AddRange(await _illustrationTrendingTagCache.ValueAsync);
}
newItems.Add(SuggestionModel.NovelTrendingTagHeader);
newItems.AddRange(await _novelTrendingTagCache.Value);
newItems.AddRange(await _novelTrendingTagCache.ValueAsync);
if (!prior)
{
newItems.Add(SuggestionModel.IllustrationTrendingTagHeader);
newItems.AddRange(await _illustrationTrendingTagCache.Value);
newItems.AddRange(await _illustrationTrendingTagCache.ValueAsync);
}
Suggestions.AddRange(newItems);
}

View File

@ -7,6 +7,7 @@
xmlns:converters="using:Pixeval.Controls.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:fluent="using:FluentIcons.WinUI"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:local="using:Pixeval.Pages.Tags"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
ColumnSpacing="20"
@ -29,26 +30,17 @@
VerticalAlignment="Center"
Spacing="5">
<TextBlock
FontSize="{StaticResource PixevalBaseFontSize}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.Name, Mode=OneWay}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
<!-- ItemsRepeater+WrapLayout回收后的控件会出现重叠bug不知道怎么解决 -->
<ItemsControl MinHeight="10" ItemsSource="{x:Bind ViewModel.Tags, Mode=OneWay}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<controls:WrapPanel HorizontalSpacing="5" VerticalSpacing="5" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="x:String">
<Button
Content="{x:Bind}"
FontSize="{StaticResource PixevalSubscriptFontSize}"
Tapped="TagButton_OnTapped" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<labs:TokenView
MinHeight="10"
IsItemClickEnabled="True"
ItemClick="TagButton_OnClicked"
ItemsSource="{x:Bind ViewModel.Tags, Mode=OneWay}"
SelectionMode="None" />
</StackPanel>
<CommandBar
Grid.Column="2"
@ -59,24 +51,24 @@
<!-- Width="125" 是试出来刚好只显示一个按钮的宽度 -->
<AppBarButton
x:Uid="/TagsEntry/EditTagItem"
Icon="{fluent:SymbolIcon Symbol=Tag}"
Tapped="EditTagItem_OnTapped" />
Click="EditTagItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=Tag}" />
<AppBarButton
x:Uid="/TagsEntry/OpenItem"
Icon="{fluent:SymbolIcon Symbol=Open}"
Tapped="OpenItem_OnTapped" />
Click="OpenItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=Open}" />
<AppBarButton
x:Uid="/TagsEntry/GoToPageItem"
Click="GoToPageItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=OpenFolder}"
IsEnabled="{x:Bind ViewModel.Illustration, Converter={StaticResource NullableToBoolConverter}, Mode=OneWay}"
Tapped="GoToPageItem_OnTapped" />
IsEnabled="{x:Bind ViewModel.Illustration, Converter={StaticResource NullableToBoolConverter}, Mode=OneWay}" />
<AppBarButton
x:Uid="/TagsEntry/DeleteItem"
Icon="{fluent:SymbolIcon Symbol=Delete}"
Tapped="DeleteItem_OnTapped" />
Click="DeleteItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=Delete}" />
<AppBarButton
x:Uid="/TagsEntry/OpenLocationItem"
Icon="{fluent:SymbolIcon Symbol=FolderArrowRight}"
Tapped="OpenLocationItem_OnTapped" />
Click="OpenLocationItem_OnClicked"
Icon="{fluent:SymbolIcon Symbol=FolderArrowRight}" />
</CommandBar>
</Grid>

View File

@ -1,8 +1,10 @@
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.IO;
using Windows.Storage;
using Windows.System;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Pixeval.Controls;
@ -17,38 +19,38 @@ namespace Pixeval.Pages.Tags;
[DependencyProperty<TagsEntryViewModel>("ViewModel")]
public sealed partial class TagsEntry
{
public event Action<TagsEntry, string>? TagTapped;
public event Action<TagsEntry, string>? TagClick;
public event Action<TagsEntry, TagsEntryViewModel>? FileDeleted;
public TagsEntry() => InitializeComponent();
private void TagButton_OnTapped(object sender, TappedRoutedEventArgs e) => TagTapped?.Invoke(this, sender.To<Button>().Content.To<string>());
private void TagButton_OnClicked(object sender, ItemClickEventArgs e) => TagClick?.Invoke(this, e.ClickedItem.To<string>());
private void GoToPageItem_OnTapped(object sender, TappedRoutedEventArgs e)
private void GoToPageItem_OnClicked(object sender, RoutedEventArgs e)
{
var vm = new IllustrationItemViewModel(ViewModel.Illustration!);
vm.CreateWindowWithPage([vm]);
}
private async void DeleteItem_OnTapped(object sender, TappedRoutedEventArgs e)
private async void DeleteItem_OnClicked(object sender, RoutedEventArgs e)
{
var file = await StorageFile.GetFileFromPathAsync(ViewModel.FullPath);
await file.DeleteAsync();
FileDeleted?.Invoke(this, ViewModel);
}
private async void OpenItem_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenItem_OnClicked(object sender, RoutedEventArgs e)
{
_ = await Launcher.LaunchUriAsync(new Uri(ViewModel.FullPath));
}
private async void OpenLocationItem_OnTapped(object sender, TappedRoutedEventArgs e)
private async void OpenLocationItem_OnClicked(object sender, RoutedEventArgs e)
{
_ = await Launcher.LaunchFolderPathAsync(Path.GetDirectoryName(ViewModel.FullPath));
}
private async void EditTagItem_OnTapped(object sender, TappedRoutedEventArgs e)
private async void EditTagItem_OnClicked(object sender, RoutedEventArgs e)
{
var content = new TagsEntryEditTagDialog(ViewModel);

View File

@ -20,8 +20,8 @@
<CommandBar DefaultLabelPosition="Collapsed" OverflowButtonVisibility="Collapsed">
<AppBarButton
Width="40"
Icon="{fluent:SymbolIcon Symbol=MoreHorizontal}"
Tapped="ChangeWorkingPath_OnTapped" />
Click="ChangeWorkingPath_OnClicked"
Icon="{fluent:SymbolIcon Symbol=MoreHorizontal}" />
</CommandBar>
<TextBlock VerticalAlignment="Center" Text="{x:Bind _viewModel.WorkingDirectory, Mode=OneWay}" />
</StackPanel>
@ -41,7 +41,7 @@
<local:TagsEntry
Margin="16"
FileDeleted="TagsEntry_OnFileDeleted"
TagTapped="TagsEntry_OnTagTapped"
TagClick="TagsEntry_OnTagClick"
ViewModel="{x:Bind}" />
</ItemContainer>
</DataTemplate>

View File

@ -11,7 +11,7 @@ public sealed partial class TagsPage
public TagsPage() => InitializeComponent();
private void TagsEntry_OnTagTapped(TagsEntry sender, string tag)
private void TagsEntry_OnTagClick(TagsEntry sender, string tag)
{
if (!_viewModel.SelectedTags.Contains(tag))
_viewModel.SelectedTags.Add(tag);
@ -22,7 +22,7 @@ public sealed partial class TagsPage
_ = _viewModel.DataProvider.View.Remove(viewModel);
}
private async void ChangeWorkingPath_OnTapped(object sender, TappedRoutedEventArgs e)
private async void ChangeWorkingPath_OnClicked(object sender, RoutedEventArgs e)
{
if (await HWnd.OpenFolderPickerAsync() is { } folder)
_viewModel.WorkingDirectory = folder.Path;

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Pixeval.AppManagement;
using WinUI3Utilities;

View File

@ -17,14 +17,14 @@
Grid.Row="0"
Margin="10"
VerticalAlignment="Center"
SendButtonTapped="ReplyBar_OnSendButtonTapped"
StickerTapped="ReplyBar_OnStickerTapped" />
SendButtonClick="ReplyBar_OnSendButtonClick"
StickerClick="ReplyBar_OnStickerClick" />
<controls:CommentList
Grid.Row="1"
DeleteHyperlinkButtonTapped="CommentList_OnDeleteHyperlinkButtonTapped"
DeleteHyperlinkButtonClick="CommentList_OnDeleteHyperlinkButtonClick"
HasNoItem="{x:Bind _viewModel.HasNoItem, Mode=OneWay}"
ItemsSource="{x:Bind _viewModel.View}"
RepliesHyperlinkButtonTapped="CommentList_OnRepliesHyperlinkButtonTapped" />
RepliesHyperlinkButtonClick="CommentList_OnRepliesHyperlinkButtonClick" />
<TeachingTip
x:Name="CommentRepliesTeachingTip"
x:Uid="/CommentsPage/CommentRepliesTeachingTip"

View File

@ -49,13 +49,13 @@ public sealed partial class CommentsPage
_viewModel = new CommentsPageViewModel(engine, type, id);
}
private void CommentList_OnRepliesHyperlinkButtonTapped(CommentBlockViewModel viewModel)
private void CommentList_OnRepliesHyperlinkButtonClick(CommentBlockViewModel viewModel)
{
CommentRepliesBlock.ViewModel = viewModel;
CommentRepliesTeachingTip.IsOpen = true;
}
private async void ReplyBar_OnSendButtonTapped(object? sender, SendButtonTappedEventArgs e)
private async void ReplyBar_OnSendButtonClick(object? sender, SendButtonClickEventArgs e)
{
using var result = _viewModel.EntryType switch
{
@ -71,7 +71,7 @@ public sealed partial class CommentsPage
await AddComment(result);
}
private async void ReplyBar_OnStickerTapped(object? sender, StickerTappedEventArgs e)
private async void ReplyBar_OnStickerClick(object? sender, StickerClickEventArgs e)
{
using var result = _viewModel.EntryType switch
{
@ -87,7 +87,7 @@ public sealed partial class CommentsPage
await AddComment(result);
}
private async void CommentList_OnDeleteHyperlinkButtonTapped(CommentBlockViewModel viewModel)
private async void CommentList_OnDeleteHyperlinkButtonClick(CommentBlockViewModel viewModel)
{
using var result = _viewModel.EntryType switch
{

View File

@ -39,7 +39,7 @@ public sealed partial class PixivReplyStickerListPage
{
public static readonly ObservableCollection<PixivReplyStickerViewModel> Stickers = [];
private EventHandler<StickerTappedEventArgs>? _replyBarStickerTappedEventHandler;
private EventHandler<StickerClickEventArgs>? _replyBarStickerClickEventHandler;
static PixivReplyStickerListPage() => LoadStickers();
@ -47,7 +47,7 @@ public sealed partial class PixivReplyStickerListPage
public override void OnPageActivated(NavigationEventArgs e)
{
_replyBarStickerTappedEventHandler = (((Guid, EventHandler<StickerTappedEventArgs>))e.Parameter).Item2;
_replyBarStickerClickEventHandler = (((Guid, EventHandler<StickerClickEventArgs>))e.Parameter).Item2;
}
/// <summary>
@ -68,6 +68,6 @@ public sealed partial class PixivReplyStickerListPage
private void StickerImage_OnTapped(object sender, TappedRoutedEventArgs e)
{
_replyBarStickerTappedEventHandler?.Invoke(sender, new StickerTappedEventArgs(e, sender.To<FrameworkElement>().GetTag<PixivReplyStickerViewModel>()));
_replyBarStickerClickEventHandler?.Invoke(sender, new StickerClickEventArgs(e, sender.To<FrameworkElement>().GetTag<PixivReplyStickerViewModel>()));
}
}

View File

@ -17,14 +17,18 @@
<pixevalControls:EnhancedPage.Resources>
<converters:StringFormatConverter x:Key="StringFormatConverter" />
<converters1:NullableToVisibilityConverter x:Key="NullableToVisibilityConverter" />
<Style x:Key="InfoPageSectionHeaderTextBlockStyle" TargetType="TextBlock">
<Style
x:Key="InfoPageSectionHeaderTextBlockStyle"
BasedOn="{StaticResource CaptionTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="{StaticResource StackLayoutEntriesMargin}" />
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
<Setter Property="Foreground" Value="{ThemeResource TextBoxDisabledForegroundThemeBrush}" />
</Style>
<Style x:Key="InfoPageSectionContentTextBlockStyle" TargetType="TextBlock">
<Style
x:Key="InfoPageSectionContentTextBlockStyle"
BasedOn="{StaticResource CaptionTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="{StaticResource StackLayoutEntryPadding}" />
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="MaxHeight" Value="200" />
@ -35,16 +39,13 @@
HorizontalScrollMode="Disabled"
VerticalScrollBarVisibility="Auto">
<StackPanel Margin="20,15">
<TextBlock
x:Uid="/WorkInfoPage/TitleTextBlock"
FontSize="{StaticResource PixevalSubtitleFontSize}"
FontWeight="Bold" />
<TextBlock x:Uid="/WorkInfoPage/TitleTextBlock" Style="{StaticResource SubtitleTextBlockStyle}" />
<!--#region Illustrator Info-->
<TextBlock x:Uid="/WorkInfoPage/IllustratorTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
<Button
Margin="{StaticResource StackLayoutEntryPadding}"
Style="{StaticResource CardControlButton}"
Tapped="IllustratorPersonPicture_OnTapped">
Click="IllustratorPersonPicture_OnClicked"
Style="{StaticResource CardControlButton}">
<Grid ColumnSpacing="10" RowSpacing="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -64,14 +65,14 @@
<TextBlock
Grid.Row="0"
Grid.Column="1"
FontSize="{StaticResource PixevalContentFontSize}">
Style="{StaticResource CaptionTextBlockStyle}">
<Run x:Uid="/WorkInfoPage/IllustratorName" />
<Run Text="{x:Bind _viewModel.Illustrator.Name}" />
</TextBlock>
<TextBlock
Grid.Row="1"
Grid.Column="1"
FontSize="{StaticResource PixevalContentFontSize}">
Style="{StaticResource CaptionTextBlockStyle}">
<Run x:Uid="/WorkInfoPage/IllustratorId" />
<Run Text="{x:Bind _viewModel.Illustrator.Id}" />
</TextBlock>
@ -91,7 +92,7 @@
<labs:MarkdownTextBlock
x:Name="WorkCaptionMarkdownTextBlock"
Margin="{StaticResource StackLayoutEntryPadding}"
FontSize="{StaticResource PixevalContentFontSize}"
FontSize="{StaticResource CaptionTextBlockFontSize}"
Text="">
<labs:MarkdownTextBlock.Config>
<labs:MarkdownConfig />
@ -120,9 +121,9 @@
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="model:Tag">
<Button
Click="WorkTagButton_OnClicked"
Content="{x:Bind Name}"
FontSize="{StaticResource PixevalSubscriptFontSize}"
Tapped="WorkTagButton_OnTapped"
FontSize="{StaticResource CaptionTextBlockFontSize}"
ToolTipService.ToolTip="{x:Bind ToolTip}">
<Button.ContextFlyout>
<MenuFlyout>

View File

@ -48,12 +48,12 @@ public sealed partial class WorkInfoPage
await _viewModel.LoadAvatarAsync();
}
private void WorkTagButton_OnTapped(object sender, TappedRoutedEventArgs e)
private void WorkTagButton_OnClicked(object sender, RoutedEventArgs e)
{
_ = WeakReferenceMessenger.Default.Send(new WorkTagClickedMessage(_viewModel.Entry is Illustration ? SimpleWorkType.IllustAndManga : SimpleWorkType.Novel, (string)((Button)sender).Content));
}
private async void IllustratorPersonPicture_OnTapped(object sender, TappedRoutedEventArgs e)
private async void IllustratorPersonPicture_OnClicked(object sender, RoutedEventArgs e)
{
await IllustratorViewerHelper.CreateWindowWithPageAsync(_viewModel.Illustrator.Id);
}

View File

@ -42,7 +42,7 @@
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="FluentIcons.WinUI" Version="1.1.240" />
<PackageReference Include="FluentIcons.WinUI" Version="1.1.242" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -1,15 +1,74 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.UI.Xaml.Controls;
using System.Reflection;
using Windows.System;
using Pixeval.AppManagement;
using Pixeval.Attributes;
using Pixeval.Controls.Settings;
using Pixeval.Utilities;
using Symbol = FluentIcons.Common.Symbol;
namespace Pixeval.Settings.Models;
public class IpWithSwitchAppSettingsEntry(
AppSettings appSettings)
: BoolAppSettingsEntry(appSettings, t => t.EnableDomainFronting)
public class IpWithSwitchAppSettingsEntry : BoolAppSettingsEntry
{
public IpWithSwitchAppSettingsEntry(AppSettings appSettings) : base(appSettings, t => t.EnableDomainFronting)
{
PixivAppApiNameResolver = [.. appSettings.PixivAppApiNameResolver];
PixivImageNameResolver = [.. appSettings.PixivImageNameResolver];
PixivImageNameResolver2 = [.. appSettings.PixivImageNameResolver2];
PixivOAuthNameResolver = [.. appSettings.PixivOAuthNameResolver];
PixivAccountNameResolver = [.. appSettings.PixivAccountNameResolver];
PixivWebApiNameResolver = [.. appSettings.PixivWebApiNameResolver];
var member = typeof(AppSettings).GetProperty(nameof(AppSettings.PixivAppApiNameResolver));
Attribute2 = member?.GetCustomAttribute<SettingsEntryAttribute>();
if (Attribute2 is { } attribute)
{
Header2 = attribute.LocalizedResourceHeader;
Description2 = attribute.LocalizedResourceDescription;
HeaderIcon2 = attribute.Symbol;
}
}
#region Entry2
public Symbol HeaderIcon2 { get; set; }
public string Header2 { get; set; } = "";
public object DescriptionControl2
{
get
{
if (DescriptionUri2 is not null)
{
var b = new HyperlinkButton { Content = Description2 };
if (DescriptionUri2.Scheme is "http" or "https")
{
b.NavigateUri = DescriptionUri2;
return b;
}
var uri = DescriptionUri2;
b.Click += (_, _) => _ = Launcher.LaunchUriAsync(uri);
return b;
}
return Description2;
}
}
public string Description2 { get; set; } = "";
public Uri? DescriptionUri2 { get; set; }
public SettingsEntryAttribute? Attribute2 { get; }
#endregion
public override IpWithSwitchSettingsExpander Element => new() { Entry = this };
public override void ValueReset()
@ -50,15 +109,15 @@ public class IpWithSwitchAppSettingsEntry(
AppInfo.SetNameResolvers(Settings);
}
public ObservableCollection<string> PixivAppApiNameResolver { get; set; } = [.. appSettings.PixivAppApiNameResolver];
public ObservableCollection<string> PixivAppApiNameResolver { get; set; }
public ObservableCollection<string> PixivImageNameResolver { get; set; } = [.. appSettings.PixivImageNameResolver];
public ObservableCollection<string> PixivImageNameResolver { get; set; }
public ObservableCollection<string> PixivImageNameResolver2 { get; set; } = [.. appSettings.PixivImageNameResolver2];
public ObservableCollection<string> PixivImageNameResolver2 { get; set; }
public ObservableCollection<string> PixivOAuthNameResolver { get; set; } = [.. appSettings.PixivOAuthNameResolver];
public ObservableCollection<string> PixivOAuthNameResolver { get; set; }
public ObservableCollection<string> PixivAccountNameResolver { get; set; } = [.. appSettings.PixivAccountNameResolver];
public ObservableCollection<string> PixivAccountNameResolver { get; set; }
public ObservableCollection<string> PixivWebApiNameResolver { get; set; } = [.. appSettings.PixivWebApiNameResolver];
public ObservableCollection<string> PixivWebApiNameResolver { get; set; }
}

View File

@ -19,15 +19,67 @@
#endregion
using System;
using System.Reflection;
using Windows.System;
using Microsoft.UI.Xaml.Controls;
using Pixeval.AppManagement;
using Pixeval.Attributes;
using Pixeval.Controls.Settings;
using Pixeval.Options;
using Symbol = FluentIcons.Common.Symbol;
namespace Pixeval.Settings.Models;
public class ProxyAppSettingsEntry(AppSettings appSettings)
: EnumAppSettingsEntry<ProxyType>(appSettings, t => t.ProxyType)
public class ProxyAppSettingsEntry : EnumAppSettingsEntry<ProxyType>
{
public ProxyAppSettingsEntry(AppSettings appSettings) : base(appSettings, t => t.ProxyType)
{
var member = typeof(AppSettings).GetProperty(nameof(AppSettings.Proxy));
Attribute2 = member?.GetCustomAttribute<SettingsEntryAttribute>();
if (Attribute2 is { } attribute)
{
Header2 = attribute.LocalizedResourceHeader;
Description2 = attribute.LocalizedResourceDescription;
HeaderIcon2 = attribute.Symbol;
}
}
#region Entry2
public Symbol HeaderIcon2 { get; set; }
public string Header2 { get; set; } = "";
public object DescriptionControl2
{
get
{
if (DescriptionUri2 is not null)
{
var b = new HyperlinkButton { Content = Description2 };
if (DescriptionUri2.Scheme is "http" or "https")
{
b.NavigateUri = DescriptionUri2;
return b;
}
var uri = DescriptionUri2;
b.Click += (_, _) => _ = Launcher.LaunchUriAsync(uri);
return b;
}
return Description2;
}
}
public string Description2 { get; set; } = "";
public Uri? DescriptionUri2 { get; set; }
public SettingsEntryAttribute? Attribute2 { get; }
#endregion
public override ProxySettingsExpander Element => new() { Entry = this };
public Action<string?>? ProxyChanged { get; set; }

View File

@ -21,39 +21,11 @@
<x:Double x:Key="PixevalButtonIconSmallSize">10</x:Double>
<x:Double x:Key="TeachingTipContentMaxHeight">450</x:Double>
<x:Double x:Key="TeachingTipContentMaxHeightWithTarget">430</x:Double>
<Style x:Key="TitleTextBlockStyle" TargetType="TextBlock">
<Style
x:Key="CaptionStrongTextBlockStyle"
BasedOn="{StaticResource CaptionTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontSize" Value="{StaticResource PixevalTitleFontSize}" />
</Style>
<Style x:Key="SubtitleTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontSize" Value="{StaticResource PixevalSubtitleFontSize}" />
</Style>
<Style x:Key="SubSubtitleTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontSize" Value="{StaticResource PixevalSubSubtitleFontSize}" />
</Style>
<Style x:Key="ContentStrongTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
</Style>
<Style x:Key="ContentTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
</Style>
<Style x:Key="BaseTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource PixevalBaseFontSize}" />
</Style>
<!-- 以防和TitleBar冲突 -->
<Style x:Key="PixevalCaptionTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource PixevalCaptionFontSize}" />
</Style>
<Style x:Key="SubscriptTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontSize" Value="{StaticResource PixevalSubscriptFontSize}" />
</Style>
<Style x:Key="ContentBoldTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
</Style>
<Style x:Key="PixevalNumberBoxStyle" TargetType="NumberBox">
<Setter Property="IsWrapEnabled" Value="True" />

View File

@ -182,11 +182,11 @@
},
"FluentIcons.WinUI": {
"type": "Direct",
"requested": "[1.1.240, )",
"resolved": "1.1.240",
"contentHash": "xF2YeBgqD58nDAGVlXvuZ/rObWEnKi+eyYloZKetb1dQAxVug2gFqzRqgAEeYBubmFC87H5JHN4JsW8XiRdEWQ==",
"requested": "[1.1.242, )",
"resolved": "1.1.242",
"contentHash": "AXRE5hClL0KeGcrffCHGRiL7ftsaDcCZLQIm7cyrBPw7RVbnLJuN6w21udwbK+yIEIUAstsDwhXK2nFwcMq4yQ==",
"dependencies": {
"FluentIcons.Common": "[1.1.240]",
"FluentIcons.Common": "[1.1.242]",
"Microsoft.Extensions.Hosting.Abstractions": "8.0.0",
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1",
"Microsoft.WindowsAppSDK": "1.2.221109.1"
@ -368,8 +368,8 @@
},
"FluentIcons.Common": {
"type": "Transitive",
"resolved": "1.1.240",
"contentHash": "CGit9S60sd9uC0lJQQEvj6y/jYncOC2QUoVcrsj48dfAoGmm6mswxT1tnYem/1Gwkb6XWCNXxF2UMncvVBJ2uQ=="
"resolved": "1.1.242",
"contentHash": "mAsDhfwdgxK+myqBbhnxfTtnknUX8nqQzyKTg9WNjsKVsDTaC0isrpG3MBAyhml3J54Zq3NQT1b0xjrx4vvbJw=="
},
"HtmlAgilityPack": {
"type": "Transitive",
@ -568,7 +568,7 @@
"CommunityToolkit.WinUI.Controls.Primitives": "[8.1.240328-rc, )",
"CommunityToolkit.WinUI.Extensions": "[8.1.240328-rc, )",
"CommunityToolkit.WinUI.Triggers": "[8.0.240109, )",
"FluentIcons.WinUI": "[1.1.240, )",
"FluentIcons.WinUI": "[1.1.242, )",
"Microsoft.Graphics.Win2D": "[1.2.0, )",
"Microsoft.Windows.SDK.BuildTools": "[10.0.22621.3233, )",
"Microsoft.WindowsAppSDK": "[1.5.240428000, )",