private async Task ImportInternal() { ISaveDataService saveDataService = ServicesContainer.GetService <ISaveDataService>(); IList <SaveDataInfo> saveDataInfoItems = saveDataService.GetSaveInfo(); IList <Task <IList <DecorationsSaveSlotInfo> > > allTasks = saveDataInfoItems .Select(ReadSaveData) .ToList(); await Task.WhenAll(allTasks); IList <DecorationsSaveSlotInfo> allSlots = allTasks .SelectMany(x => x.Result) .ToList(); DecorationsSaveSlotInfo selected; if (allSlots.Count > 1) { selected = saveSlotInfoSelector(allSlots); if (selected == null) { return; } } else { selected = allSlots[0]; } MessageBox.Show("Save data import done.", "Import", MessageBoxButton.OK); ApplySaveDataDecorations(selected); }
private async Task ImportInternal() { if (gameEquipments == null) { gameEquipments = LoadGameEquipments(); if (gameEquipments == null) { return; } } ISaveDataService saveDataService = ServicesContainer.GetService <ISaveDataService>(); if (saveDataService == null) { return; } IList <SaveDataInfo> saveDataInfoItems = saveDataService.GetSaveInfo(); if (saveDataInfoItems == null) { return; } IList <Task <IList <EquipmentsSaveSlotInfo> > > allTasks = saveDataInfoItems .Select(ReadSaveData) .ToList(); await Task.WhenAll(allTasks); IList <EquipmentsSaveSlotInfo> allSlots = allTasks .SelectMany(x => x.Result) .ToList(); EquipmentsSaveSlotInfo selected; if (allSlots.Count > 1) { selected = saveSlotInfoSelector(allSlots); if (selected == null) { return; } } else { selected = allSlots[0]; } System.Windows.MessageBox.Show("Save data import done.", "Import", System.Windows.MessageBoxButton.OK); ApplySaveDataEquipments(selected); }