private void btnBrowse_Click(object sender, RoutedEventArgs e) { string filter = "Programs and shortcuts|"; foreach (string ext in AppGrabberService.ExecutableExtensions) { filter += $"*{ext};"; } filter = filter.Substring(0, filter.Length - 2); using (OpenFileDialog dlg = new OpenFileDialog { Filter = filter }) { if (dlg.SafeShowDialog() == System.Windows.Forms.DialogResult.OK && ShellHelper.Exists(dlg.FileName)) { ApplicationInfo customApp = AppGrabberService.PathToApp(dlg.FileName, true, true); if (!ReferenceEquals(customApp, null)) { if (!programsMenuAppsCollection.Contains(customApp) && !(InstalledAppsView.ItemsSource as ObservableCollection <ApplicationInfo>).Contains(customApp)) { programsMenuAppsCollection.Add(customApp); } else { // disallow adding a duplicate ShellLogger.Debug("Excluded duplicate item: " + customApp.Name + ": " + customApp.Target); } } } } }