private void UpdateListSource(bool cacheSelection) { var currentSelectedItem = SelectedArmyList; var groups = ArmyLists?.OrderBy(i => i.Army).GroupBy(i => new { i.ArmyId }).Select(i => new ArmyListGroup(i.ToList())); UiContext.Post(action => { ArmyListGroups.Clear(); groups.ForEach(g => ArmyListGroups.Add(g)); }, null); SelectedArmyList = cacheSelection ? currentSelectedItem : null; }
private void LoadArmyData(List <Stream> dataStreams) { foreach (var s in dataStreams) { using (var reader = XmlReader.Create(s)) { var dsArmy = new XmlSerializer(typeof(Army)); var army = (Army)dsArmy.Deserialize(reader); UiContext.Post(action => { Armies.Add(army); }, null); ArmyLists.Where(a => a.ArmyId == army.Id).ForEach(a => a.Army = army); } s.Dispose(); } }
public void AddList(ArmyList newList) { ArmyLists?.Add(newList); }
private void RemoveSelectedList(ArmyList list) { ArmyLists?.Remove(list); }