XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
using XFEEDToolBox.ViewModels;
namespace XFEEDToolBox.Views;
public sealed partial class SettingPage : Page
{
    public ToolboxViewModel ViewModel => App.ViewModel;
    public string AppVersion => typeof(App).Assembly.GetName().Version?.ToString(3) ?? "";

    public static readonly DependencyProperty EditorWidthProperty = DependencyProperty.Register(
        nameof(EditorWidth), typeof(double), typeof(SettingPage), new PropertyMetadata(420d));

    public double EditorWidth
    {
        get => (double)GetValue(EditorWidthProperty);
        set => SetValue(EditorWidthProperty, value);
    }

    public SettingPage() { InitializeComponent(); NavigationCacheMode = Microsoft.UI.Xaml.Navigation.NavigationCacheMode.Required; }

    private async void OnSettingsLoaded(object sender,RoutedEventArgs args)
    {if(ViewModel.RefreshMarketCacheUsageCommand.CanExecute(null))await ViewModel.RefreshMarketCacheUsageCommand.ExecuteAsync(null);}

    private void OnPageSizeChanged(object sender, SizeChangedEventArgs args)
    {
        EditorWidth = Math.Clamp(args.NewSize.Width - 144, 120, 420);
        VisualStateManager.GoToState(this, args.NewSize.Width < 760 ? "Compact" : "Wide", false);
    }
}