private void TestUrlClicked(object sender, RoutedEventArgs e) { this.shortcut = (MSEdgeShortcut)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(); }