XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
UTF-8
using Microsoft.UI.Composition;
using Microsoft.UI.Xaml.Media;
using SpaceEngineersBlueprintEditor.ViewModels;
using XFEExtension.NetCore.WinUIHelper.Utilities;

namespace SpaceEngineersBlueprintEditor.Views;

/// <summary>
/// 主页面
/// </summary>
public sealed partial class MainPage : Page
{
    public static MainPage? Current { get; set; }
    public MainPageViewModel ViewModel { get; set; } = new();
    public MainPage()
    {
        PageManager.AddOrUpdateCurrentPage(Current = this);
        this.InitializeComponent();
        var compositor = CompositionTarget.GetCompositorForCurrentThread();
        ViewModel.FileDropService.Initialize(blueprintDragGrid, compositor);
        var expressionAnimation = compositor.CreateExpressionAnimation();
        expressionAnimation.Expression = "(dragElement.Scale.Y - 1) * 200";
        expressionAnimation.Target = "Translation.Y";
        expressionAnimation.SetExpressionReferenceParameter("dragElement", blueprintDragGrid);
        viewBlueprintsList.StartAnimation(expressionAnimation);
        openLocalFile.StartAnimation(expressionAnimation);
    }
}