mirror of
https://github.com/Pixeval/Pixeval.git
synced 2025-01-05 10:17:19 +08:00
删除MainWindow统一构建,解决主题和背景切换问题
This commit is contained in:
parent
79da476545
commit
e05c19bc81
42
Settings.XamlStyler
Normal file
42
Settings.XamlStyler
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"AttributesTolerance": 2,
|
||||
"KeepFirstAttributeOnSameLine": false,
|
||||
"MaxAttributeCharactersPerLine": 0,
|
||||
"MaxAttributesPerLine": 1,
|
||||
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
|
||||
"SeparateByGroups": false,
|
||||
"AttributeIndentation": 0,
|
||||
"AttributeIndentationStyle": 1,
|
||||
"RemoveDesignTimeReferences": false,
|
||||
"IgnoreDesignTimeReferencePrefix": false,
|
||||
"EnableAttributeReordering": true,
|
||||
"AttributeOrderingRuleGroups": [
|
||||
"x:Class",
|
||||
"xmlns, xmlns:x",
|
||||
"xmlns:*",
|
||||
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
|
||||
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
|
||||
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
|
||||
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
|
||||
"*:*, *",
|
||||
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
|
||||
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
|
||||
"Storyboard.*, From, To, Duration"
|
||||
],
|
||||
"FirstLineAttributes": "",
|
||||
"OrderAttributesByName": true,
|
||||
"PutEndingBracketOnNewLine": false,
|
||||
"RemoveEndingTagOfEmptyElement": true,
|
||||
"SpaceBeforeClosingSlash": true,
|
||||
"RootElementLineBreakRule": 0,
|
||||
"ReorderVSM": 2,
|
||||
"ReorderGridChildren": false,
|
||||
"ReorderCanvasChildren": false,
|
||||
"ReorderSetters": 0,
|
||||
"FormatMarkupExtension": true,
|
||||
"NoNewLineMarkupExtensions": "x:Bind, Binding",
|
||||
"ThicknessSeparator": 2,
|
||||
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
|
||||
"FormatOnSave": true,
|
||||
"CommentPadding": 2,
|
||||
}
|
@ -21,14 +21,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using Pixeval.Messages;
|
||||
using Pixeval.Pages.IllustrationViewer;
|
||||
using Pixeval.UserControls.IllustrationView;
|
||||
using Pixeval.Util.Threading;
|
||||
using Pixeval.Util.UI;
|
||||
using Pixeval.Utilities;
|
||||
using IllustrationViewModel = Pixeval.UserControls.IllustrationView.IllustrationViewModel;
|
||||
|
||||
namespace Pixeval.Activation;
|
||||
|
||||
@ -38,7 +34,7 @@ public class IllustrationAppActivationHandler : IAppActivationHandler
|
||||
|
||||
public Task Execute(string id)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new MainPageFrameSetConnectedAnimationTargetMessage(App.AppViewModel.AppWindowRootFrame));
|
||||
// WeakReferenceMessenger.Default.Send(new MainPageFrameSetConnectedAnimationTargetMessage(App.AppViewModel.AppWindowRootFrame));
|
||||
|
||||
return ThreadingHelper.DispatchTaskAsync(async () =>
|
||||
{
|
||||
@ -50,7 +46,7 @@ public class IllustrationAppActivationHandler : IAppActivationHandler
|
||||
.GetMangaIllustrationViewModels()
|
||||
.ToArray();
|
||||
|
||||
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", App.AppViewModel.AppWindowRootFrame);
|
||||
// 见41行 ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", App.AppViewModel.AppWindowRootFrame);
|
||||
// todo UIHelper.RootFrameNavigate(typeof(IllustrationViewerPage), new IllustrationViewerPageViewModel(viewModels), new SuppressNavigationTransitionInfo());
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -31,9 +31,9 @@ using Windows.Graphics;
|
||||
using Pixeval.Options;
|
||||
using WinUI3Utilities;
|
||||
using AppContext = Pixeval.AppManagement.AppContext;
|
||||
using ApplicationTheme = Pixeval.Options.ApplicationTheme;
|
||||
using Microsoft.UI.Composition.SystemBackdrops;
|
||||
using static WinUI3Utilities.AppHelper;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Pixeval.Pages.Login;
|
||||
using Pixeval.Util.UI.Windowing;
|
||||
|
||||
namespace Pixeval;
|
||||
|
||||
@ -44,13 +44,7 @@ public partial class App
|
||||
public App()
|
||||
{
|
||||
// The theme can only be changed in ctor
|
||||
AppViewModel = new AppViewModel(this) { AppSetting = AppContext.LoadConfiguration() ?? AppSetting.CreateDefault() };
|
||||
RequestedTheme = AppViewModel.AppSetting.Theme switch
|
||||
{
|
||||
ApplicationTheme.Dark => Microsoft.UI.Xaml.ApplicationTheme.Dark,
|
||||
ApplicationTheme.Light => Microsoft.UI.Xaml.ApplicationTheme.Light,
|
||||
_ => RequestedTheme
|
||||
};
|
||||
AppViewModel = new(this) { AppSetting = AppContext.LoadConfiguration() ?? AppSetting.CreateDefault() };
|
||||
AppInstance.GetCurrent().Activated += (_, arguments) => ActivationRegistrar.Dispatch(arguments);
|
||||
InitializeComponent();
|
||||
}
|
||||
@ -75,21 +69,14 @@ public partial class App
|
||||
Current.Resources[ApplicationWideFontKey] = new FontFamily(AppViewModel.AppSetting.AppFontFamilyName);
|
||||
await AppKnownFolders.InitializeAsync();
|
||||
|
||||
_ = new MainWindow();
|
||||
CurrentContext.Title = AppContext.AppIdentifier;
|
||||
Initialize(new InitializeInfo
|
||||
{
|
||||
Size = new SizeInt32(AppViewModel.AppSetting.WindowWidth, AppViewModel.AppSetting.WindowHeight),
|
||||
BackdropType = AppViewModel.AppSetting.AppBackdrop switch
|
||||
{
|
||||
ApplicationBackdropType.None => BackdropType.None,
|
||||
ApplicationBackdropType.Acrylic => BackdropType.Acrylic,
|
||||
ApplicationBackdropType.Mica => BackdropType.Mica,
|
||||
ApplicationBackdropType.MicaAlt => BackdropType.MicaAlt,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
},
|
||||
TitleBarType = TitleBarHelper.TitleBarType.AppWindow
|
||||
});
|
||||
WindowFactory.SetTheme(AppViewModel.AppSetting.Theme);
|
||||
|
||||
WindowFactory.Create(out _)
|
||||
.WithLoaded((s, _) => s.To<Frame>().Navigate(typeof(LoginPage)))
|
||||
.WithClosed((_, _) => AppContext.SaveContext())
|
||||
.Init(new(AppViewModel.AppSetting.WindowWidth, AppViewModel.AppSetting.WindowHeight))
|
||||
.Activate();
|
||||
|
||||
await AppViewModel.InitializeAsync(isProtocolActivated);
|
||||
}
|
||||
|
@ -184,7 +184,8 @@ public static partial class AppContext
|
||||
public static void SaveContext()
|
||||
{
|
||||
// Save the current resolution
|
||||
(App.AppViewModel.AppSetting.WindowWidth, App.AppViewModel.AppSetting.WindowHeight) = UIHelper.GetAppWindowSizeTuple();
|
||||
App.AppViewModel.AppSetting.WindowWidth = CurrentContext.AppWindow.Size.Width;
|
||||
App.AppViewModel.AppSetting.WindowHeight = CurrentContext.AppWindow.Size.Height;
|
||||
if (!App.AppViewModel.SignOutExit)
|
||||
{
|
||||
SaveSession();
|
||||
|
@ -37,8 +37,6 @@ using Pixeval.Util.Threading;
|
||||
using Pixeval.Util.UI;
|
||||
using WinUI3Utilities;
|
||||
using AppContext = Pixeval.AppManagement.AppContext;
|
||||
using AppTheme = Pixeval.Options.ApplicationTheme;
|
||||
using Microsoft.UI;
|
||||
using Pixeval.UserControls.IllustrationView;
|
||||
|
||||
namespace Pixeval;
|
||||
@ -73,10 +71,6 @@ public class AppViewModel : AutoActivateObservableRecipient,
|
||||
|
||||
public FileCache Cache { get; private set; } = null!;
|
||||
|
||||
public ElementTheme AppRootFrameTheme => AppWindowRootFrame.RequestedTheme;
|
||||
|
||||
public Frame AppWindowRootFrame => ((MainWindow)CurrentContext.Window).PixevalAppRootFrame;
|
||||
|
||||
public string? PixivUid => MakoClient.Session.Id;
|
||||
|
||||
public void Receive(ApplicationExitingMessage message)
|
||||
@ -101,21 +95,6 @@ public class AppViewModel : AutoActivateObservableRecipient,
|
||||
.AddSingleton(provider => new BrowseHistoryPersistentManager(provider.GetRequiredService<LiteDatabase>(), App.AppViewModel.AppSetting.MaximumBrowseHistoryRecords)));
|
||||
}
|
||||
|
||||
public void SwitchTheme(AppTheme theme)
|
||||
{
|
||||
var selectedTheme = theme switch
|
||||
{
|
||||
AppTheme.Dark => ElementTheme.Dark,
|
||||
AppTheme.Light => ElementTheme.Light,
|
||||
AppTheme.SystemDefault => ElementTheme.Default,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(theme), theme, null)
|
||||
};
|
||||
|
||||
if (CurrentContext.Window.Content is FrameworkElement rootElement)
|
||||
rootElement.RequestedTheme = selectedTheme;
|
||||
|
||||
}
|
||||
|
||||
public async Task ShowExceptionDialogAsync(Exception e)
|
||||
{
|
||||
await MessageDialogBuilder.CreateAcknowledgement(CurrentContext.Window, MiscResources.ExceptionEncountered, e.ToString()).ShowAsync();
|
||||
@ -135,14 +114,15 @@ public class AppViewModel : AutoActivateObservableRecipient,
|
||||
AppHost.RunAsync().Discard();
|
||||
}
|
||||
|
||||
//todo ShowProgressRing
|
||||
public void PrepareForActivation()
|
||||
{
|
||||
((MainWindow)CurrentContext.Window).ShowProgressRing();
|
||||
// ((MainWindow)CurrentContext.Window).ShowProgressRing();
|
||||
}
|
||||
|
||||
public void ActivationProcessed()
|
||||
{
|
||||
((MainWindow)CurrentContext.Window).HideProgressRing();
|
||||
// ((MainWindow)CurrentContext.Window).HideProgressRing();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -30,17 +30,17 @@ namespace Pixeval.Controls;
|
||||
|
||||
public static class EnhancedWindowPageExtension
|
||||
{
|
||||
public static void Navigate<T>(this Frame frame, CustomizableWindow window, object parameter, NavigationTransitionInfo? info) where T : EnhancedWindowPage
|
||||
public static void Navigate<T>(this Frame frame, EnhancedWindow window, object parameter, NavigationTransitionInfo? info) where T : EnhancedWindowPage
|
||||
{
|
||||
_ = frame.Navigate(typeof(T), new NavigateParameter(parameter, window, frame), info);
|
||||
}
|
||||
}
|
||||
|
||||
public record NavigateParameter(object Parameter, CustomizableWindow Window, Frame Frame);
|
||||
public record NavigateParameter(object Parameter, EnhancedWindow Window, Frame Frame);
|
||||
|
||||
public class EnhancedWindowPage : Page, IEnhancedPage
|
||||
{
|
||||
protected CustomizableWindow Window { get; private set; } = null!;
|
||||
protected EnhancedWindow Window { get; private set; } = null!;
|
||||
|
||||
protected Frame ParentFrame { get; private set; } = null!;
|
||||
|
||||
|
@ -24,8 +24,12 @@ public sealed partial class SettingRadioButtons : UserControl
|
||||
private void RadioButton_OnTapped(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
var select = sender.To<RadioButton>().GetDataContext<StringRepresentableItem>();
|
||||
SelectedItem = select.Item;
|
||||
SelectionChanged?.Invoke(this, new SelectionChangedEventArgs(new List<object>(), new List<object> { select }));
|
||||
if(!Equals(SelectedItem, select.Item))
|
||||
{
|
||||
SelectedItem = select.Item;
|
||||
SelectionChanged?.Invoke(this,
|
||||
new(new List<object>(), new List<object> { select }));
|
||||
}
|
||||
}
|
||||
|
||||
private void SettingRadioButtons_OnLoaded(object sender, RoutedEventArgs e)
|
||||
|
@ -1,40 +0,0 @@
|
||||
<Window
|
||||
x:Class="Pixeval.MainWindow"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Closed="MainWindow_OnClosed"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Frame
|
||||
x:Name="PixevalAppRootFrame"
|
||||
x:FieldModifier="public"
|
||||
Loaded="PixevalAppRootFrame_OnLoaded"
|
||||
Navigated="PixevalAppRootFrame_OnNavigated"
|
||||
Navigating="PixevalAppRootFrame_OnNavigating"
|
||||
NavigationFailed="PixevalAppRootFrame_OnNavigationFailed">
|
||||
<Frame.ContentTransitions>
|
||||
<TransitionCollection>
|
||||
<NavigationThemeTransition DefaultNavigationTransitionInfo="{x:Bind DefaultNavigationTransitionInfo}" />
|
||||
</TransitionCollection>
|
||||
</Frame.ContentTransitions>
|
||||
</Frame>
|
||||
<Grid
|
||||
x:Name="Processing"
|
||||
Width="100"
|
||||
Height="100"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="15"
|
||||
Visibility="Collapsed">
|
||||
<Rectangle Fill="{ThemeResource PixevalAppAcrylicBrush}" />
|
||||
<ProgressRing
|
||||
Width="40"
|
||||
Height="40"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsIndeterminate="True" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
@ -1,118 +0,0 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
// Copyright (c) 2022 Pixeval/MainWindow.xaml.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 System.Linq;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using Pixeval.Misc;
|
||||
using Pixeval.Pages.Login;
|
||||
using AppContext = Pixeval.AppManagement.AppContext;
|
||||
using Pixeval.Util.UI;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Pixeval.Pages;
|
||||
using WinUI3Utilities;
|
||||
|
||||
namespace Pixeval;
|
||||
|
||||
public sealed partial class MainWindow : INavigationModeInfo
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
CurrentContext.Window = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public NavigationTransitionInfo? DefaultNavigationTransitionInfo { get; internal set; } = new SuppressNavigationTransitionInfo();
|
||||
|
||||
/// <summary>
|
||||
/// The parameter of OnNavigatedTo is always <see cref="NavigationMode.New"/>
|
||||
/// </summary>
|
||||
public static NavigationMode? NavigationMode { get; private set; }
|
||||
|
||||
public static NavigationMode? GetNavigationModeAndReset()
|
||||
{
|
||||
var mode = NavigationMode;
|
||||
NavigationMode = null;
|
||||
return mode;
|
||||
}
|
||||
|
||||
private void PixevalAppRootFrame_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PixevalAppRootFrame.Navigate(typeof(LoginPage));
|
||||
}
|
||||
|
||||
private void MainWindow_OnClosed(object sender, WindowEventArgs args)
|
||||
{
|
||||
WeakReferenceMessenger.Default.UnregisterAll(this);
|
||||
AppContext.SaveContext();
|
||||
}
|
||||
|
||||
private void PixevalAppRootFrame_OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
throw e.Exception;
|
||||
}
|
||||
|
||||
private void PixevalAppRootFrame_OnNavigating(object sender, NavigatingCancelEventArgs e)
|
||||
{
|
||||
NavigationMode = e.NavigationMode;
|
||||
}
|
||||
|
||||
public void ShowProgressRing()
|
||||
{
|
||||
Processing.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public void HideProgressRing()
|
||||
{
|
||||
Processing.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
private void PixevalAppRootFrame_OnNavigated(object sender, NavigationEventArgs e)
|
||||
{
|
||||
//SetTitleBarDragRegion();
|
||||
|
||||
//switch (sender)
|
||||
//{
|
||||
// case Frame { SourcePageType: var page }:
|
||||
// TitleBar.Visibility = page == typeof(MainPage) ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
private static Task GoBackToMainPageAsync()
|
||||
{
|
||||
if (App.AppViewModel.AppWindowRootFrame.Content is MainPage)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
var stack = App.AppViewModel.AppWindowRootFrame.BackStack;
|
||||
while (stack.Count >= 1 && stack.Last().SourcePageType != typeof(MainPage))
|
||||
{
|
||||
stack.RemoveAt(stack.Count - 1);
|
||||
}
|
||||
App.AppViewModel.AppWindowRootFrame.GoBack();
|
||||
return App.AppViewModel.AppWindowRootFrame.AwaitPageTransitionAsync<MainPage>();
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
// Copyright (c) 2022 Pixeval/MainWindowViewModel.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 System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using Pixeval.Messages;
|
||||
using Pixeval.Pages;
|
||||
using Pixeval.Pages.IllustrationViewer;
|
||||
using Pixeval.Util.UI;
|
||||
using IllustrationViewModel = Pixeval.UserControls.IllustrationView.IllustrationViewModel;
|
||||
using WinUI3Utilities;
|
||||
|
||||
namespace Pixeval;
|
||||
|
||||
public partial class MainWindowViewModel : AutoActivateObservableRecipient, IRecipient<LoginCompletedMessage>
|
||||
{
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _showTitleBar;
|
||||
|
||||
public bool TitleBarSearchBarEnabled => AppWindowTitleBar.IsCustomizationSupported();
|
||||
|
||||
public SuggestionStateMachine SuggestionProvider { get; } = new();
|
||||
|
||||
public void Receive(LoginCompletedMessage message)
|
||||
{
|
||||
ShowTitleBar = true;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
// Copyright (c) 2022 Pixeval/INavigationModeInfo.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.Navigation;
|
||||
|
||||
namespace Pixeval.Misc;
|
||||
|
||||
public interface INavigationModeInfo
|
||||
{
|
||||
static abstract NavigationMode? NavigationMode { get; }
|
||||
|
||||
static abstract NavigationMode? GetNavigationModeAndReset();
|
||||
}
|
@ -1,37 +1,41 @@
|
||||
<controls:EnhancedPage x:Class="Pixeval.Pages.Capability.BookmarksPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enum="using:Pixeval.CoreApi.Global.Enum"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
ClearCacheAfterNavigation="True"
|
||||
Loaded="BookmarksPage_OnLoaded"
|
||||
mc:Ignorable="d">
|
||||
<controls:EnhancedPage
|
||||
x:Class="Pixeval.Pages.Capability.BookmarksPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enum="using:Pixeval.CoreApi.Global.Enum"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
ClearCacheAfterNavigation="True"
|
||||
mc:Ignorable="d">
|
||||
<userControls:IllustrationContainer x:Name="IllustrationContainer">
|
||||
<userControls:IllustrationContainer.CommandBarElements>
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox x:Name="PrivacyPolicyComboBox"
|
||||
x:Uid="/BookmarksPage/PrivacyPolicyComboBox"
|
||||
SelectionChangedWhenLoaded="PrivacyPolicyComboBox_OnSelectionChangedWhenLoaded">
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox
|
||||
x:Name="PrivacyPolicyComboBox"
|
||||
x:Uid="/BookmarksPage/PrivacyPolicyComboBox"
|
||||
SelectionChangedWhenLoaded="PrivacyPolicyComboBox_OnSelectionChangedWhenLoaded">
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox.Items>
|
||||
<ComboBoxItem x:Name="PrivacyPolicyComboBoxPublicItem"
|
||||
x:Uid="/BookmarksPage/PrivacyPolicyComboBoxPublicComboBoxItem"
|
||||
Tag="{x:Bind enum:PrivacyPolicy.Public}" />
|
||||
<ComboBoxItem
|
||||
x:Name="PrivacyPolicyComboBoxPublicItem"
|
||||
x:Uid="/BookmarksPage/PrivacyPolicyComboBoxPublicComboBoxItem"
|
||||
Tag="{x:Bind enum:PrivacyPolicy.Public}" />
|
||||
<ComboBoxItem x:Uid="/BookmarksPage/PrivacyPolicyComboBoxPrivateComboBoxItem" Tag="{x:Bind enum:PrivacyPolicy.Private}" />
|
||||
</notifyOnLoadedComboBox:NotifyOnLoadedComboBox.Items>
|
||||
</notifyOnLoadedComboBox:NotifyOnLoadedComboBox>
|
||||
<Grid x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
<Grid
|
||||
x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox
|
||||
x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
</Grid>
|
||||
</userControls:IllustrationContainer.CommandBarElements>
|
||||
</userControls:IllustrationContainer>
|
||||
</controls:EnhancedPage>
|
||||
</controls:EnhancedPage>
|
||||
|
@ -56,14 +56,6 @@ public sealed partial class BookmarksPage : ISortedIllustrationContainerPageHelp
|
||||
WeakReferenceMessenger.Default.TryRegister<BookmarksPage, MainPageFrameNavigatingEvent>(this, static (recipient, _) => recipient.IllustrationContainer.ViewModel.DataProvider.FetchEngine?.Cancel());
|
||||
}
|
||||
|
||||
private void BookmarksPage_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.GetNavigationModeAndReset() is not NavigationMode.Back)
|
||||
{
|
||||
ChangeSource();
|
||||
}
|
||||
}
|
||||
|
||||
private void PrivacyPolicyComboBox_OnSelectionChangedWhenLoaded(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ChangeSource();
|
||||
|
@ -1,13 +1,13 @@
|
||||
<controls:EnhancedPage x:Class="Pixeval.Pages.Capability.FollowingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:illustratorView="using:Pixeval.UserControls.IllustratorView"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
ClearCacheAfterNavigation="True"
|
||||
Loaded="FollowingsPage_OnLoaded"
|
||||
mc:Ignorable="d">
|
||||
<controls:EnhancedPage
|
||||
x:Class="Pixeval.Pages.Capability.FollowingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:illustratorView="using:Pixeval.UserControls.IllustratorView"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
ClearCacheAfterNavigation="True"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@ -15,34 +15,39 @@
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListView x:Name="IllustratorListView"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
ItemsSource="{x:Bind ViewModel.DataProvider.IllustratorsView}"
|
||||
Loaded="IllustratorListView_OnLoaded"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||
SelectionChanged="IllustratorListView_OnSelectionChanged">
|
||||
<ListView
|
||||
x:Name="IllustratorListView"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
ItemsSource="{x:Bind ViewModel.DataProvider.IllustratorsView}"
|
||||
Loaded="IllustratorListView_OnLoaded"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||
SelectionChanged="IllustratorListView_OnSelectionChanged">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="illustratorView:IllustratorViewModel">
|
||||
<illustratorView:IllustratorProfile Margin="0,5"
|
||||
BorderThickness="1"
|
||||
ViewModel="{x:Bind}" />
|
||||
<illustratorView:IllustratorProfile
|
||||
Margin="0,5"
|
||||
BorderThickness="1"
|
||||
ViewModel="{x:Bind}" />
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<AppBarSeparator Grid.Column="1" HorizontalAlignment="Center" />
|
||||
<Frame x:Name="IllustratorContentViewerFrame" Grid.Column="2" />
|
||||
</Grid>
|
||||
<StackPanel HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="20"
|
||||
Visibility="{x:Bind ViewModel.HasNoItems, Mode=OneWay}">
|
||||
<Image Width="200"
|
||||
Height="200"
|
||||
Source="/Assets/Images/empty-box.png" />
|
||||
<TextBlock x:Uid="/FollowingPage/ResultIsEmptyTextBlock"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="{StaticResource PixevalTitleFontSize}" />
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="20"
|
||||
Visibility="{x:Bind ViewModel.HasNoItems, Mode=OneWay}">
|
||||
<Image
|
||||
Width="200"
|
||||
Height="200"
|
||||
Source="/Assets/Images/empty-box.png" />
|
||||
<TextBlock
|
||||
x:Uid="/FollowingPage/ResultIsEmptyTextBlock"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="{StaticResource PixevalTitleFontSize}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</controls:EnhancedPage>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
@ -57,14 +57,6 @@ public sealed partial class FollowingsPage : IIllustratorView
|
||||
return IllustratorListView.ContainerFromItem(viewModel) as UIElement;
|
||||
}
|
||||
|
||||
private void FollowingsPage_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.GetNavigationModeAndReset() is not NavigationMode.Back)
|
||||
{
|
||||
_ = ViewModel.ResetEngineAndFillAsync(App.AppViewModel.MakoClient.Following(App.AppViewModel.PixivUid!, PrivacyPolicy.Public));
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPageDeactivated(NavigatingCancelEventArgs e)
|
||||
{
|
||||
ViewModel.Dispose();
|
||||
@ -105,4 +97,4 @@ public sealed partial class FollowingsPage : IIllustratorView
|
||||
IllustratorListView.SelectedIndex = 0;
|
||||
IllustratorContentViewerFrame.Navigate(typeof(IllustratorContentViewerPage), ViewModel.DataProvider.IllustratorsSource[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +1,45 @@
|
||||
<controls:EnhancedPage x:Class="Pixeval.Pages.Capability.RankingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedCalendarDatePicker="using:Pixeval.Controls.NotifyOnLoadedCalendarDatePicker"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:options="using:Pixeval.Options"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
ClearCacheAfterNavigation="True"
|
||||
Loaded="RankingsPage_OnLoaded"
|
||||
mc:Ignorable="d">
|
||||
<controls:EnhancedPage
|
||||
x:Class="Pixeval.Pages.Capability.RankingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedCalendarDatePicker="using:Pixeval.Controls.NotifyOnLoadedCalendarDatePicker"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:options="using:Pixeval.Options"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
ClearCacheAfterNavigation="True"
|
||||
mc:Ignorable="d">
|
||||
<userControls:IllustrationContainer x:Name="IllustrationContainer">
|
||||
<userControls:IllustrationContainer.CommandBarElements>
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox x:Name="RankOptionComboBox"
|
||||
x:Uid="/RankingsPage/RankOptionComboBox"
|
||||
ItemsSource="{x:Bind options:RankOptionWrapper.AvailableOptions()}"
|
||||
SelectionChangedWhenLoaded="RankOptionComboBox_OnSelectionChangedWhenPrepared">
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox
|
||||
x:Name="RankOptionComboBox"
|
||||
x:Uid="/RankingsPage/RankOptionComboBox"
|
||||
ItemsSource="{x:Bind options:RankOptionWrapper.AvailableOptions()}"
|
||||
SelectionChangedWhenLoaded="RankOptionComboBox_OnSelectionChangedWhenPrepared">
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="options:RankOptionWrapper">
|
||||
<TextBlock Text="{x:Bind LocalizedString}" />
|
||||
</DataTemplate>
|
||||
</notifyOnLoadedComboBox:NotifyOnLoadedComboBox.ItemTemplate>
|
||||
</notifyOnLoadedComboBox:NotifyOnLoadedComboBox>
|
||||
<notifyOnLoadedCalendarDatePicker:NotifyOnLoadedCalendarDatePicker x:Name="RankDateTimeCalendarDatePicker"
|
||||
Margin="10,0,0,0"
|
||||
DateChangedWhenLoaded="RankDateTimeCalendarDatePicker_OnDateChangedWhenLoaded"
|
||||
MaxDate="{x:Bind MaxDate}" />
|
||||
<Grid x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
<notifyOnLoadedCalendarDatePicker:NotifyOnLoadedCalendarDatePicker
|
||||
x:Name="RankDateTimeCalendarDatePicker"
|
||||
Margin="10,0,0,0"
|
||||
DateChangedWhenLoaded="RankDateTimeCalendarDatePicker_OnDateChangedWhenLoaded"
|
||||
MaxDate="{x:Bind MaxDate}" />
|
||||
<Grid
|
||||
x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox
|
||||
x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
</Grid>
|
||||
</userControls:IllustrationContainer.CommandBarElements>
|
||||
</userControls:IllustrationContainer>
|
||||
|
@ -60,14 +60,6 @@ public sealed partial class RankingsPage : ISortedIllustrationContainerPageHelpe
|
||||
WeakReferenceMessenger.Default.TryRegister<RankingsPage, MainPageFrameNavigatingEvent>(this, static (recipient, _) => recipient.IllustrationContainer.ViewModel.DataProvider.FetchEngine?.Cancel());
|
||||
}
|
||||
|
||||
private void RankingsPage_OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.GetNavigationModeAndReset() is not NavigationMode.Back)
|
||||
{
|
||||
ChangeSource();
|
||||
}
|
||||
}
|
||||
|
||||
private void RankOptionComboBox_OnSelectionChangedWhenPrepared(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ChangeSource();
|
||||
|
@ -1,37 +1,41 @@
|
||||
<controls:EnhancedPage x:Class="Pixeval.Pages.Capability.RecentPostsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enum="using:Pixeval.CoreApi.Global.Enum"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
ClearCacheAfterNavigation="True"
|
||||
Loaded="RecentPostsPage_OnLoaded"
|
||||
mc:Ignorable="d">
|
||||
<controls:EnhancedPage
|
||||
x:Class="Pixeval.Pages.Capability.RecentPostsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enum="using:Pixeval.CoreApi.Global.Enum"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
ClearCacheAfterNavigation="True"
|
||||
mc:Ignorable="d">
|
||||
<userControls:IllustrationContainer x:Name="IllustrationContainer">
|
||||
<userControls:IllustrationContainer.CommandBarElements>
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox x:Name="PrivacyPolicyComboBox"
|
||||
x:Uid="/RecentPostsPage/PrivacyPolicyComboBox"
|
||||
SelectionChangedWhenLoaded="PrivacyPolicyComboBox_OnSelectionChangedWhenLoaded">
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox
|
||||
x:Name="PrivacyPolicyComboBox"
|
||||
x:Uid="/RecentPostsPage/PrivacyPolicyComboBox"
|
||||
SelectionChangedWhenLoaded="PrivacyPolicyComboBox_OnSelectionChangedWhenLoaded">
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox.Items>
|
||||
<ComboBoxItem x:Name="PrivacyPolicyComboBoxPublicItem"
|
||||
x:Uid="/RecentPostsPage/PrivacyPolicyComboBoxPublicComboBoxItem"
|
||||
Tag="{x:Bind enum:PrivacyPolicy.Public}" />
|
||||
<ComboBoxItem
|
||||
x:Name="PrivacyPolicyComboBoxPublicItem"
|
||||
x:Uid="/RecentPostsPage/PrivacyPolicyComboBoxPublicComboBoxItem"
|
||||
Tag="{x:Bind enum:PrivacyPolicy.Public}" />
|
||||
<ComboBoxItem x:Uid="/RecentPostsPage/PrivacyPolicyComboBoxPrivateComboBoxItem" Tag="{x:Bind enum:PrivacyPolicy.Private}" />
|
||||
</notifyOnLoadedComboBox:NotifyOnLoadedComboBox.Items>
|
||||
</notifyOnLoadedComboBox:NotifyOnLoadedComboBox>
|
||||
<Grid x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
<Grid
|
||||
x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox
|
||||
x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
</Grid>
|
||||
</userControls:IllustrationContainer.CommandBarElements>
|
||||
</userControls:IllustrationContainer>
|
||||
</controls:EnhancedPage>
|
||||
</controls:EnhancedPage>
|
||||
|
@ -49,21 +49,13 @@ public sealed partial class RecentPostsPage : ISortedIllustrationContainerPageHe
|
||||
WeakReferenceMessenger.Default.UnregisterAll(this);
|
||||
}
|
||||
|
||||
public override void OnPageActivated(NavigationEventArgs navigationEventArgs)
|
||||
public override void OnPageActivated(NavigationEventArgs e)
|
||||
{
|
||||
PrivacyPolicyComboBox.SelectedItem = PrivacyPolicyComboBoxPublicItem;
|
||||
SortOptionComboBox.SelectedItem = MakoHelper.GetAppSettingDefaultSortOptionWrapper();
|
||||
WeakReferenceMessenger.Default.TryRegister<RecentPostsPage, MainPageFrameNavigatingEvent>(this, static (recipient, _) => recipient.IllustrationContainer.ViewModel.DataProvider.FetchEngine?.Cancel());
|
||||
}
|
||||
|
||||
private void RecentPostsPage_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.GetNavigationModeAndReset() is not NavigationMode.Back)
|
||||
{
|
||||
ChangeSource();
|
||||
}
|
||||
}
|
||||
|
||||
private void PrivacyPolicyComboBox_OnSelectionChangedWhenLoaded(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ChangeSource();
|
||||
|
@ -1,37 +1,41 @@
|
||||
<controls:EnhancedPage x:Class="Pixeval.Pages.Capability.RecommendationPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enum="using:Pixeval.CoreApi.Global.Enum"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
ClearCacheAfterNavigation="True"
|
||||
Loaded="RecommendationsPage_OnLoaded"
|
||||
mc:Ignorable="d">
|
||||
<controls:EnhancedPage
|
||||
x:Class="Pixeval.Pages.Capability.RecommendationPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enum="using:Pixeval.CoreApi.Global.Enum"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
ClearCacheAfterNavigation="True"
|
||||
mc:Ignorable="d">
|
||||
<userControls:IllustrationContainer x:Name="IllustrationContainer">
|
||||
<userControls:IllustrationContainer.CommandBarElements>
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox x:Name="ModeSelectionComboBox"
|
||||
x:Uid="/RecommendationsPage/ModeSelectionComboBox"
|
||||
SelectionChangedWhenLoaded="ModeSelectionComboBox_OnSelectionChangedWhenLoaded">
|
||||
<notifyOnLoadedComboBox:NotifyOnLoadedComboBox
|
||||
x:Name="ModeSelectionComboBox"
|
||||
x:Uid="/RecommendationsPage/ModeSelectionComboBox"
|
||||
SelectionChangedWhenLoaded="ModeSelectionComboBox_OnSelectionChangedWhenLoaded">
|
||||
<ComboBox.Items>
|
||||
<ComboBoxItem x:Name="ModeSelectionComboBoxIllustComboBoxItem"
|
||||
x:Uid="/RecommendationsPage/ModeSelectionComboBoxIllustComboBoxItem"
|
||||
Tag="{x:Bind enum:RecommendationContentType.Illust}" />
|
||||
<ComboBoxItem
|
||||
x:Name="ModeSelectionComboBoxIllustComboBoxItem"
|
||||
x:Uid="/RecommendationsPage/ModeSelectionComboBoxIllustComboBoxItem"
|
||||
Tag="{x:Bind enum:RecommendationContentType.Illust}" />
|
||||
<ComboBoxItem x:Uid="/RecommendationsPage/ModeSelectionComboBoxMangaComboBoxItem" Tag="{x:Bind enum:RecommendationContentType.Manga}" />
|
||||
</ComboBox.Items>
|
||||
</notifyOnLoadedComboBox:NotifyOnLoadedComboBox>
|
||||
<Grid x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
<Grid
|
||||
x:Name="SortOptionComboBoxContainer"
|
||||
Margin="10,0,0,0"
|
||||
Background="Transparent"
|
||||
Loaded="SortOptionComboBoxContainer_OnLoaded">
|
||||
<userControls:SortOptionComboBox
|
||||
x:Name="SortOptionComboBox"
|
||||
IsEnabled="{x:Bind ui:UIHelper.GetIllustrationViewSortOptionAvailability(pixeval:App.AppViewModel.AppSetting.IllustrationViewOption)}"
|
||||
SelectionChangedWhenLoaded="SortOptionComboBox_OnSelectionChanged" />
|
||||
</Grid>
|
||||
</userControls:IllustrationContainer.CommandBarElements>
|
||||
</userControls:IllustrationContainer>
|
||||
</controls:EnhancedPage>
|
||||
</controls:EnhancedPage>
|
||||
|
@ -58,14 +58,6 @@ public sealed partial class RecommendationPage : ISortedIllustrationContainerPag
|
||||
WeakReferenceMessenger.Default.TryRegister<RecommendationPage, MainPageFrameNavigatingEvent>(this, static (recipient, _) => recipient.IllustrationContainer.ViewModel.DataProvider.FetchEngine?.Cancel());
|
||||
}
|
||||
|
||||
private void RecommendationsPage_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MainWindow.GetNavigationModeAndReset() is not NavigationMode.Back)
|
||||
{
|
||||
ChangeSource();
|
||||
}
|
||||
}
|
||||
|
||||
private void ModeSelectionComboBox_OnSelectionChangedWhenLoaded(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ChangeSource();
|
||||
|
@ -192,7 +192,7 @@ public sealed partial class DownloadListEntry
|
||||
.GetMangaIllustrationViewModels()
|
||||
.ToArray();
|
||||
|
||||
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", App.AppViewModel.AppWindowRootFrame);
|
||||
// ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", App.AppViewModel.AppWindowRootFrame);
|
||||
// todo UIHelper.RootFrameNavigate(typeof(IllustrationViewerPage), new IllustrationViewerPageViewModel(viewModels), new SuppressNavigationTransitionInfo());
|
||||
break;
|
||||
}
|
||||
|
@ -1,23 +1,22 @@
|
||||
<pixevalControls:EnhancedPage x:Class="Pixeval.Pages.IllustrationViewer.IllustrationInfoPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:model="using:Pixeval.CoreApi.Model"
|
||||
xmlns:pixevalControls="using:Pixeval.Controls"
|
||||
xmlns:viewer="using:Pixeval.Pages.IllustrationViewer"
|
||||
Background="{ThemeResource PixevalPanelBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
<pixevalControls:EnhancedPage
|
||||
x:Class="Pixeval.Pages.IllustrationViewer.IllustrationInfoPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:model="using:Pixeval.CoreApi.Model"
|
||||
xmlns:pixevalControls="using:Pixeval.Controls"
|
||||
xmlns:viewer="using:Pixeval.Pages.IllustrationViewer"
|
||||
Background="{ThemeResource PixevalPanelBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
<pixevalControls:EnhancedPage.Resources>
|
||||
<Style x:Key="InfoPageSectionHeaderTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
<Style x:Key="InfoPageSectionHeaderTextBlockStyle" 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" TargetType="TextBlock">
|
||||
<Setter Property="Margin" Value="{StaticResource StackLayoutEntryPadding}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource PixevalContentFontSize}" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
@ -25,90 +24,76 @@
|
||||
<Setter Property="MaxHeight" Value="200" />
|
||||
</Style>
|
||||
</pixevalControls:EnhancedPage.Resources>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
|
||||
HorizontalScrollMode="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
HorizontalScrollMode="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="20,15">
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/TitleTextBlock"
|
||||
FontSize="{StaticResource PixevalSubtitleFontSize}"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock
|
||||
x:Uid="/IllustrationInfoPage/TitleTextBlock"
|
||||
FontSize="{StaticResource PixevalSubtitleFontSize}"
|
||||
FontWeight="Bold" />
|
||||
<!--#region Illustrator Info-->
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustratorTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<StackPanel Margin="{StaticResource StackLayoutEntryPadding}"
|
||||
Orientation="Horizontal">
|
||||
<PersonPicture Width="50"
|
||||
Height="50"
|
||||
ProfilePicture="{x:Bind _viewModel.UserProfileImageSource, Mode=OneWay}"
|
||||
Tapped="IllustratorPersonPicture_OnTapped" />
|
||||
<StackPanel Margin="10,0,0,0"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock FontSize="{StaticResource PixevalContentFontSize}"
|
||||
Text="{x:Bind GetIllustratorNameText()}" />
|
||||
<TextBlock Margin="{StaticResource StackLayoutEntryPadding}"
|
||||
FontSize="{StaticResource PixevalContentFontSize}"
|
||||
Text="{x:Bind GetIllustratorIdText()}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustratorTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<StackPanel Margin="{StaticResource StackLayoutEntryPadding}" Orientation="Horizontal">
|
||||
<PersonPicture
|
||||
Width="50"
|
||||
Height="50"
|
||||
ProfilePicture="{x:Bind _viewModel.UserProfileImageSource, Mode=OneWay}"
|
||||
Tapped="IllustratorPersonPicture_OnTapped" />
|
||||
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock FontSize="{StaticResource PixevalContentFontSize}" Text="{x:Bind GetIllustratorNameText()}" />
|
||||
<TextBlock
|
||||
Margin="{StaticResource StackLayoutEntryPadding}"
|
||||
FontSize="{StaticResource PixevalContentFontSize}"
|
||||
Text="{x:Bind GetIllustratorIdText()}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!--#endregion-->
|
||||
<!--#region Illustration Title-->
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTitleTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}"
|
||||
Text="{x:Bind _viewModel.Current.IllustrationViewModel.Illustration.Title}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTitleTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}" Text="{x:Bind _viewModel.Current.IllustrationViewModel.Illustration.Title}" />
|
||||
<!--#endregion-->
|
||||
<!--#region Illustration Id-->
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationIdTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}"
|
||||
Text="{x:Bind _viewModel.Current.IllustrationViewModel.Id}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationIdTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}" Text="{x:Bind _viewModel.Current.IllustrationViewModel.Id}" />
|
||||
<!--#endregion-->
|
||||
<!--#region Illustration Caption-->
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationCaptionTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<controls:MarkdownTextBlock x:Name="IllustrationCaptionMarkdownTextBlock"
|
||||
MaxHeight="200"
|
||||
Margin="{StaticResource StackLayoutEntryPadding}"
|
||||
Background="{ThemeResource PixevalPanelBackgroundThemeBrush}"
|
||||
FontSize="{StaticResource PixevalContentFontSize}"
|
||||
LinkClicked="IllustrationCaptionMarkdownTextBlock_OnLinkClicked"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationCaptionTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<controls:MarkdownTextBlock
|
||||
x:Name="IllustrationCaptionMarkdownTextBlock"
|
||||
MaxHeight="200"
|
||||
Margin="{StaticResource StackLayoutEntryPadding}"
|
||||
Background="{ThemeResource PixevalPanelBackgroundThemeBrush}"
|
||||
FontSize="{StaticResource PixevalContentFontSize}"
|
||||
LinkClicked="IllustrationCaptionMarkdownTextBlock_OnLinkClicked"
|
||||
TextWrapping="Wrap" />
|
||||
<!--#endregion-->
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTotalBookmarksTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}"
|
||||
Text="{x:Bind _viewModel.Current.IllustrationViewModel.Illustration.TotalBookmarks}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTotalViewsTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}"
|
||||
Text="{x:Bind _viewModel.Current.IllustrationViewModel.Illustration.TotalView}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationDimensionTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}"
|
||||
Text="{x:Bind GetIllustrationDimensionText()}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationUploadDateTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}"
|
||||
Text="{x:Bind GetIllustrationUploadDateText()}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTagListTextBlock"
|
||||
Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<ItemsControl Margin="{StaticResource StackLayoutEntryPadding}"
|
||||
ItemsSource="{x:Bind GetIllustrationTagItemSource()}">
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTotalBookmarksTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}" Text="{x:Bind _viewModel.Current.IllustrationViewModel.Illustration.TotalBookmarks}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTotalViewsTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}" Text="{x:Bind _viewModel.Current.IllustrationViewModel.Illustration.TotalView}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationDimensionTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}" Text="{x:Bind GetIllustrationDimensionText()}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationUploadDateTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock Style="{StaticResource InfoPageSectionContentTextBlockStyle}" Text="{x:Bind GetIllustrationUploadDateText()}" />
|
||||
<TextBlock x:Uid="/IllustrationInfoPage/IllustrationTagListTextBlock" Style="{StaticResource InfoPageSectionHeaderTextBlockStyle}" />
|
||||
<ItemsControl Margin="{StaticResource StackLayoutEntryPadding}" ItemsSource="{x:Bind GetIllustrationTagItemSource()}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="model:Tag">
|
||||
<Button Click="IllustrationTagButton_OnClick"
|
||||
Content="{x:Bind Name}"
|
||||
FontSize="{StaticResource PixevalSubscriptFontSize}"
|
||||
ToolTipService.ToolTip="{x:Bind viewer:IllustrationInfoPage.GetMakoTagTranslatedNameText(TranslatedName, Name)}" />
|
||||
<Button
|
||||
Click="IllustrationTagButton_OnClick"
|
||||
Content="{x:Bind Name}"
|
||||
FontSize="{StaticResource PixevalSubscriptFontSize}"
|
||||
ToolTipService.ToolTip="{x:Bind viewer:IllustrationInfoPage.GetMakoTagTranslatedNameText(TranslatedName, Name)}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<controls:WrapPanel HorizontalSpacing="5"
|
||||
VerticalSpacing="5" />
|
||||
<controls:WrapPanel HorizontalSpacing="5" VerticalSpacing="5" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</pixevalControls:EnhancedPage>
|
||||
</pixevalControls:EnhancedPage>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
@ -38,6 +38,7 @@ using Pixeval.Pages.IllustratorViewer;
|
||||
using Pixeval.Util.UI;
|
||||
using Pixeval.Utilities;
|
||||
using ReverseMarkdown;
|
||||
using WinUI3Utilities;
|
||||
|
||||
namespace Pixeval.Pages.IllustrationViewer;
|
||||
|
||||
@ -71,10 +72,11 @@ public sealed partial class IllustrationInfoPage
|
||||
if (_viewModel.UserInfo is { } userInfo)
|
||||
{
|
||||
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", (UIElement)sender);
|
||||
UIHelper.RootFrameNavigate(typeof(IllustratorPage), Tuple.Create((UIElement)sender, new IllustratorViewModel(userInfo)), new SlideNavigationTransitionInfo
|
||||
{
|
||||
Effect = SlideNavigationTransitionEffect.FromRight
|
||||
});
|
||||
// todo IllustratorPage use Navigate
|
||||
// CurrentContext.Window.Content.To<Frame>().Navigate(typeof(IllustratorPage), Tuple.Create((UIElement)sender, new IllustratorViewModel(userInfo)), new SlideNavigationTransitionInfo
|
||||
// {
|
||||
// Effect = SlideNavigationTransitionEffect.FromRight
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,4 +126,4 @@ public sealed partial class IllustrationInfoPage
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public sealed partial class IllustrationViewerPage : ISupportCustomTitleBarDragR
|
||||
|
||||
Navigate<ImageViewerPage>(IllustrationImageShowcaseFrame, _viewModel.Current);
|
||||
|
||||
WeakReferenceMessenger.Default.Send(new MainPageFrameSetConnectedAnimationTargetMessage(_viewModel.IllustrationView?.GetItemContainer(_viewModel.IllustrationViewModelInTheGridView!) ?? App.AppViewModel.AppWindowRootFrame));
|
||||
// todo WeakReferenceMessenger.Default.Send(new MainPageFrameSetConnectedAnimationTargetMessage(_viewModel.IllustrationView?.GetItemContainer(_viewModel.IllustrationViewModelInTheGridView!) ?? App.AppViewModel.AppWindowRootFrame));
|
||||
}
|
||||
|
||||
private void ExitFullScreenKeyboardAccelerator_OnInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args) => _viewModel.IsFullScreen = false;
|
||||
|
@ -1,92 +1,108 @@
|
||||
<controls:EnhancedPage x:Class="Pixeval.Pages.IllustratorViewer.IllustratorPage"
|
||||
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.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Pixeval.Pages.Capability"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:notifyOnLoadedComboBox="using:Pixeval.Controls.NotifyOnLoadedComboBox"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
Loaded="IllustratorPage_OnLoaded"
|
||||
SizeChanged="IllustratorPage_OnSizeChanged"
|
||||
mc:Ignorable="d">
|
||||
<controls1:DockPanel x:Name="IllustrationPresenterDockPanel"
|
||||
HorizontalAlignment="Stretch"
|
||||
LastChildFill="True">
|
||||
<controls:EnhancedPage
|
||||
x:Class="Pixeval.Pages.IllustratorViewer.IllustratorPage"
|
||||
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.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Pixeval.Pages.Capability"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:userControls="using:Pixeval.UserControls"
|
||||
Loaded="IllustratorPage_OnLoaded"
|
||||
SizeChanged="IllustratorPage_OnSizeChanged"
|
||||
mc:Ignorable="d">
|
||||
<controls1:DockPanel
|
||||
x:Name="IllustrationPresenterDockPanel"
|
||||
HorizontalAlignment="Stretch"
|
||||
LastChildFill="True">
|
||||
<userControls:IllustrationContainer x:Name="IllustrationContainer" controls1:DockPanel.Dock="Top">
|
||||
<userControls:IllustrationContainer.Header>
|
||||
<Grid x:Name="Header"
|
||||
Height="250"
|
||||
VerticalAlignment="Center"
|
||||
controls1:DockPanel.Dock="Top">
|
||||
<Rectangle x:Name="BackgroundRectangle"
|
||||
Height="250"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top">
|
||||
<Grid
|
||||
x:Name="Header"
|
||||
Height="250"
|
||||
VerticalAlignment="Center"
|
||||
controls1:DockPanel.Dock="Top">
|
||||
<Rectangle
|
||||
x:Name="BackgroundRectangle"
|
||||
Height="250"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top">
|
||||
<Rectangle.Fill>
|
||||
<ImageBrush x:Name="BackgroundImage"
|
||||
ImageSource="ms-appx:///Assets/Images/pixeval-mock.png"
|
||||
Opacity="0.6"
|
||||
Stretch="UniformToFill" />
|
||||
<ImageBrush
|
||||
x:Name="BackgroundImage"
|
||||
ImageSource="ms-appx:///Assets/Images/pixeval-mock.png"
|
||||
Opacity="0.6"
|
||||
Stretch="UniformToFill" />
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Rectangle x:Name="OverlayRectangle"
|
||||
Height="250"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Fill="#BFCFB5C0" />
|
||||
<StackPanel x:Name="TextContainer"
|
||||
HorizontalAlignment="Left"
|
||||
Orientation="Horizontal">
|
||||
<Ellipse x:Name="ProfileImage"
|
||||
Width="100"
|
||||
Height="100"
|
||||
Margin="20,65,20,0"
|
||||
VerticalAlignment="Top">
|
||||
<Rectangle
|
||||
x:Name="OverlayRectangle"
|
||||
Height="250"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Fill="#BFCFB5C0" />
|
||||
<StackPanel
|
||||
x:Name="TextContainer"
|
||||
HorizontalAlignment="Left"
|
||||
Orientation="Horizontal">
|
||||
<Ellipse
|
||||
x:Name="ProfileImage"
|
||||
Width="100"
|
||||
Height="100"
|
||||
Margin="20,65,20,0"
|
||||
VerticalAlignment="Top">
|
||||
<Ellipse.Fill>
|
||||
<ImageBrush ImageSource="{x:Bind _viewModel.AvatarSource, Mode=OneWay}" Stretch="UniformToFill" />
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
<StackPanel Margin="0,65,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Vertical">
|
||||
<TextBlock FontSize="20"
|
||||
Foreground="White"
|
||||
Text="{x:Bind _viewModel.Name, Mode=OneWay}" />
|
||||
<TextBlock x:Name="SubtitleBlock"
|
||||
Margin="0,10,0,0"
|
||||
FontSize="10"
|
||||
Foreground="White"
|
||||
Text="{x:Bind _viewModel.Id, Mode=OneWay}" />
|
||||
<TextBlock x:Name="Blurb"
|
||||
Width="400"
|
||||
Margin="0,20,0,0"
|
||||
FontSize="12"
|
||||
Foreground="White"
|
||||
TextWrapping="Wrap">
|
||||
<StackPanel
|
||||
Margin="0,65,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Vertical">
|
||||
<TextBlock
|
||||
FontSize="20"
|
||||
Foreground="White"
|
||||
Text="{x:Bind _viewModel.Name, Mode=OneWay}" />
|
||||
<TextBlock
|
||||
x:Name="SubtitleBlock"
|
||||
Margin="0,10,0,0"
|
||||
FontSize="10"
|
||||
Foreground="White"
|
||||
Text="{x:Bind _viewModel.Id, Mode=OneWay}" />
|
||||
<TextBlock
|
||||
x:Name="Blurb"
|
||||
Width="400"
|
||||
Margin="0,20,0,0"
|
||||
FontSize="12"
|
||||
Foreground="White"
|
||||
TextWrapping="Wrap">
|
||||
<Run Text="{x:Bind _viewModel.Comment}" />
|
||||
</TextBlock>
|
||||
<StackPanel Margin="-15,50,0,20"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Bottom">
|
||||
<CommandBar x:Name="CommandBar"
|
||||
Background="Transparent"
|
||||
DefaultLabelPosition="Right">
|
||||
<StackPanel
|
||||
Margin="-15,50,0,20"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Bottom">
|
||||
<CommandBar
|
||||
x:Name="CommandBar"
|
||||
Background="Transparent"
|
||||
DefaultLabelPosition="Right">
|
||||
<AppBarButton Command="{x:Bind OpenLinkCommand}" Tapped="OpenLinkButton_OnTapped" />
|
||||
<AppBarButton Command="{x:Bind FollowCommand}"
|
||||
IsEnabled="{x:Bind _viewModel.IsFollowButtonEnabled, Mode=OneWay}"
|
||||
Tapped="FollowButton_OnTapped"
|
||||
Visibility="{x:Bind _viewModel.IsNotFollowed(_viewModel.IsFollowed), Mode=OneWay}" />
|
||||
<AppBarButton Command="{x:Bind PrivateFollowCommand}"
|
||||
IsEnabled="{x:Bind _viewModel.IsFollowButtonEnabled, Mode=OneWay}"
|
||||
Tapped="PrivateFollowButton_OnTapped"
|
||||
Visibility="{x:Bind _viewModel.IsNotFollowed(_viewModel.IsFollowed), Mode=OneWay}" />
|
||||
<AppBarButton Command="{x:Bind UnfollowCommand}"
|
||||
IsEnabled="{x:Bind _viewModel.IsFollowButtonEnabled, Mode=OneWay}"
|
||||
Tapped="UnfollowButton_OnTapped"
|
||||
Visibility="{x:Bind _viewModel.IsFollowed, Mode=OneWay}" />
|
||||
<AppBarButton
|
||||
Command="{x:Bind FollowCommand}"
|
||||
IsEnabled="{x:Bind _viewModel.IsFollowButtonEnabled, Mode=OneWay}"
|
||||
Tapped="FollowButton_OnTapped"
|
||||
Visibility="{x:Bind _viewModel.IsNotFollowed(_viewModel.IsFollowed), Mode=OneWay}" />
|
||||
<AppBarButton
|
||||
Command="{x:Bind PrivateFollowCommand}"
|
||||
IsEnabled="{x:Bind _viewModel.IsFollowButtonEnabled, Mode=OneWay}"
|
||||
Tapped="PrivateFollowButton_OnTapped"
|
||||
Visibility="{x:Bind _viewModel.IsNotFollowed(_viewModel.IsFollowed), Mode=OneWay}" />
|
||||
<AppBarButton
|
||||
Command="{x:Bind UnfollowCommand}"
|
||||
IsEnabled="{x:Bind _viewModel.IsFollowButtonEnabled, Mode=OneWay}"
|
||||
Tapped="UnfollowButton_OnTapped"
|
||||
Visibility="{x:Bind _viewModel.IsFollowed, Mode=OneWay}" />
|
||||
|
||||
</CommandBar>
|
||||
</StackPanel>
|
||||
@ -95,12 +111,12 @@
|
||||
</Grid>
|
||||
</userControls:IllustrationContainer.Header>
|
||||
<userControls:IllustrationContainer.CommandBarElements>
|
||||
<AppBarButton Width="48"
|
||||
Icon="Back"
|
||||
LabelPosition="Collapsed"
|
||||
Tapped="BackButton_OnTapped" />
|
||||
<AppBarButton
|
||||
Width="48"
|
||||
Icon="Back"
|
||||
LabelPosition="Collapsed"
|
||||
Tapped="BackButton_OnTapped" />
|
||||
</userControls:IllustrationContainer.CommandBarElements>
|
||||
</userControls:IllustrationContainer>
|
||||
|
||||
</controls1:DockPanel>
|
||||
</controls:EnhancedPage>
|
||||
|
@ -38,6 +38,7 @@ using Pixeval.Messages;
|
||||
using Pixeval.UserControls;
|
||||
using Pixeval.Util;
|
||||
using Pixeval.Util.UI;
|
||||
using WinUI3Utilities;
|
||||
|
||||
namespace Pixeval.Pages.IllustratorViewer;
|
||||
|
||||
@ -217,10 +218,7 @@ public sealed partial class IllustratorPage
|
||||
public void GoBack()
|
||||
{
|
||||
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", ProfileImage);
|
||||
if (App.AppViewModel.AppWindowRootFrame.CanGoBack)
|
||||
{
|
||||
App.AppViewModel.AppWindowRootFrame.GoBack(new SuppressNavigationTransitionInfo());
|
||||
}
|
||||
Parent.To<Frame>().GoBack(new SuppressNavigationTransitionInfo());
|
||||
}
|
||||
|
||||
private void BackButton_OnTapped(object sender, TappedRoutedEventArgs e)
|
||||
|
@ -31,12 +31,11 @@ using Pixeval.CoreApi.Net;
|
||||
using Pixeval.Messages;
|
||||
using Pixeval.Misc;
|
||||
using Pixeval.Pages.Capability;
|
||||
using Pixeval.Pages.IllustrationViewer;
|
||||
using Pixeval.Pages.Misc;
|
||||
using Pixeval.UserControls.IllustrationView;
|
||||
using Pixeval.Util.IO;
|
||||
using Pixeval.Util.UI;
|
||||
using WinUI3Utilities;
|
||||
using IllustrationViewModel = Pixeval.UserControls.IllustrationView.IllustrationViewModel;
|
||||
|
||||
namespace Pixeval.Pages;
|
||||
|
||||
@ -88,10 +87,10 @@ public partial class MainPageViewModel : AutoActivateObservableRecipient, IRecip
|
||||
|
||||
public async Task ReverseSearchAsync(Stream stream)
|
||||
{
|
||||
var window = (MainWindow)CurrentContext.Window;
|
||||
var window = CurrentContext.Window;
|
||||
try
|
||||
{
|
||||
window.ShowProgressRing();
|
||||
//todo window.ShowProgressRing();
|
||||
var result = await App.AppViewModel.MakoClient.ReverseSearchAsync(stream, App.AppViewModel.AppSetting.ReverseSearchApiKey!);
|
||||
if (result.Header is not null)
|
||||
{
|
||||
@ -103,8 +102,8 @@ public partial class MainPageViewModel : AutoActivateObservableRecipient, IRecip
|
||||
var viewModels = new IllustrationViewModel(await App.AppViewModel.MakoClient.GetIllustrationFromIdAsync(first.Data!.PixivId.ToString()))
|
||||
.GetMangaIllustrationViewModels()
|
||||
.ToArray();
|
||||
window.HideProgressRing();
|
||||
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", App.AppViewModel.AppWindowRootFrame);
|
||||
// window.HideProgressRing();
|
||||
// ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", App.AppViewModel.AppWindowRootFrame);
|
||||
// todo UIHelper.RootFrameNavigate(typeof(IllustrationViewerPage), new IllustrationViewerPageViewModel(viewModels), new SuppressNavigationTransitionInfo());
|
||||
return;
|
||||
}
|
||||
@ -119,13 +118,13 @@ public partial class MainPageViewModel : AutoActivateObservableRecipient, IRecip
|
||||
break;
|
||||
}
|
||||
|
||||
window.HideProgressRing();
|
||||
// window.HideProgressRing();
|
||||
MessageDialogBuilder.CreateAcknowledgement(window, MainPageResources.ReverseSearchNotFoundTitle, MainPageResources.ReverseSearchNotFoundContent);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
window.HideProgressRing();
|
||||
// window.HideProgressRing();
|
||||
await App.AppViewModel.ShowExceptionDialogAsync(e);
|
||||
}
|
||||
}
|
||||
|
@ -2,20 +2,14 @@
|
||||
x:Class="Pixeval.Pages.Misc.SettingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:actionableExpanderSettingEntry="using:Pixeval.Controls.Setting.UI.ActionableExpanderSettingEntry"
|
||||
xmlns:actionableSettingEntry="using:Pixeval.Controls.Setting.UI.ActionableSettingEntry"
|
||||
xmlns:controls="using:Pixeval.Controls"
|
||||
xmlns:controls1="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:expanderSettingEntry="using:Pixeval.Controls.Setting.UI.ExpanderSettingEntry"
|
||||
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:misc="using:Pixeval.Pages.Misc"
|
||||
xmlns:model="using:Pixeval.Controls.Setting.UI.Model"
|
||||
xmlns:pixeval="using:Pixeval"
|
||||
xmlns:settingsGroup="using:Pixeval.Controls.Setting.UI.SettingsGroup"
|
||||
xmlns:sliderSettingEntry="using:Pixeval.Controls.Setting.UI.SliderSettingEntry"
|
||||
xmlns:switchSettingEntry="using:Pixeval.Controls.Setting.UI.SwitchSettingEntry"
|
||||
xmlns:system="using:System"
|
||||
xmlns:tokenInput="using:Pixeval.UserControls.TokenInput"
|
||||
xmlns:ui="using:Pixeval.Util.UI"
|
||||
@ -183,7 +177,7 @@
|
||||
<ui1:SettingRadioButtons
|
||||
ItemsSource="{x:Bind model:ApplicationThemeSettingEntryItem.AvailableItems}"
|
||||
SelectedItem="{x:Bind _viewModel.Theme, Mode=TwoWay}"
|
||||
SelectionChanged="SingleSelectionSettingEntry_OnSelectionChanged" />
|
||||
SelectionChanged="Theme_OnSelectionChanged" />
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
@ -194,7 +188,10 @@
|
||||
Tag="{x:Bind pixeval:SettingEntry.AppBackdrop}">
|
||||
<labs:SettingsExpander.Items>
|
||||
<labs:SettingsCard ContentAlignment="Left">
|
||||
<ui1:SettingRadioButtons ItemsSource="{x:Bind model:ApplicationBackdropSettingEntryItem.AvailableItems}" SelectedItem="{x:Bind _viewModel.AppBackdrop, Mode=TwoWay}" />
|
||||
<ui1:SettingRadioButtons
|
||||
ItemsSource="{x:Bind model:ApplicationBackdropSettingEntryItem.AvailableItems}"
|
||||
SelectedItem="{x:Bind _viewModel.AppBackdrop, Mode=TwoWay}"
|
||||
SelectionChanged="Backdrop_OnSelectionChanged" />
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
|
@ -33,6 +33,7 @@ using Pixeval.Util.Threading;
|
||||
using Pixeval.Util.UI;
|
||||
using Pixeval.Utilities;
|
||||
using Windows.System;
|
||||
using Pixeval.Util.UI.Windowing;
|
||||
using WinUI3Utilities;
|
||||
using AppContext = Pixeval.AppManagement.AppContext;
|
||||
|
||||
@ -68,9 +69,14 @@ public sealed partial class SettingsPage
|
||||
CheckForUpdatesEntry.Header = GitVersionInformation.SemVer;
|
||||
}
|
||||
|
||||
private void SingleSelectionSettingEntry_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
private void Theme_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
App.AppViewModel.SwitchTheme(_viewModel.Theme);
|
||||
WindowFactory.SetTheme(_viewModel.Theme);
|
||||
}
|
||||
|
||||
private void Backdrop_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
WindowFactory.SetBackdrop(_viewModel.AppBackdrop);
|
||||
}
|
||||
|
||||
private async void ThemeEntryDescriptionHyperlinkButton_OnTapped(object sender, TappedRoutedEventArgs e)
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
@ -137,9 +137,6 @@
|
||||
<data name="ApplicationSettingsGroup.Text" xml:space="preserve">
|
||||
<value>应用程序相关设置</value>
|
||||
</data>
|
||||
<data name="BackdropEntry.Description" xml:space="preserve">
|
||||
<value>该选项将在应用重启后生效</value>
|
||||
</data>
|
||||
<data name="BackdropEntry.Header" xml:space="preserve">
|
||||
<value>应用的背景材质</value>
|
||||
</data>
|
||||
@ -465,7 +462,7 @@
|
||||
<value>使用的 API 平台</value>
|
||||
</data>
|
||||
<data name="ThemeEntry.Header" xml:space="preserve">
|
||||
<value>应用程序主题(重启应用后完全生效)</value>
|
||||
<value>应用程序主题</value>
|
||||
</data>
|
||||
<data name="ThemeEntryDescriptionHyperlinkButton.Content" xml:space="preserve">
|
||||
<value>打开 Windows 系统主题设置</value>
|
||||
@ -497,4 +494,4 @@
|
||||
<data name="ViewPixevalWebsiteHyperlinkButton.Content" xml:space="preserve">
|
||||
<value>介绍网页</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
|
@ -116,14 +116,10 @@ public sealed partial class IllustrationView
|
||||
// TODO: Test Use the new windowing API
|
||||
var (width, height) = DetermineWindowSize(viewModels[0].Illustration.Width, viewModels[0].Illustration.Width / (double)viewModels[0].Illustration.Height);
|
||||
|
||||
CurrentContext.Window.Fork(out var w)
|
||||
WindowFactory.RootWindow.Fork(out var w)
|
||||
.WithLoaded((o, _) => o.To<Frame>().Navigate<IllustrationViewerPage>(w,
|
||||
new IllustrationViewerPageViewModel(this, viewModels), new SuppressNavigationTransitionInfo()))
|
||||
.Initialize(new()
|
||||
{
|
||||
TitleBarType = TitleBarHelper.TitleBarType.AppWindow,
|
||||
Size = new SizeInt32(width, height)
|
||||
})
|
||||
.Init(new SizeInt32(width, height))
|
||||
.Activate();
|
||||
}
|
||||
|
||||
|
@ -229,48 +229,49 @@ public sealed partial class IllustrationViewCommandBar
|
||||
|
||||
private void FilterTeachingTip_OnCloseButtonClick(TeachingTip sender, object args)
|
||||
{
|
||||
if (FilterContent.GetFilterSettings is (
|
||||
var includeTags,
|
||||
var excludeTags,
|
||||
var leastBookmark,
|
||||
var maximumBookmark,
|
||||
_, // TODO user group name
|
||||
var illustratorName,
|
||||
var illustratorId,
|
||||
var illustrationName,
|
||||
var illustrationId,
|
||||
var publishDateStart,
|
||||
var publishDateEnd) filterSettings)
|
||||
if (FilterContent.GetFilterSettings is not (
|
||||
var includeTags,
|
||||
var excludeTags,
|
||||
var leastBookmark,
|
||||
var maximumBookmark,
|
||||
_, // TODO user group name
|
||||
var illustratorName,
|
||||
var illustratorId,
|
||||
var illustrationName,
|
||||
var illustrationId,
|
||||
var publishDateStart,
|
||||
var publishDateEnd) filterSettings)
|
||||
return;
|
||||
if (filterSettings == _lastFilterSettings)
|
||||
{
|
||||
if (filterSettings == _lastFilterSettings)
|
||||
return;
|
||||
}
|
||||
|
||||
_lastFilterSettings = filterSettings;
|
||||
|
||||
ViewModel.DataProvider.Filter = null;
|
||||
ViewModel.DataProvider.Filter = o =>
|
||||
{
|
||||
if (o is IllustrationViewModel vm)
|
||||
{
|
||||
return;
|
||||
var stringTags = vm.Illustration.Tags?.Select(t => t.Name).WhereNotNull().ToArray() ??
|
||||
Array.Empty<string>();
|
||||
var result = ExamineExcludeTags(stringTags, excludeTags)
|
||||
&& ExamineIncludeTags(stringTags, includeTags)
|
||||
&& vm.Bookmark >= leastBookmark
|
||||
&& vm.Bookmark <= maximumBookmark
|
||||
&& illustrationName.Match(vm.Illustration.Title)
|
||||
&& illustratorName.Match(vm.Illustration.User?.Name)
|
||||
&& (illustratorId.IsNullOrEmpty() ||
|
||||
illustratorId == vm.Illustration.User?.Id.ToString())
|
||||
&& (illustrationId.IsNullOrEmpty() || illustrationId == vm.Id)
|
||||
&& vm.PublishDate >= publishDateStart
|
||||
&& vm.PublishDate <= publishDateEnd;
|
||||
return result;
|
||||
}
|
||||
|
||||
_lastFilterSettings = filterSettings;
|
||||
|
||||
ViewModel.DataProvider.Filter = null;
|
||||
ViewModel.DataProvider.Filter = o =>
|
||||
{
|
||||
if (o is IllustrationViewModel vm)
|
||||
{
|
||||
var stringTags = vm.Illustration.Tags?.Select(t => t.Name).WhereNotNull().ToArray() ?? Array.Empty<string>();
|
||||
var result = ExamineExcludeTags(stringTags, excludeTags)
|
||||
&& ExamineIncludeTags(stringTags, includeTags)
|
||||
&& vm.Bookmark >= leastBookmark
|
||||
&& vm.Bookmark <= maximumBookmark
|
||||
&& illustrationName.Match(vm.Illustration.Title)
|
||||
&& illustratorName.Match(vm.Illustration.User?.Name)
|
||||
&& (illustratorId.IsNullOrEmpty() || illustratorId == vm.Illustration.User?.Id.ToString())
|
||||
&& (illustrationId.IsNullOrEmpty() || illustrationId == vm.Id)
|
||||
&& vm.PublishDate >= publishDateStart
|
||||
&& vm.PublishDate <= publishDateEnd;
|
||||
return result;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
static bool ExamineExcludeTags(IEnumerable<string> tags, IEnumerable<Token> predicates)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
@ -37,6 +37,6 @@ public abstract partial class AbstractIllustratorViewViewModel : ObservableObjec
|
||||
|
||||
public async Task ResetEngineAndFillAsync(IFetchEngine<User?>? newEngine, int? itemLimit = null)
|
||||
{
|
||||
HasNoItems = await DataProvider.ResetAndFillAsync(newEngine, itemLimit) == 0;
|
||||
HasNoItems = await DataProvider.ResetAndFillAsync(newEngine, itemLimit) is 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,64 +0,0 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
// Copyright (c) 2023 Pixeval/UIHelper.App.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 System;
|
||||
using Windows.Foundation;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using PInvoke;
|
||||
using WinUI3Utilities;
|
||||
|
||||
namespace Pixeval.Util.UI;
|
||||
|
||||
public partial class UIHelper
|
||||
{
|
||||
public static void RootFrameNavigate(Type type, object parameter, NavigationTransitionInfo infoOverride)
|
||||
{
|
||||
App.AppViewModel.AppWindowRootFrame.Navigate(type, parameter, infoOverride);
|
||||
}
|
||||
|
||||
public static void RootFrameNavigate(Type type, object parameter)
|
||||
{
|
||||
App.AppViewModel.AppWindowRootFrame.Navigate(type, parameter);
|
||||
}
|
||||
|
||||
public static void RootFrameNavigate(Type type)
|
||||
{
|
||||
App.AppViewModel.AppWindowRootFrame.Navigate(type);
|
||||
}
|
||||
|
||||
public static (int, int) GetAppWindowSizeTuple()
|
||||
{
|
||||
var windowSize = CurrentContext.AppWindow.Size;
|
||||
return (windowSize.Width, windowSize.Height);
|
||||
}
|
||||
|
||||
public static Size GetAppWindowSize()
|
||||
{
|
||||
return CurrentContext.AppWindow.Size.ToWinRtSize();
|
||||
}
|
||||
|
||||
public static Size GetDpiAwareAppWindowSize()
|
||||
{
|
||||
var dpi = User32.GetDpiForWindow((nint)CurrentContext.HWnd);
|
||||
var size = GetAppWindowSize();
|
||||
var scalingFactor = (float) dpi / 96;
|
||||
return new Size(size.Width / scalingFactor, size.Height / scalingFactor);
|
||||
}
|
||||
}
|
@ -40,26 +40,6 @@ public static partial class UIHelper
|
||||
|
||||
public static IDataTransferManagerInterop DataTransferManagerInterop => DataTransferManager.As<IDataTransferManagerInterop>();
|
||||
|
||||
/// <summary>
|
||||
/// Set the dpi-aware window size, where by "dpi-aware" means that the desired size
|
||||
/// will be multiplied by the scale factor of the monitor which hosts the app
|
||||
/// </summary>
|
||||
/// <param name="window"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
public static void SetWindowSize(this Window window, int width, int height)
|
||||
{
|
||||
var windowNative = window.As<IWindowNative>();
|
||||
var dpi = User32.GetDpiForWindow(windowNative.WindowHandle);
|
||||
var scalingFactor = (float)dpi / 96;
|
||||
var scaledWidth = (int)(width * scalingFactor);
|
||||
var scaledHeight = (int)(height * scalingFactor);
|
||||
|
||||
User32.SetWindowPos(windowNative.WindowHandle, User32.SpecialWindowHandles.HWND_TOP,
|
||||
0, 0, scaledWidth, scaledHeight,
|
||||
User32.SetWindowPosFlags.SWP_NOMOVE);
|
||||
}
|
||||
|
||||
public static void SetTaskBarIconProgressState(TaskBarState state)
|
||||
{
|
||||
if (TaskBarCustomizationSupported)
|
||||
@ -83,28 +63,13 @@ public static partial class UIHelper
|
||||
var manager = nint.Zero;
|
||||
fixed (Guid* id = &RiId)
|
||||
{
|
||||
interop.GetForWindow((nint) CurrentContext.HWnd, id, (void**) &manager);
|
||||
interop.GetForWindow((nint)CurrentContext.HWnd, id, (void**)&manager);
|
||||
return DataTransferManager.FromAbi(manager);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShowShareUI()
|
||||
{
|
||||
DataTransferManagerInterop.ShowShareUIForWindow((nint) CurrentContext.HWnd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the dpi-aware screen size using win32 API, where by "dpi-aware" means that
|
||||
/// the result will be divided by the scale factor of the monitor that hosts the app
|
||||
/// </summary>
|
||||
/// <returns>Screen size</returns>
|
||||
public static (int, int) GetScreenSize()
|
||||
{
|
||||
return (User32.GetSystemMetrics(User32.SystemMetric.SM_CXSCREEN), User32.GetSystemMetrics(User32.SystemMetric.SM_CYSCREEN));
|
||||
}
|
||||
|
||||
public static nint GetWindowHandle(this Window window)
|
||||
{
|
||||
return window.As<IWindowNative>().WindowHandle;
|
||||
DataTransferManagerInterop.ShowShareUIForWindow((nint)CurrentContext.HWnd);
|
||||
}
|
||||
}
|
||||
|
@ -298,11 +298,6 @@ public static partial class UIHelper
|
||||
element.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public static Size ToWinRtSize(this SizeInt32 size)
|
||||
{
|
||||
return new Size(size.Width, size.Height);
|
||||
}
|
||||
|
||||
public static async Task<SoftwareBitmapSource> GenerateQrCodeForUrlAsync(string url)
|
||||
{
|
||||
var qrCodeGen = new QRCodeGenerator();
|
||||
@ -361,33 +356,7 @@ public static partial class UIHelper
|
||||
{
|
||||
return ThreadingHelper.SpinWaitAsync(() => root.FindDescendant<T>() is null);
|
||||
}
|
||||
|
||||
[DllImport("Shcore.dll", SetLastError = true)]
|
||||
internal static extern int GetDpiForMonitor(nint hMonitor, MonitorDpiType dpiType, out uint dpiX, out uint dpiY);
|
||||
|
||||
internal enum MonitorDpiType
|
||||
{
|
||||
MdtEffectiveDpi = 0,
|
||||
MdtAngularDpi = 1,
|
||||
MdtRawDpi = 2,
|
||||
MdtDefault = MdtEffectiveDpi
|
||||
}
|
||||
|
||||
public static double GetScaleAdjustment()
|
||||
{
|
||||
var displayArea = DisplayArea.GetFromWindowId(CurrentContext.WindowId, DisplayAreaFallback.Primary);
|
||||
var hMonitor = Win32Interop.GetMonitorFromDisplayId(displayArea.DisplayId);
|
||||
|
||||
// Get DPI.
|
||||
var result = GetDpiForMonitor(hMonitor, MonitorDpiType.MdtDefault, out var dpiX, out _);
|
||||
if (result != 0)
|
||||
{
|
||||
throw new Exception("Could not get DPI for monitor.");
|
||||
}
|
||||
|
||||
var scaleFactorPercent = (uint) (((long) dpiX * 100 + (96 >> 1)) / 96);
|
||||
return scaleFactorPercent / 100.0;
|
||||
}
|
||||
|
||||
public static Color ParseHexColor(string hex)
|
||||
{
|
||||
var trimmed = !hex.StartsWith('#') ? $"#{hex}" : hex;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
// Copyright (c) 2023 Pixeval/CustomizableWindow.cs
|
||||
// Copyright (c) 2023 Pixeval/EnhancedWindow.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
|
||||
@ -18,7 +18,6 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Diagnostics;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
@ -27,26 +26,32 @@ using WinUI3Utilities;
|
||||
|
||||
namespace Pixeval.Util.UI.Windowing;
|
||||
|
||||
public sealed class CustomizableWindow : Window
|
||||
public sealed class EnhancedWindow : Window
|
||||
{
|
||||
private readonly Frame _frame;
|
||||
|
||||
private readonly Window _owner;
|
||||
private readonly EnhancedWindow? _owner;
|
||||
|
||||
/// <summary>
|
||||
/// IT IS FORBIDDEN TO USE THIS CONSTRUCTOR DIRECTLY, USE <see cref="WindowFactory.Fork"/> INSTEAD
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
internal CustomizableWindow(Window owner)
|
||||
internal EnhancedWindow()
|
||||
{
|
||||
_owner = owner;
|
||||
Content = _frame = new()
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||
VerticalAlignment = VerticalAlignment.Stretch,
|
||||
};
|
||||
Closed += OnClosed;
|
||||
_owner.Closed += OnOwnerOnClosed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IT IS FORBIDDEN TO USE THIS CONSTRUCTOR DIRECTLY, USE <see cref="WindowFactory.Fork"/> INSTEAD
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
internal EnhancedWindow(EnhancedWindow owner) : this()
|
||||
{
|
||||
_owner = owner;
|
||||
}
|
||||
|
||||
public event RoutedEventHandler FrameLoaded
|
||||
@ -57,7 +62,6 @@ public sealed class CustomizableWindow : Window
|
||||
|
||||
private void OnClosed(object sender, WindowEventArgs args)
|
||||
{
|
||||
_owner.Closed -= OnOwnerOnClosed;
|
||||
WeakReferenceMessenger.Default.UnregisterAll(this);
|
||||
}
|
||||
|
@ -20,37 +20,185 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Pixeval.Options;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics;
|
||||
using Windows.UI;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Composition.SystemBackdrops;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using PInvoke;
|
||||
using WinUI3Utilities;
|
||||
using AppTheme = Pixeval.Options.ApplicationTheme;
|
||||
using ApplicationTheme = Microsoft.UI.Xaml.ApplicationTheme;
|
||||
|
||||
namespace Pixeval.Util.UI.Windowing;
|
||||
|
||||
public static class WindowFactory
|
||||
{
|
||||
private static readonly List<CustomizableWindow> ForkedWindowsInternal = new();
|
||||
public static EnhancedWindow RootWindow => ForkedWindowsInternal[0];
|
||||
|
||||
public static IReadOnlyList<CustomizableWindow> ForkedWindows => ForkedWindowsInternal;
|
||||
private static readonly List<EnhancedWindow> ForkedWindowsInternal = new();
|
||||
|
||||
public static CustomizableWindow Fork(this Window owner, out CustomizableWindow window)
|
||||
public static IReadOnlyList<EnhancedWindow> ForkedWindows => ForkedWindowsInternal;
|
||||
|
||||
public static EnhancedWindow Create(out EnhancedWindow window)
|
||||
{
|
||||
var w = window = new(owner);
|
||||
window.Closed += (_, _) =>
|
||||
{
|
||||
w.Close();
|
||||
ForkedWindowsInternal.Remove(w);
|
||||
};
|
||||
var w = window = new();
|
||||
if (ForkedWindowsInternal.Count is 0)
|
||||
CurrentContext.Window = window;
|
||||
window.Closed += (_, _) => ForkedWindowsInternal.Remove(w);
|
||||
ForkedWindowsInternal.Add(window);
|
||||
return window;
|
||||
}
|
||||
|
||||
public static CustomizableWindow WithLoaded(this CustomizableWindow window, RoutedEventHandler onLoaded)
|
||||
public static EnhancedWindow Fork(this EnhancedWindow owner, out EnhancedWindow window)
|
||||
{
|
||||
var w = window = new(owner);
|
||||
window.Closed += (_, _) => ForkedWindowsInternal.Remove(w);
|
||||
ForkedWindowsInternal.Add(window);
|
||||
return window;
|
||||
}
|
||||
|
||||
public static EnhancedWindow WithLoaded(this EnhancedWindow window, RoutedEventHandler onLoaded)
|
||||
{
|
||||
window.FrameLoaded += onLoaded;
|
||||
return window;
|
||||
}
|
||||
|
||||
public static CustomizableWindow Initialize(this CustomizableWindow window, WindowHelper.InitializeInfo provider)
|
||||
public static EnhancedWindow WithClosed(this EnhancedWindow window, TypedEventHandler<object, WindowEventArgs> onClosed)
|
||||
{
|
||||
WindowHelper.Initialize(window, provider);
|
||||
window.Closed += onClosed;
|
||||
return window;
|
||||
}
|
||||
|
||||
public static EnhancedWindow Init(this EnhancedWindow window, SizeInt32 size = default)
|
||||
{
|
||||
window.Initialize(new()
|
||||
{
|
||||
BackdropType = App.AppViewModel.AppSetting.AppBackdrop switch
|
||||
{
|
||||
ApplicationBackdropType.None => BackdropType.None,
|
||||
ApplicationBackdropType.Acrylic => BackdropType.Acrylic,
|
||||
ApplicationBackdropType.Mica => BackdropType.Mica,
|
||||
ApplicationBackdropType.MicaAlt => BackdropType.MicaAlt,
|
||||
_ => WinUI3Utilities.ThrowHelper.ArgumentOutOfRange<ApplicationBackdropType, BackdropType>(App.AppViewModel.AppSetting.AppBackdrop)
|
||||
},
|
||||
TitleBarType = TitleBarHelper.TitleBarType.AppWindow,
|
||||
Size = size
|
||||
});
|
||||
var theme = GetElementTheme(App.AppViewModel.AppSetting.Theme);
|
||||
SetAppWindowTitleBarButtonColor(window, theme);
|
||||
window.FrameLoaded += (s, _) =>
|
||||
{
|
||||
s.To<FrameworkElement>().RequestedTheme = theme;
|
||||
};
|
||||
return window;
|
||||
}
|
||||
|
||||
public static void SetBackdrop(ApplicationBackdropType backdropType)
|
||||
{
|
||||
foreach (var window in ForkedWindowsInternal)
|
||||
{
|
||||
window.SystemBackdrop = backdropType switch
|
||||
{
|
||||
ApplicationBackdropType.None => null,
|
||||
ApplicationBackdropType.Acrylic => new DesktopAcrylicBackdrop(),
|
||||
ApplicationBackdropType.Mica => new MicaBackdrop(),
|
||||
ApplicationBackdropType.MicaAlt => new MicaBackdrop { Kind = MicaKind.BaseAlt },
|
||||
_ => WinUI3Utilities.ThrowHelper.ArgumentOutOfRange<ApplicationBackdropType, SystemBackdrop>(backdropType)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetTheme(AppTheme theme)
|
||||
{
|
||||
var t = GetElementTheme(theme);
|
||||
|
||||
foreach (var window in ForkedWindowsInternal)
|
||||
{
|
||||
window.Content.To<FrameworkElement>().RequestedTheme = t;
|
||||
SetAppWindowTitleBarButtonColor(window, t);
|
||||
}
|
||||
}
|
||||
|
||||
private static ElementTheme GetElementTheme(AppTheme theme)
|
||||
{
|
||||
return theme switch
|
||||
{
|
||||
AppTheme.Dark => ElementTheme.Dark,
|
||||
AppTheme.Light => ElementTheme.Light,
|
||||
AppTheme.SystemDefault => Application.Current.RequestedTheme switch
|
||||
{
|
||||
ApplicationTheme.Light => ElementTheme.Light,
|
||||
ApplicationTheme.Dark => ElementTheme.Dark,
|
||||
_ => WinUI3Utilities.ThrowHelper.ArgumentOutOfRange<ApplicationTheme, ElementTheme>(Application.Current.RequestedTheme)
|
||||
},
|
||||
_ => WinUI3Utilities.ThrowHelper.ArgumentOutOfRange<AppTheme, ElementTheme>(theme)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Work when in <see cref="TitleBarHelper.TitleBarType.AppWindow"/>
|
||||
/// </summary>
|
||||
/// <param name="window"></param>
|
||||
/// <param name="theme"></param>
|
||||
private static void SetAppWindowTitleBarButtonColor(Window window, ElementTheme theme)
|
||||
{
|
||||
window.AppWindow.TitleBar.ButtonForegroundColor = theme switch
|
||||
{
|
||||
ElementTheme.Light => Colors.Black,
|
||||
ElementTheme.Dark => Colors.White,
|
||||
_ => WinUI3Utilities.ThrowHelper.ArgumentOutOfRange<ElementTheme, Color>(theme)
|
||||
};
|
||||
window.AppWindow.TitleBar.ButtonHoverBackgroundColor = theme switch
|
||||
{
|
||||
ElementTheme.Light => new() { A = 0x33, R = 0, G = 0, B = 0 },
|
||||
ElementTheme.Dark => new() { A = 0x33, R = 0xFF, G = 0xFF, B = 0xFF },
|
||||
_ => WinUI3Utilities.ThrowHelper.ArgumentOutOfRange<ElementTheme, Color>(theme)
|
||||
};
|
||||
}
|
||||
|
||||
#region Window
|
||||
|
||||
/// <summary>
|
||||
/// Work when in <see cref="TitleBarHelper.TitleBarType.Window"/>
|
||||
/// </summary>
|
||||
/// <param name="window"></param>
|
||||
/// <param name="theme"></param>
|
||||
private static void SetWindowTitleBarButtonColor(Window window, ElementTheme theme)
|
||||
{
|
||||
Application.Current.Resources["WindowCaptionForeground"] = theme switch
|
||||
{
|
||||
ElementTheme.Light => Colors.Black,
|
||||
ElementTheme.Dark => Colors.White,
|
||||
_ => WinUI3Utilities.ThrowHelper.ArgumentOutOfRange<ElementTheme, Color>(theme)
|
||||
};
|
||||
|
||||
TriggerTitleBarRepaint(window);
|
||||
}
|
||||
|
||||
private static void TriggerTitleBarRepaint(Window window)
|
||||
{
|
||||
const int WM_ACTIVATE = 0x0006;
|
||||
const int WA_ACTIVE = 0x01;
|
||||
const int WA_CLICKACTIVE = 0x02;
|
||||
const int WA_INACTIVE = 0x00;
|
||||
|
||||
// to trigger repaint tracking task id 38044406
|
||||
var hWnd = (nint)window.AppWindow.Id.Value;
|
||||
var activeWindow = User32.GetActiveWindow();
|
||||
if (hWnd == activeWindow)
|
||||
{
|
||||
_ = User32.SendMessage(hWnd, User32.WindowMessage.WM_ACTIVATE, WA_INACTIVE, 0);
|
||||
_ = User32.SendMessage(hWnd, User32.WindowMessage.WM_ACTIVATE, WA_ACTIVE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = User32.SendMessage(hWnd, User32.WindowMessage.WM_ACTIVATE, WA_ACTIVE, 0);
|
||||
_ = User32.SendMessage(hWnd, User32.WindowMessage.WM_ACTIVATE, WA_INACTIVE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user