/// <summary> /// Pin a program by executable filename /// </summary> public PinnedApp Pin(ProcessFullPath pfp) { var pa = GetPinned(pfp.FileName); if (pa == null) { pa = BuildPinnedApp(pfp.FileName, pfp.Arguments); Apps.Add(pa); } return(pa); }
private bool AcceptDrop(IDataObject iDataObject, out ProcessFullPath pfp) { pfp = new ProcessFullPath(); Array a = (Array)iDataObject.GetData(DataFormats.FileDrop); if (a == null || a.GetLength(0) != 1) { return(false); } string fileName = (string)a.GetValue(0); pfp.FileName = Native.FindExecutable(fileName); if (pfp.FileName == null) { if (!fileName.EndsWith("lnk")) { return(false); } try { Bitmap icon; string displayName, targetPath, arguments; ShortcutUtil.ParseShortcut(fileName, out icon, out displayName, out targetPath, out arguments); pfp.FileName = targetPath; pfp.Arguments = arguments; return(true); } catch { return(false); } } else { if (!string.Equals(fileName, pfp.FileName, StringComparison.OrdinalIgnoreCase)) { pfp.Arguments = fileName; } } return(true); }
private void tsmiLaunch_Click(object sender, EventArgs e) { ProcessFullPath pfp = (sender as ToolStripMenuItem).Tag as ProcessFullPath; WindowManager.Instance.LaunchProcess(pfp.FileName, pfp.Arguments, CurrentScreen); }