コード例 #1
0
        private async Task BuildIndexAsync(bool skipItemTypesReload = false)
        {
            SetStatusbarText("Loading characters and items...");
            IndexSummary result;

            var newIndex = new Index();

            result = await newIndex.BuildAsync(GrimDawnDirectory, GrimDawnSavesDirectory, _loadedSettings.KeepExtractedDBFiles, false, (msg) => SetStatusbarText(msg)).ConfigureAwait(false);

            _index = newIndex;

            if (!skipItemTypesReload)
            {
                Dispatcher.Invoke((Action)(() =>
                {
                    var itemQualities = new ObservableCollection <MultiselectComboItem>();
                    itemQualities.AddRange(result.ItemRarities.Select(x => new MultiselectComboItem()
                    {
                        Selected = (x != "Common" && x != "Rare" && x != "Magical"), Value = x, DisplayText = x
                    }));
                    ItemQualities = itemQualities;

                    ItemTypes.Clear();
                    ItemTypes.AddRange(result.ItemTypes.Select(x => new MultiselectComboItem()
                    {
                        Selected = true, Value = x, DisplayText = ItemHelper.GetItemTypeDisplayName(x)
                    }));

                    AllCharacters.Clear();
                    AllCharacters.Add("(select character)");
                    AllCharacters.AddRange(result.Characters);
                }));
            }
        }