6

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

截屏:

天气任务栏

我怎样才能让它在我的程序中运行一个过程或函数?因此,如果用户单击“当前:...”,它应该在同一应用程序中打开一个新表单。它不应该打开另一个应用程序吗?

我的代码目前是:

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();
4

1 回答 1

1

看这里:每周源代码 31-单实例 WinForms。它将只允许您打开一个程序实例,但使用 VisualBasic 而不是 Mutex。

于 2012-10-06T20:24:38.330 回答