Ejemplo n.º 1
0
        internal Sticker(IJsonSticker json, string ownerId, TrelloAuthorization auth)
        {
            Id       = json.Id;
            _context = new StickerContext(Id, ownerId, auth);
            _context.Synchronized.Add(this);

            _left = new Field <double?>(_context, nameof(Left));
            _left.AddRule(NullableHasValueRule <double> .Instance);
            _name     = new Field <string>(_context, nameof(Name));
            _rotation = new Field <int?>(_context, nameof(Rotation));
            _rotation.AddRule(NullableHasValueRule <int> .Instance);
            _rotation.AddRule(new NumericRule <int> {
                Min = 0, Max = 359
            });
            _top = new Field <double?>(_context, nameof(Top));
            _top.AddRule(NullableHasValueRule <double> .Instance);
            _url    = new Field <string>(_context, nameof(ImageUrl));
            _zIndex = new Field <int?>(_context, nameof(ZIndex));
            _zIndex.AddRule(NullableHasValueRule <int> .Instance);

            _context.Merge(json);

            if (auth != TrelloAuthorization.Null)
            {
                TrelloConfiguration.Cache.Add(this);
            }
        }
 internal ReadOnlyStickerPreviewCollection(StickerContext context, TrelloAuthorization auth)
     : base(() => context.Data.Id, auth)
 {
     _context = context;
 }