예제 #1
0
 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;
 }
예제 #2
0
 public static ObservableDeck AsObservable(this IDeck deck)
 {
     if (deck == null) return null;
     var ret = new ObservableDeck
               {
                   GameId = deck.GameId,
                   IsShared = deck.IsShared,
                   Sections = deck.Sections.Select(x => new ObservableSection()
                                                      {
                                                          Name = x.Name.Clone() as string,
                                                          Cards = x.Cards.Select(y => y.AsObservable()).ToArray(),
                                                          Shared = x.Shared
                                                      }),
                   Notes = deck.Notes.Clone() as string
               };
     return ret;
 }
예제 #3
0
 public static ObservableDeck AsObservable(this IDeck deck)
 {
     if (deck == null) return null;
     var ret = new ObservableDeck { GameId = deck.GameId, IsShared = deck.IsShared, Sections = deck.Sections };
     return ret;
 }