private void ctxDesktopShortcut_Click(object sender, EventArgs e) { if (lvModule.SelectedItems.Count > 0) { if (lvModule.SelectedItems[0].Tag is SynapseModule) { SynapseModule module = ((SynapseModule)lvModule.SelectedItems[0].Tag); string modulefile = module.getModuleExecutablePath(Application.StartupPath, CurrentMode); if (modulefile != null) { IShellLink link = (IShellLink) new ShellLink(); link.SetDescription(module.FriendlyName.ToString()); link.SetPath(modulefile); link.SetIconLocation(Application.StartupPath + (CurrentMode == SynapseModule.SynapseModuleMode.Production ? "\\Prod\\" : "\\Dev\\") + module.TECHNICALNAME + "\\" + module.TECHNICALNAME + ".ico", 0); IPersistFile file = (IPersistFile)link; string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); file.Save(Path.Combine(desktopPath, (CurrentMode == SynapseModule.SynapseModuleMode.Production ? "" : "(Test) ") + module.FriendlyName.ToString() + ".lnk"), false); } } } }