コード例 #1
0
        /// <summary>
        /// This is used to initialize a check list item that is already attached to a pre-existing card.
        /// </summary>
        public ChecklistItemViewModel InitializeWith(string cardId, string listId, Card.CheckItem item)
        {
            using (new SuppressNotificationScope(this))
            {
                _idCard = cardId;
                _idList = listId;

                Id      = item.Id;
                Name    = item.Name;
                Checked = item.Checked;
            }

            return(this);
        }
コード例 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Creates a card. </summary>
        ///
        /// <param name="name">     The name. </param>
        /// <param name="desc">     The description. </param>
        /// <param name="closed">   True if closed. </param>
        /// <param name="dueDate">  The due date. </param>
        ///
        /// <returns>   The new card. </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private ExpectedObject CreateCard(string name, string desc, bool closed, DateTime dueDate)
        {
            Card c = trello.Cards.Add(name, list);

            if (c != null)
            {
                c.Desc   = desc;
                c.Closed = closed;
                //c.IdList = "4f2b8b4d4f2cb9d16d3684c1";
                c.IdBoard = board.GetBoardId();
                if (dueDate > DateTime.MinValue)
                {
                    c.Due = dueDate;
                }
                c.Labels           = new List <Label>();
                c.IdShort          = 1;
                c.Checklists       = new List <Card.Checklist>();
                c.Url              = "https://trello.com/b/bz7S3fiv/trello-microservice";
                c.ShortUrl         = "https://trello.com/b/bz7S3fiv";
                c.Pos              = 32768;
                c.DateLastActivity = SystemClock.Instance.GetCurrentInstant().ToDateTimeUtc().ToLocalTime();
                c.Badges           = new Card.CardBadges
                {
                    Votes             = 1,
                    Attachments       = 1,
                    Comments          = 2,
                    CheckItems        = 0,
                    CheckItemsChecked = 0,
                    Description       = true,
                    Due     = SystemClock.Instance.GetCurrentInstant().ToDateTimeUtc().ToLocalTime().AddDays(1),
                    FogBugz = ""
                };

                c.IdMembers = new List <string> {
                    "4f2b8b464f2cb9d16d368326"
                };
            }



            if (dueDate == DateTime.MinValue)
            {
                Label l = new Label
                {
                    Color   = Color.Green,
                    IdBoard = board.GetBoardId(),
                    Name    = "Green Label"
                };
                c.Labels.Add(l);

                //// Label card
                trello.Cards.AddLabel(c, Color.Green);
            }
            trello.Cards.Update(c);

            // Assign member to card
            trello.Cards.AddMember(c, trello.Members.Me());

            // Comment on a card
            trello.Cards.AddComment(c, RandomString(50));

            Card.CheckItem ci = new Card.CheckItem();
            ci.Pos  = 994;
            ci.Name = "Draft";
            ci.Id   = RandomString(12);

            Card.Checklist cl = new Card.Checklist();
            cl.IdBoard    = board.GetBoardId();
            cl.Name       = "To Do";
            cl.Pos        = 2485;
            cl.CheckItems = new List <Card.CheckItem>();
            c.Checklists.Add(cl);
            trello.Cards.Update(c);

            cl.CheckItems.Add(ci);
            trello.Cards.Update(c);



            card = c;
            return(c.ToExpectedObject());
        }