Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions PCL.Core/App/JumpListService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Windows;
using System.Windows.Shell;
using System.Windows.Threading;

namespace PCL.Core.App;

[LifecycleService(LifecycleState.Running)]
[LifecycleScope("jump-list", "跳转列表", false)]
public partial class JumpListService
{
[LifecycleStart]
private static void _Start()
{
var app = Application.Current;
if (app is null) return;
var jumpList = new JumpList();
jumpList.JumpItems.Add(new JumpTask
{
Title = States.Game.SelectedInstance,
CustomCategory = "最近实例",
Arguments = $"--launch {States.Game.SelectedInstance}"
});

// TODO: 添加收藏夹管理

if (app.Dispatcher.CheckAccess())
{
JumpList.SetJumpList(app, jumpList);
}
else
{
app.Dispatcher.Invoke(() => JumpList.SetJumpList(app, jumpList), DispatcherPriority.Normal);
}
}
}
11 changes: 11 additions & 0 deletions Plain Craft Launcher 2/Pages/PageLaunch/PageLaunchLeft.xaml.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Imports PCL.Core.Utils
Imports System.Windows
Imports PCL.Core.App

Public Class PageLaunchLeft

Expand Down Expand Up @@ -99,6 +100,16 @@ Public Class PageLaunchLeft
RefreshButtonsUI()
RefreshPage(False) '有可能选择的版本变化了,需要重新刷新
'If IsProfileVaild() = "" Then McLoginLoader.Start() '自动登录
Dim args = Basics.CommandLineArguments
If args.Length = 2 AndAlso args(0) = "--launch" Then
Log("[Launch] 收到命令行启动参数,启动实例:" & args(1))
Dim LaunchInstance As New McInstance(args(1))
If LaunchInstance.Check() Then
McLaunchStart(New McLaunchOptions() With { .Instance = LaunchInstance })
Else
Log("[Launch] 命令行参数提供的实例无效", LogLevel.Critical)
End If
End If
End Sub)
End Sub, "Instance Check", ThreadPriority.AboveNormal)

Expand Down
Loading