Beispiel #1
0
        public static async Task PopulateListBox(TreeViewItem sItem)
        {
            FilesListWithoutPath = null;
            FWindow.FMain.ListBox_Main.Items.Clear();
            FWindow.FMain.FilterTextBox_Main.Text = string.Empty;

            string path = TreeViewUtility.GetFullPath(sItem);

            FilesListWithoutPath = new List <IEnumerable <string> >();
            if (!string.IsNullOrEmpty(FWindow.FCurrentPAK))
            {
                IEnumerable <string> filesWithoutPath = PAKEntries.PAKToDisplay[FWindow.FCurrentPAK]
                                                        .Where(x => x.Name.Contains(path + "/" + Path.GetFileName(x.Name)))
                                                        .Select(x => Path.GetFileName(x.Name));

                if (filesWithoutPath != null)
                {
                    FilesListWithoutPath.Add(filesWithoutPath);
                }
            }
            else
            {
                foreach (FPakEntry[] PAKsFileInfos in PAKEntries.PAKToDisplay.Values)
                {
                    IEnumerable <string> filesWithoutPath = PAKsFileInfos
                                                            .Where(x => x.Name.Contains(path + "/" + Path.GetFileName(x.Name)))
                                                            .Select(x => Path.GetFileName(x.Name));

                    if (filesWithoutPath != null)
                    {
                        FilesListWithoutPath.Add(filesWithoutPath);
                    }
                }
            }

            if (FilesListWithoutPath != null && FilesListWithoutPath.Any())
            {
                await Task.Run(() =>
                {
                    FillMeThisPls();
                }).ContinueWith(TheTask =>
                {
                    TasksUtility.TaskCompleted(TheTask.Exception);
                });
            }

            FWindow.FMain.Button_Extract.IsEnabled = FWindow.FMain.ListBox_Main.SelectedIndex >= 0;
        }