diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-02-26 09:13:49 -0500 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-02-26 09:13:49 -0500 |
| commit | a15b6db0dccc6680e012fdbde021a364991a0d4b (patch) | |
| tree | 3af5e2cb8d7f9f30d5ccc7c1f49b629d79f226d9 /MediaBrowser.Installer/MainWindow.xaml.cs | |
| parent | d4690904fbd2733118d5a8d540105d90a202ff7a (diff) | |
Add native shortcut handling & dashboard shortcut to installer
Diffstat (limited to 'MediaBrowser.Installer/MainWindow.xaml.cs')
| -rw-r--r-- | MediaBrowser.Installer/MainWindow.xaml.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs index 01e15dfd8..8465c6e2c 100644 --- a/MediaBrowser.Installer/MainWindow.xaml.cs +++ b/MediaBrowser.Installer/MainWindow.xaml.cs @@ -10,7 +10,6 @@ using System.Linq; using Ionic.Zip; using MediaBrowser.Installer.Code; using ServiceStack.Text; -using IWshRuntimeLibrary; namespace MediaBrowser.Installer { @@ -124,7 +123,7 @@ namespace MediaBrowser.Installer var fullPath = Path.Combine(RootPath, "System", TargetExe); try { - CreateShortcut(fullPath); + CreateShortcuts(fullPath); } catch (Exception e) { @@ -225,21 +224,24 @@ namespace MediaBrowser.Installer /// Only do current user to avoid need for admin elevation /// </summary> /// <param name="targetExe"></param> - protected void CreateShortcut(string targetExe) + protected void CreateShortcuts(string targetExe) { // get path to all users start menu - var shell = new WshShell(); - var startMenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu),"Media Browser"); + var startMenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu),"Media Browser 3"); if (!Directory.Exists(startMenu)) Directory.CreateDirectory(startMenu); - var product = (IWshShortcut)shell.CreateShortcut(Path.Combine(startMenu, FriendlyName+".lnk")); - product.TargetPath = targetExe; - product.Description = "Run " + FriendlyName; + var product = new ShellShortcut(Path.Combine(startMenu, FriendlyName+".lnk")) {Path = targetExe, Description = "Run " + FriendlyName}; product.Save(); - var uninstall = (IWshShortcut)shell.CreateShortcut(Path.Combine(startMenu, "Uninstall " + FriendlyName + ".lnk")); - uninstall.TargetPath = Path.Combine(Path.GetDirectoryName(targetExe),"MediaBrowser.Uninstaller.exe"); - uninstall.Arguments = (PackageName == "MBServer" ? "server" : "mbt"); - uninstall.Description = "Uninstall " + FriendlyName; + if (PackageName == "MBServer") + { + var path = Path.Combine(startMenu, "MB Dashboard.lnk"); + var dashboard = new ShellShortcut(path) + {Path = @"http://localhost:8096/mediabrowser/dashboard/dashboard.html", Description = "Open the Media Browser Server Dashboard (configuration)"}; + dashboard.Save(); + + } + var uninstall = new ShellShortcut(Path.Combine(startMenu, "Uninstall " + FriendlyName + ".lnk")) + {Path = Path.Combine(Path.GetDirectoryName(targetExe), "MediaBrowser.Uninstaller.exe"), Arguments = (PackageName == "MBServer" ? "server" : "mbt"), Description = "Uninstall " + FriendlyName}; uninstall.Save(); } |
