小编joo*_*ost的帖子

在运行程序时执行方法而不是启动新实例

我正在写一份天气应用程序.我正在将它与任务栏集成.当您右键单击任务栏上的图标时,它会显示当前温度等.当前,如果单击"当前:..."文本,它将打开该应用程序的另一个实例.

截图:

天气任务栏

如何在程序中运行程序或函数?因此,如果用户点击"当前:...",它应该在同一个应用程序中打开一个新表单.它不应该打开另一个应用程序?

我的代码目前是:

JumpListCustomCategory userActionsCategory = new JumpListCustomCategory("Weather");
userActionLink.Arguments = "-1";
JumpListLink userActionLink = new JumpListLink(Assembly.GetEntryAssembly().Location, Conditions + ": " + reader.ReadToEnd());
userActionLink.IconReference = new IconReference(testicon, 0);
userActionsCategory.AddJumpListItems(userActionLink);
list.AddCustomCategories(userActionsCategory);
list.Refresh();
Run Code Online (Sandbox Code Playgroud)

c# windows taskbar windows-7 winforms

6
推荐指数
1
解决办法
190
查看次数

标签 统计

c# ×1

taskbar ×1

windows ×1

windows-7 ×1

winforms ×1