Exemplo n.º 1
0
        public TrelloBoardService(ITrello trelloService, string boardId)
        {
            _trelloService = trelloService;

            _board = _trelloService.Boards.WithId(boardId);
            BoardName = _board.Name;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建新的List
        /// </summary>
        /// <param name="board"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool CreateListWithName(Board board, string name)
        {
            bool r = false;
            List list = null;
            if (board != null)
            {
                bool exist = false;
                var lists= this.Lists.ForBoard(board, ListFilter.Open);
                foreach (var item in lists)
                {
                    if (item.Name == name)
                    {
                        list = item;
                        exist = true;
                        break;
                    }
                }
                if (!exist)
                {
                    list = this.Lists.Add(name, board);
                    r = list != null;
                }

                if(exist || r)
                {
                    this.Lists.ChangePos(list, Position.Bottom);
                }
            }
            return r;
        }
Exemplo n.º 3
0
        private static void AddAcceptanceCriteria(List backlog, Board board)
        {
            foreach (var card in _trello.Cards.ForList(backlog).Where(a=>a.Checklists.Count==0))
            {
                var gg = _devCards.FirstOrDefault(a => GetCardName(a) == card.Name);
                var cl = SetChecklist(gg);

                _trello.Cards.AddChecklist(card, cl);
                _trello.Cards.Update(card);
                _trello.Checklists.Update(cl);
            }
        }
Exemplo n.º 4
0
 public IEnumerable<Member> GetMembers(Board board)
 {
     return _connection.Trello.Members.ForBoard(board);
 }
Exemplo n.º 5
0
 public IEnumerable<Card> GetCards(Board board)
 {
     if (board != null && _connection.IsAuthenticated())
         return _connection.Trello.Cards.ForBoard(board);
     return new List<Card>();
 }
Exemplo n.º 6
0
        private static void AddLabels(List backlog, Board board)
        {
            foreach (var card in _trello.Cards.ForList(backlog))
            {
                if (!_dic.Any(a => a.Key.Name == card.Name)) continue;
                var xxx = _dic.FirstOrDefault(a => a.Key.Name == card.Name);
                if (xxx.Key != null)
                {
                    SetPriority(xxx.Value, card, _count);
                    _count++;

                    SetTrelloLabel(xxx.Value, card);

                    // _trello.Cards.Update(card);
                    Thread.Sleep(500);
                }
            }
        }
Exemplo n.º 7
0
        private static void Main(string[] args)
        {
            if (!System.IO.File.Exists(File)) throw new FileNotFoundException(File);

            _pck = new ExcelPackage(new FileInfo(File));

            GetColumnIndexes();

            const string milestone = "Screens";
            _devCards = ExtractDevCards().Where(a => a.Milestone == milestone && a.EstimatedHours > 0).ToList();

            _trello = new Trello("7b17eb1ed849a91c051da9c924f93cfb");
            var url = _trello.GetAuthorizationUrl("userstorydataloader", Scope.ReadWrite);
            //Process.Start(url.AbsoluteUri);
            _trello.Authorize("db2c728bfd1b4cca3e07c0176e6ac3208fd4f363f383f9e0a2ac74081da4cd95");

            _board = _trello.Boards.WithId("55a8cdfd9536d1d4a332691f");
            _backlog = _trello.Lists
                .ForBoard(_board)
                .FirstOrDefault(a => a.Name == "Backlog");

            _lbls = _trello.Labels.ForBoard(_board);

            AddCards(_devCards, _backlog, _trello, _count);
            Thread.Sleep(5000);
            AddAcceptanceCriteria(_backlog, _board);
            Thread.Sleep(5000);
            AddLabels(_backlog, _board);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="board">The board.</param>
        /// <returns>List.</returns>
        public List GetList(string name, Board board)
        {
            var found =
                TrelloClient.Lists.ForBoard(board).FirstOrDefault(
                    l => l.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && !l.Closed);

            return found ?? TrelloClient.Lists.Add(new NewList(name, board));
        }
Exemplo n.º 9
0
 public BoardViewModel(Board board)
 {
     this.board = board;
 }
Exemplo n.º 10
0
        private void setupBoards()
        {
            if (alreadySetup) return;

            dailyBoard = this.trello.Boards.ForMe().SingleOrDefault(_ => _.Name == "DailyWork") ??
                         trello.Boards.Add("DailyWork");

            var dailyLists = trello.Lists.ForBoard(dailyBoard).ToList();

            currentList = currentList = dailyLists.SingleOrDefault(_ => _.Name == "Current") ??
                                        trello.Lists.Add("Current", dailyBoard);

            doneList = doneList = dailyLists.SingleOrDefault(_ => _.Name == "Done") ??
                                  trello.Lists.Add("Done", dailyBoard);

            alreadySetup = true;
        }
Exemplo n.º 11
0
        public void AddBoard(Board b)
        {
            TreeNode n = null;
            if (!boardDb.ContainsKey(b.Id))
            {
                n = new TreeNode(b.Name);
                View.TreeViewBoards.Nodes.Add(n);
            }
            else
            {
                n = boardDb.GetT(b.Id);
            }
            if (n != null)
            {
                n.Tag = b;
                n.Checked = b.Starred;
                n.Nodes.Clear();
                foreach (var list in b.Lists)
                {
                    TreeNode nl = new TreeNode(list.Name);
                    nl.Tag = list;
                    nl.Checked = b.Starred;
                    n.Nodes.Add(nl);

                }
                boardDb.Add(n, b);
            }
        }