public SparePartList GetList(SparePartFilter filter) { using (EntityFrameworkContext context = new EntityFrameworkContext()) { SparePartList list = new SparePartList(); var spareParts = context.SpareParts.Include(x => x.Mark).Where(x => x.Name.ToUpper().Contains(filter.NameFilter)); if (filter.MarkIds.Length > 0) { spareParts = spareParts.Where(x => filter.MarkIds.Contains(x.MarkId)); } list.PagesCount = (int)Math.Ceiling(spareParts.Count() / (double)filter.PageSize); if (filter.Sort > 0) { if ((int)filter.Sort % 2 == 0) { spareParts = spareParts.OrderBy(x => SortFunction[(int)filter.Sort / 2](x)); } else { spareParts = spareParts.OrderByDescending(x => SortFunction[(int)filter.Sort / 2 + 1](x)); } } list.SpareParts = spareParts.Skip((filter.PageNumber - 1) * filter.PageSize).Take(filter.PageSize).ToList(); return(list); } }
async Task FilePicker_SortFilesFoldersByDate(bool silent) { try { if (vFilePickerCurrentPath == "PC") { Debug.WriteLine("Invalid sorting path, returning."); return; } if (!silent) { Debug.WriteLine("Sorting files and folders by date"); await Notification_Send_Status("Sorting", "Sorting by date"); } vFilePickerSortType = SortingType.Date; SortFunction <DataBindFile> sortFuncFileType = new SortFunction <DataBindFile>(); sortFuncFileType.function = x => x.FileType; SortFunction <DataBindFile> sortFuncDateModified = new SortFunction <DataBindFile>(); sortFuncDateModified.function = x => x.DateModified; sortFuncDateModified.ascending = false; List <SortFunction <DataBindFile> > orderList = new List <SortFunction <DataBindFile> >(); orderList.Add(sortFuncFileType); orderList.Add(sortFuncDateModified); SortObservableCollection(lb_FilePicker, List_FilePicker, orderList, null); } catch { } }
private void Sort(ref ExqHistogramEntry ppHist, SortFunction sortfunc) { ExqHistogramEntry pLow, pHigh, pCur, pNext; int n = 0; ExqFloat sum = 0; for (pCur = ppHist; pCur != null; pCur = pCur.pNext) { n++; sum += sortfunc(pCur); } if (n < 2) { return; } sum /= n; pLow = pHigh = null; for (pCur = ppHist; pCur != null; pCur = pNext) { pNext = pCur.pNext; if (sortfunc(pCur) < sum) { pCur.pNext = pLow; pLow = pCur; } else { pCur.pNext = pHigh; pHigh = pCur; } } if (pLow == null) { ppHist = pHigh; return; } if (pHigh == null) { ppHist = pLow; return; } Sort(ref pLow, sortfunc); Sort(ref pHigh, sortfunc); ppHist = pLow; while (pLow.pNext != null) { pLow = pLow.pNext; } pLow.pNext = pHigh; }
/// <exclude/> public void sortSubviewsUsingFunction_context(SortFunction function, IntPtr context) { Action<IntPtr, IntPtr, IntPtr> thunk = (IntPtr lhs, IntPtr rhs, IntPtr ctxt) => function(NSObject.Lookup(lhs), NSObject.Lookup(rhs), ctxt); IntPtr fp = Marshal.GetFunctionPointerForDelegate(thunk); Call("sortSubviewsUsingFunction:context:", fp, context); GC.KeepAlive(thunk); }
//Sort the application lists by name async Task SortAppListsByName(bool silentSort) { try { if (!silentSort) { await Notification_Send_Status("Sorting", "Sorting by name"); } vSortType = SortingType.Name; SortFunction <DataBindApp> sortFuncName = new SortFunction <DataBindApp>(); sortFuncName.function = x => x.Name; List <SortFunction <DataBindApp> > orderListGames = new List <SortFunction <DataBindApp> >(); orderListGames.Add(sortFuncName); SortObservableCollection(lb_Games, List_Games, orderListGames, null); List <SortFunction <DataBindApp> > orderListApps = new List <SortFunction <DataBindApp> >(); orderListApps.Add(sortFuncName); SortObservableCollection(lb_Apps, List_Apps, orderListApps, null); List <SortFunction <DataBindApp> > orderListEmulators = new List <SortFunction <DataBindApp> >(); orderListEmulators.Add(sortFuncName); SortObservableCollection(lb_Emulators, List_Emulators, orderListEmulators, null); List <SortFunction <DataBindApp> > orderListLaunchers = new List <SortFunction <DataBindApp> >(); orderListLaunchers.Add(sortFuncName); SortObservableCollection(lb_Launchers, List_Launchers, orderListLaunchers, null); List <SortFunction <DataBindApp> > orderListShortcuts = new List <SortFunction <DataBindApp> >(); orderListShortcuts.Add(sortFuncName); SortObservableCollection(lb_Shortcuts, List_Shortcuts, orderListShortcuts, null); List <SortFunction <DataBindApp> > orderListProcesses = new List <SortFunction <DataBindApp> >(); orderListProcesses.Add(sortFuncName); SortObservableCollection(lb_Processes, List_Processes, orderListProcesses, null); DataBindString menuSortItem = List_MainMenu.Where(x => x.Data1.ToString() == "menuButtonSorting").FirstOrDefault(); if (menuSortItem != null) { menuSortItem.Name = "Sort applications by number or date"; } ToolTip newTooltip = new ToolTip() { Content = "Sort by number or date" }; button_MenuSorting.ToolTip = newTooltip; } catch { } }
public void Sort(SortFunction <INSortItem> sortFunction = null) { if (needsUpdate) { Init(); needsUpdate = false; } if (sortFunction == null) { sortFunction = SortBySortingValue; } items.Sort(new Comparison <INSortItem> (sortFunction)); }
static void Main(string[] args) { Program p = new Program(); int[] bubble = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; Console.WriteLine("-------------冒泡排序---------------"); p.Print(SortFunction.BubbleSort(bubble)); Console.WriteLine("\n-------------选择排序---------------"); int[] select = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.SelectionSort(select)); Console.WriteLine("\n-------------插入排序---------------"); int[] insert = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.InsertionSort(insert)); Console.WriteLine("\n-------------希尔排序---------------"); int[] shell = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.ShellSort(shell)); Console.WriteLine("\n-------------归并排序---------------"); int[] Merge = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.MergeSort(Merge)); Console.WriteLine("\n-------------快速排序---------------"); int[] quick = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.QucickSort(quick, 0, quick.Length - 1)); Console.WriteLine("\n-------------堆排序---------------"); int[] heap = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.HeapSort(heap)); Console.WriteLine("\n-------------计数排序---------------"); int[] count = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.CountingSort(count)); Console.WriteLine("\n-------------桶排序---------------"); int[] bucket = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.BucketSort(bucket, 3)); Console.WriteLine("\n-------------基数排序---------------"); int[] Radix = { 2, 3, 4, 1, 2, 3, 4, 5, 6 }; p.Print(SortFunction.RadixSort(Radix)); Console.ReadKey(); }
protected override void InsertItem(int index, T item) { fullList.Insert(index, item); if (this.Items.Count < _limit || !_hasLimit) { base.InsertItem(index, item); } else { T lastValue = this.Items[this.Items.Count - 1]; if (SortFunction.Compare(item, lastValue) < 0) { base.InsertItem(index, item); base.RemoveItem(base.Count - 1); } } }
/// <summary> /// Searches the given folder for all children that match the given filter /// Folders are placed before files in the output /// </summary> /// <param name="folderPath">A path to a folder(NOT a file)</param> /// <param name="filter">The filter that all returned files must match</param> /// <param name="sortMethod">The method used to sort the output</param> /// <param name="descending"></param> /// <returns>An enumerable of TaggedFilePaths that match the given filter</returns> public static IEnumerable <TaggedFilePath> GetMatchingFiles( string folderPath, TagFilter filter, SortMethod sortMethod = SortMethod.name, bool descending = false) { // Decide which funciton will be used to sort the files in the list SortFunction sortFunction = sortMethod.GetSortFunction(); // Get all files/folders that match the filter DirectoryInfo folder = new DirectoryInfo(folderPath); IEnumerable <TaggedFilePath> files = from FileInfo fsInfo in folder.EnumerateFiles() let path = new TaggedFilePath(fsInfo.FullName, false) where filter.Matches(path) orderby sortFunction(path) ascending select path; IEnumerable <TaggedFilePath> folders = from DirectoryInfo fsInfo in folder.EnumerateDirectories() let path = new TaggedFilePath(fsInfo.FullName, true) where filter.Matches(path) orderby sortFunction(path) ascending select path; // Sort them by descending, if the box is checked if (descending) { files = files.Reverse(); folders = folders.Reverse(); } // Combine the folders and files into the same list // Folders are added first for easy navigation return(folders.Concat(files)); }
/// <summary> /// 按有限度要求对目标列表进行排序 /// </summary> /// <param name="actionParameter"></param> /// <param name="baaseTransform"></param> /// <param name="value"></param> /// <param name="quiet"></param> private void SortTargetListByTargetPattern(ActionParameter actionParameter, Transform baaseTransform, float value, bool quiet) { List <BasePartsData> targetList = actionParameter.TargetList; SortFunction sort = (a, b) => a.GetButtontransformPosition().x > b.GetButtontransformPosition().x ? 1 : (a.GetButtontransformPosition().x < b.GetButtontransformPosition().x ?-1:0); switch (actionParameter.TargetSort) { case PirorityPattern.RANDOM: case PirorityPattern.RANDOM_ONCE: case PirorityPattern.ALL_SUMMON_RANDOM: case PirorityPattern.OWN_SUMMON_RANDOM: if (targetList.Count >= 2) { for (int i = targetList.Count - 1; i > 0; i--) { int random = staticBattleManager.Random(0, i); BasePartsData a = targetList[random]; BasePartsData b = targetList[i]; targetList[random] = b; targetList[i] = a; } } return; case PirorityPattern.NEAR: sort = (a, b) => a.GetButtontransformPosition().x > b.GetButtontransformPosition().x ? 1 : (a.GetButtontransformPosition().x < b.GetButtontransformPosition().x ? -1 : 0); break; case PirorityPattern.FAR: sort = (a, b) => a.GetButtontransformPosition().x < b.GetButtontransformPosition().x ? 1 : (a.GetButtontransformPosition().x > b.GetButtontransformPosition().x ? -1 : 0); break; case PirorityPattern.HP_ASC: sort = ((a, b) => a.Owner.Hp > b.Owner.Hp ? 1 : (a.Owner.Hp < b.Owner.Hp ? -1 : 0)); break; case PirorityPattern.HP_DEC: sort = ((a, b) => a.Owner.Hp < b.Owner.Hp ? 1 : (a.Owner.Hp > b.Owner.Hp ? -1 : 0)); break; case PirorityPattern.OWNER: targetList.Clear(); targetList.Add(Owner.GetFirstParts(Owner, -1024)); return; case PirorityPattern.FORWARD: case PirorityPattern.BACK: if ((actionParameter.TargetSort == PirorityPattern.FORWARD ^ Owner.IsOther) ^ Owner.IsConfusionOrConvert) { sort = ((a, b) => a.Owner.FixedPosition.x < b.Owner.FixedPosition.x ? 1 : (a.Owner.FixedPosition.x > b.Owner.FixedPosition.x ? -1 :0)); } else { sort = ((a, b) => a.Owner.FixedPosition.x > b.Owner.FixedPosition.x ? 1 : (a.Owner.FixedPosition.x < b.Owner.FixedPosition.x ? -1 : 0)); } break; case PirorityPattern.ABSOLUTE_POSITION: targetList.Clear(); targetList.Add(Owner.GetFirstParts(true, 0)); return; case PirorityPattern.ENERGY_DEC_NEAR: case PirorityPattern.ENERGY_DEC: sort = ((a, b) => a.Owner.Energy < b.Owner.Energy ? 1 : (a.Owner.Energy > b.Owner.Energy ? -1 :0)); QuichSortTargetList(targetList, sort); List <BasePartsData> full = new List <BasePartsData>(); List <BasePartsData> notfull = new List <BasePartsData>(); foreach (BasePartsData a in targetList) { if (a.Owner.Energy == 1000) { full.Add(a); } else { notfull.Add(a); } } notfull.AddRange(full); targetList = notfull; return; case PirorityPattern.ENERGY_REDUCING: case PirorityPattern.ENERGY_ASC: sort = ((a, b) => a.Owner.Energy > b.Owner.Energy ? 1 : (a.Owner.Energy < b.Owner.Energy ? -1 : 0)); break; case PirorityPattern.ATK_DEC: sort = ((a, b) => a.Owner.BaseValues.Atk < b.Owner.BaseValues.Atk ? 1 : (a.Owner.BaseValues.Atk > b.Owner.BaseValues.Atk ? -1:0)); break; case PirorityPattern.ATK_ASC: sort = ((a, b) => a.Owner.BaseValues.Atk > b.Owner.BaseValues.Atk ? 1 : (a.Owner.BaseValues.Atk < b.Owner.BaseValues.Atk ? -1 : 0)); break; case PirorityPattern.MAGIC_STR_DEC: sort = ((a, b) => a.Owner.BaseValues.Magic_str < b.Owner.BaseValues.Magic_str ? 1 : (a.Owner.BaseValues.Magic_str > b.Owner.BaseValues.Magic_str ?-1:0)); break; case PirorityPattern.MAGIC_STR_ASC: sort = ((a, b) => a.Owner.BaseValues.Magic_str > b.Owner.BaseValues.Magic_str ? 1 : (a.Owner.BaseValues.Magic_str < b.Owner.BaseValues.Magic_str ? -1:0)); break; case PirorityPattern.BOSS: Debug.LogError("以BOSS为优先度的排序鸽了!"); return; case PirorityPattern.HP_ASC_NEAR: sort = ((a, b) => a.Owner.Hp > b.Owner.Hp ? 1 : (a.Owner.Hp < b.Owner.Hp ? -1 : 0)); Debug.LogError("该排序暂时不考虑距离!"); break; case PirorityPattern.HP_DEC_NEAR: sort = ((a, b) => a.Owner.Hp < b.Owner.Hp ? 1 : (a.Owner.Hp > b.Owner.Hp ? -1 : 0)); break; case PirorityPattern.MAGIC_STR_DEC_NEAR: sort = ((a, b) => a.Owner.BaseValues.Magic_str < b.Owner.BaseValues.Magic_str ? 1 : (a.Owner.BaseValues.Magic_str > b.Owner.BaseValues.Magic_str ? -1 : 0)); Debug.LogError("该排序暂时不考虑距离!"); break; case PirorityPattern.SHADOW: Debug.LogError("以SHADOW为优先度的排序鸽了!"); return; case PirorityPattern.ATK_MAGIC: //也就新年u1有这个还是群体,不排序也无所谓 break; default: //sort = ((a, b) => a.GetButtontransformPosition().x < b.GetButtontransformPosition().x ? 1 : -1); //Debug.LogError("以" + actionParameter.TargetSort.ToString() + "为优先度的排序鸽了!"); break; } QuichSortTargetList(targetList, sort); }
private void OnInventorySorted(SortFunction function) { RefreshUI(); }
public void Sort(SortFunction function) { items = function(items); sortedInventory?.Invoke(function); }
async Task LoadLauncherApplications() { try { //Check if already refreshing if (vBusyRefreshingLaunchers) { Debug.WriteLine("Launchers are already refreshing, cancelling."); return; } //Update the refreshing status vBusyRefreshingLaunchers = true; //Show the loading gif AVActions.ActionDispatcherInvoke(delegate { gif_Launchers_Loading.Show(); }); //Check if sorting is required bool sortByName = !List_Launchers.Any(); //Clear the app remove check list vLauncherAppAvailableCheck.Clear(); //Scan and add library from Steam if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibrarySteam"))) { await SteamScanAddLibrary(); } //Scan and add library from EA Desktop if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryEADesktop"))) { await EADesktopScanAddLibrary(); } //Scan and add library from Epic if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryEpic"))) { await EpicScanAddLibrary(); } //Scan and add library from Ubisoft if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryUbisoft"))) { await UbisoftScanAddLibrary(); } //Scan and add library from GoG if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryGoG"))) { await GoGScanAddLibrary(); } //Scan and add library from Battle.net if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryBattleNet"))) { await BattleNetScanAddLibrary(); } //Scan and add library from Bethesda if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryBethesda"))) { await BethesdaScanAddLibrary(); } //Scan and add library from Rockstar if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryRockstar"))) { await RockstarScanAddLibrary(); } //Scan and add library from Amazon if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryAmazon"))) { await AmazonScanAddLibrary(); } //Scan and add library from UWP games if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowLibraryUwp"))) { await UwpScanAddLibrary(); } //Remove deleted launcher applications Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && !vLauncherAppAvailableCheck.Any(y => y == x.PathExe); await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp); await ListBoxRemoveAll(lb_Search, List_Search, filterLauncherApp); //Sort applications and select first item if (sortByName) { SortFunction <DataBindApp> sortFuncName = new SortFunction <DataBindApp>(); sortFuncName.function = x => x.Name; List <SortFunction <DataBindApp> > orderListLaunchers = new List <SortFunction <DataBindApp> >(); orderListLaunchers.Add(sortFuncName); SortObservableCollection(lb_Launchers, List_Launchers, orderListLaunchers, null); AVActions.ActionDispatcherInvoke(delegate { lb_Launchers.SelectedIndex = 0; }); } //Hide the loading gif AVActions.ActionDispatcherInvoke(delegate { gif_Launchers_Loading.Hide(); }); } catch (Exception ex) { Debug.WriteLine("Failed loading launchers: " + ex.Message); } //Update the refreshing status vBusyRefreshingLaunchers = false; }
//Get and list all uwp applications async Task PickerLoadUwpApps() { try { AVActions.ActionDispatcherInvoke(delegate { //Enable or disable selection button in the list grid_Popup_FilePicker_button_SelectFolder.Visibility = Visibility.Collapsed; //Enable or disable file and folder availability grid_Popup_FilePicker_textblock_NoFilesAvailable.Visibility = Visibility.Collapsed; //Enable or disable the side navigate buttons grid_Popup_FilePicker_button_ControllerLeft.Visibility = Visibility.Visible; grid_Popup_FilePicker_button_ControllerUp.Visibility = Visibility.Collapsed; grid_Popup_FilePicker_button_ControllerStart.Visibility = Visibility.Collapsed; //Enable or disable the copy paste status grid_Popup_FilePicker_textblock_ClipboardStatus.Visibility = Visibility.Collapsed; //Enable or disable the current path grid_Popup_FilePicker_textblock_CurrentPath.Visibility = Visibility.Collapsed; }); //Set uwp application filters string[] whiteListFamilyName = { "Microsoft.MicrosoftEdge_8wekyb3d8bbwe" }; string[] blackListFamilyNameId = { "Microsoft.MicrosoftEdge_8wekyb3d8bbwe!PdfReader" }; //Get all the installed uwp apps PackageManager deployPackageManager = new PackageManager(); string currentUserIdentity = WindowsIdentity.GetCurrent().User.Value; IEnumerable <Package> appPackages = deployPackageManager.FindPackagesForUser(currentUserIdentity); foreach (Package appPackage in appPackages) { try { //Cancel loading if (vFilePickerLoadCancel) { Debug.WriteLine("File picker uwp load cancelled."); vFilePickerLoadCancel = false; vFilePickerLoadBusy = false; return; } //Get basic application information string appFamilyName = appPackage.Id.FamilyName; //Check if the application is in whitelist if (!whiteListFamilyName.Contains(appFamilyName)) { //Filter out system apps and others if (appPackage.IsBundle) { continue; } if (appPackage.IsOptional) { continue; } if (appPackage.IsFramework) { continue; } if (appPackage.IsResourcePackage) { continue; } if (appPackage.SignatureKind != PackageSignatureKind.Store) { continue; } } //Get detailed application information AppxDetails appxDetails = UwpGetAppxDetailsFromAppPackage(appPackage); //Check if executable name is valid if (string.IsNullOrWhiteSpace(appxDetails.ExecutableName)) { continue; } //Check if application name is valid if (string.IsNullOrWhiteSpace(appxDetails.DisplayName) || appxDetails.DisplayName.StartsWith("ms-resource")) { continue; } //Check if the application is in blacklist if (blackListFamilyNameId.Contains(appxDetails.FamilyNameId)) { continue; } //Load the application image BitmapImage uwpListImage = FileToBitmapImage(new string[] { appxDetails.SquareLargestLogoPath, appxDetails.WideLargestLogoPath }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, 50, 0); //Add the application to the list DataBindFile dataBindFile = new DataBindFile() { FileType = FileType.UwpApp, Name = appxDetails.DisplayName, NameExe = appxDetails.ExecutableName, PathFile = appxDetails.FamilyNameId, PathFull = appxDetails.FullPackageName, PathImage = appxDetails.SquareLargestLogoPath, ImageBitmap = uwpListImage }; await ListBoxAddItem(lb_FilePicker, List_FilePicker, dataBindFile, false, false); } catch { } } //Sort the application list by name SortFunction <DataBindFile> sortFuncName = new SortFunction <DataBindFile>(); sortFuncName.function = x => x.Name; List <SortFunction <DataBindFile> > orderListPicker = new List <SortFunction <DataBindFile> >(); orderListPicker.Add(sortFuncName); SortObservableCollection(lb_FilePicker, List_FilePicker, orderListPicker, null); } catch { } }
//List all available uwp applications async Task ListLoadAllUwpApplications(ListBox targetListBox, ObservableCollection <DataBindFile> targetList) { try { //Set uwp application filters string[] whiteListFamilyName = { "Microsoft.MicrosoftEdge_8wekyb3d8bbwe" }; string[] blackListFamilyNameId = { "Microsoft.MicrosoftEdge_8wekyb3d8bbwe!PdfReader" }; //Get all the installed uwp apps PackageManager deployPackageManager = new PackageManager(); string currentUserIdentity = WindowsIdentity.GetCurrent().User.Value; IEnumerable <Package> appPackages = deployPackageManager.FindPackagesForUser(currentUserIdentity); foreach (Package appPackage in appPackages) { try { //Get basic application information string appFamilyName = appPackage.Id.FamilyName; //Check if the application is in whitelist if (!whiteListFamilyName.Contains(appFamilyName)) { //Filter out system apps and others if (appPackage.IsBundle) { continue; } if (appPackage.IsOptional) { continue; } if (appPackage.IsFramework) { continue; } if (appPackage.IsResourcePackage) { continue; } if (appPackage.SignatureKind != PackageSignatureKind.Store) { continue; } } //Get detailed application information AppxDetails appxDetails = UwpGetAppxDetailsFromAppPackage(appPackage); //Check if executable name is valid if (string.IsNullOrWhiteSpace(appxDetails.ExecutableName)) { continue; } //Check if application name is valid if (string.IsNullOrWhiteSpace(appxDetails.DisplayName) || appxDetails.DisplayName.StartsWith("ms-resource")) { continue; } //Check if the application is in blacklist if (blackListFamilyNameId.Contains(appxDetails.FamilyNameId)) { continue; } //Load the application image BitmapImage uwpListImage = FileToBitmapImage(new string[] { appxDetails.SquareLargestLogoPath, appxDetails.WideLargestLogoPath }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, 50, 0); //Add the application to the list DataBindFile dataBindFile = new DataBindFile() { FileType = FileType.UwpApp, Name = appxDetails.DisplayName, NameExe = appxDetails.ExecutableName, PathFile = appxDetails.FamilyNameId, PathFull = appxDetails.FullPackageName, PathImage = appxDetails.SquareLargestLogoPath, ImageBitmap = uwpListImage }; await ListBoxAddItem(targetListBox, targetList, dataBindFile, false, false); } catch { } } //Sort the application list by name SortFunction <DataBindFile> sortFuncName = new SortFunction <DataBindFile>(); sortFuncName.function = x => x.Name; List <SortFunction <DataBindFile> > orderListPicker = new List <SortFunction <DataBindFile> >(); orderListPicker.Add(sortFuncName); SortObservableCollection(lb_FilePicker, List_FilePicker, orderListPicker, null); } catch { } }