public static ObservableSection AsObservable(this ISection section) { if (section == null) return null; var ret = new ObservableSection(); ret.Name = section.Name; ret.Cards = section.Cards; return ret; }
public static ObservableSection AsObservable(this ISection section) { if (section == null) return null; var ret = new ObservableSection(); ret.Name = section.Name.Clone() as string; ret.Cards = section.Cards.ToArray(); ret.Shared = section.Shared; return ret; }
public static ObservableDeck AsObservable(this IDeck deck) { if (deck == null) return null; var ret = new ObservableDeck(); ret.GameId = deck.GameId; ret.IsShared = deck.IsShared; if (deck.Sections == null) ret.Sections = new List<ObservableSection>(); else { ret.Sections = deck.Sections .Where(x => x != null) .Select( x => { var sret = new ObservableSection(); sret.Name = (x.Name ?? "").Clone() as string; if(x.Cards == null) sret.Cards = new List<ObservableMultiCard>(); else sret.Cards = x.Cards.Where(y=> y != null).Select(y => y.AsObservable()).ToArray(); sret.Shared = x.Shared; return sret; }); } ret.Notes = (deck.Notes ?? "").Clone() as string; return ret; }