private void TestUrlClicked(object sender, RoutedEventArgs e) { this.shortcut = (WebPageShortcut)this.Shortcut; Process.Start(new ProcessStartInfo(this.shortcut.Url)); e.Handled = true; }
public void LoadShortcutsFromRegistry() { RegistryKey rootKey = RegistryHelper.OpenAppPaths(); string [] keyNames = rootKey.GetSubKeyNames(); foreach (string keyName in keyNames) { if (Regex.Match(keyName, @"\.exe$", RegexOptions.IgnoreCase).Success) { RegistryKey key = rootKey.OpenSubKey(keyName, true); Shortcut shortcut = null; //figure out the shortcut type from the type key ShortcutType type = (ShortcutType)Enum.Parse(typeof(ShortcutType), key.GetValue(Shortcut.TypeKeyName).ToString()); //create appropriate shortcut instance based on type if (type == ShortcutType.Batch) { shortcut = new BatchShortcut(key); } else if (type == ShortcutType.File) { shortcut = new FileShortcut(key); } else if (type == ShortcutType.Folder) { shortcut = new FolderShortcut(key); } else if (type == ShortcutType.WebPage) { shortcut = new WebPageShortcut(key); } else if (type == ShortcutType.MSEdge) { shortcut = new MSEdgeShortcut(key); } this.Add(shortcut); } } rootKey.Close(); }
private void ChooseFileClicked(object sender, RoutedEventArgs e) { this.shortcut = (WebPageShortcut)this.Shortcut; OpenFileDialog dialog = new OpenFileDialog(); if (File.Exists(this.shortcut.Browser)) { dialog.InitialDirectory = System.IO.Path.GetDirectoryName(this.shortcut.Browser); } dialog.FileName = this.shortcut.Browser; dialog.CheckFileExists = true; dialog.CheckPathExists = true; bool?result = dialog.ShowDialog(); if (result.HasValue && result.Value) { this.shortcut.Browser = dialog.FileName; } }