This commit is contained in:
rmbgame
2021-05-30 23:08:28 +08:00
parent 46050414c3
commit 75788873ca
5 changed files with 62 additions and 22 deletions
@@ -128,13 +128,28 @@ namespace System.Application.UI
// -clt c -silence
var common = new Command("c", "common");
common.AddOption(new Option<bool>("-silence", "静默启动(不弹窗口)"));
common.Handler = CommandHandler.Create((bool silence) =>
common.Handler = CommandHandler.Create((bool silence, long steamuser) =>
{
IsMinimize = silence;
MainHandlerByCLT();
});
rootCommand.AddCommand(common);
// -clt steam -account
var steamuser = new Command("steam", "Steam相关操作");
common.AddOption(new Option<string>("-account", "指定对应steam用户名"));
common.Handler = CommandHandler.Create((string account) =>
{
if (!string.IsNullOrEmpty(account))
{
initStartup(DILevel.Steam);
//ISteamService.Instance.TryKillSteamProcess();
//ISteamService.Instance.SetCurrentUser(account);
//ISteamService.Instance.StartSteam();
}
});
rootCommand.AddCommand(common);
// -clt app -id 632360
var unlock_achievement = new Command("app", "打开成就解锁窗口");
unlock_achievement.AddOption(new Option<int>("-id", "指定一个Steam游戏Id"));
@@ -157,7 +172,6 @@ namespace System.Application.UI
var day = 86400000;
while (true)
Threading.Thread.Sleep(day);
}
}
catch (Exception ex)
+42 -18
View File
@@ -1,4 +1,4 @@
#pragma warning disable CA1416 // 验证平台兼容性
#pragma warning disable CA1416 // 验证平台兼容性
extern alias JumpLists;
using JumpLists::System.Windows.Shell;
using AvaloniaApplication = Avalonia.Application;
@@ -22,26 +22,50 @@ namespace System.Application.UI
};
//jumpList1.JumpItemsRejected += JumpList1_JumpItemsRejected;
//jumpList1.JumpItemsRemovedByUser += JumpList1_JumpItemsRemovedByUser;
jumpList1.JumpItems.Add(new JumpTask
{
Title = "Notepad",
Description = "Open Notepad.",
ApplicationPath = @"C:\Windows\notepad.exe",
IconResourcePath = @"C:\Windows\notepad.exe",
});
jumpList1.JumpItems.Add(new JumpTask
{
Title = "Read Me",
Description = "Open readme.txt in Notepad.",
ApplicationPath = @"C:\Windows\notepad.exe",
IconResourcePath = @"C:\Windows\System32\imageres.dll",
IconResourceIndex = 14,
WorkingDirectory = @"C:\Users\Public\Documents",
Arguments = "readme.txt",
});
//jumpList1.JumpItems.Add(new JumpTask
//{
// Title = "RuaRua",
// Description = "以该账号启动Steam",
// ApplicationPath = AppHelper.ProgramPath,
// Arguments = "-clt steam -account rmbadmin",
// IconResourcePath = AppHelper.ProgramPath,
//});
//jumpList1.JumpItems.Add(new JumpTask
//{
// Title = "DarkMaple",
// Description = "以该账号启动Steam",
// ApplicationPath = AppHelper.ProgramPath,
// Arguments = "-clt steam -account kuafaaf",
// IconResourcePath = AppHelper.ProgramPath,
//});
//jumpList1.JumpItems.Add(new JumpTask
//{
// Title = "Read Me",
// Description = "Open readme.txt in Notepad.",
// ApplicationPath = @"C:\Windows\notepad.exe",
// IconResourcePath = @"C:\Windows\System32\imageres.dll",
// IconResourceIndex = 14,
// WorkingDirectory = @"C:\Users\Public\Documents",
// Arguments = "readme.txt",
//});
JumpList.SetJumpList(AvaloniaApplication.Current, jumpList1);
}
public static void AddJumpTask(JumpTask task)
{
var jumpList1 = new JumpList
{
ShowRecentCategory = true,
ShowFrequentCategory = true,
};
//jumpList1.JumpItemsRejected += JumpList1_JumpItemsRejected;
//jumpList1.JumpItemsRemovedByUser += JumpList1_JumpItemsRemovedByUser;
jumpList1.JumpItems.Add(task);
JumpList.SetJumpList(AvaloniaApplication.Current, jumpList1);
}
//static void AddJumpTask()
//{
// // Configure a new JumpTask.
@@ -57,7 +57,7 @@ namespace System.Application.Services
/// 启动 Steam
/// </summary>
/// <param name="arguments"></param>
void StartSteam(string? arguments);
void StartSteam(string? arguments = null);
/// <summary>
/// 获取最后一次自动登陆 Steam 用户名称
@@ -123,7 +123,7 @@ namespace System.Application.Services.Implementation
return default;
}
public void StartSteam(string? arguments)
public void StartSteam(string? arguments = null)
{
if (!string.IsNullOrEmpty(SteamProgramPath))
{
@@ -124,6 +124,8 @@ namespace System.Application.UI.ViewModels
_SteamUsersSourceList.Refresh();
this.WhenAnyValue(x => x.SteamUsers)
.Subscribe(items => items?
.ToObservableChangeSet()