Exemple #1
0
 public SplashViewModel(INavigationService navigationService, ITrelloApiSettings settings, ITrello api, ICache cache)
 {
     _navigationService = navigationService;
     _settings          = settings;
     _cache             = cache;
     _api = api;
 }
        private void Authenticate(string appKey, string userToken)
        {
            //TODO: tratar caso de appKey ou userToken inválido

            Trello = Trello ?? new TrelloNet.Trello(appKey);
            Trello.Authorize(userToken);
        }
        public TrelloBoardService(ITrello trelloService, string boardId)
        {
            _trelloService = trelloService;

            _board = _trelloService.Boards.WithId(boardId);
            BoardName = _board.Name;
        }
 public void DoWork(Card[] cards, ITrello trello, IDisplay display)
 {
     foreach (var card in cards.Select(x => new ReleaseNotesCard(x)))
     {
         display.Write(string.Format("{0} - {1}", card.Labels, card.Name));
     }
 }
Exemple #5
0
 public SplashViewModel(INavigationService navigationService, ITrelloApiSettings settings, ITrello api, ICache cache)
 {
     _navigationService = navigationService;
     _settings = settings;
     _cache = cache;
     _api = api;
 }
        private static void AddCards(List<DevCard> list, List backlog, ITrello trello, int count)
        {
            _cards = new List<Card>();
            _dic = new Dictionary<Card, DevCard>();

            foreach (var devCard in list)
            {
                Console.WriteLine(devCard.ToString());
                var cardname = GetCardName(devCard);

                var cc = new NewCard(cardname, backlog);
                var msg = devCard.ToString();
                msg += Environment.NewLine + Environment.NewLine +
                       string.Format("Feature:{0} Priority:{1}    {2}",
                           devCard.Feature + Environment.NewLine, devCard.Priority + Environment.NewLine,
                           devCard.Notes + Environment.NewLine);
                cc.Desc = msg;

                var card =
                  trello.Cards.ForList(backlog).FirstOrDefault(a => a.Name.ToLowerInvariant() == cardname.ToLowerInvariant());

                if (card == null)
                {
                    card = trello.Cards.Add(cc);
                }

                _cards.Add(card);
                _dic.Add(card, devCard);

            }
        }
        public MyNotificationsViewModel(INavigationService navigation, ITrello api)
        {
            _navigation = navigation;
            _api        = api;

            DisplayName   = "notifications";
            Notifications = new BindableCollection <NotificationViewModel>();
        }
Exemple #8
0
        protected AbstractHandler(IEventAggregator events, ITrello api, IProgressService progress)
        {
            Api = api;
            Progress = progress;

            Events = events;
            Events.Subscribe(this);
        }
        public ChangeCardLabelsViewModel(object root) : base(root)
        {
            _eventAggregator = IoC.Get <IEventAggregator>();
            _api             = IoC.Get <ITrello>();
            _progress        = IoC.Get <IProgressService>();

            Labels = new BindableCollection <Label>();
        }
Exemple #10
0
 public ProfileViewModel(ITrello api,
                         ITrelloApiSettings settings,
                         INavigationService navigation,
                         IEventAggregator eventAggregator) : base(settings, navigation)
 {
     _api             = api;
     _eventAggregator = eventAggregator;
 }
Exemple #11
0
		public void Setup()
		{
			_trelloReadOnly = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]);
			_trelloReadOnly.Authorize(ConfigurationManager.AppSettings["MemberReadToken"]);

			_trelloReadWrite = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]);
			_trelloReadWrite.Authorize(ConfigurationManager.AppSettings["MemberWriteToken"]);	
		}
        public TrelloService(TrelloSettings trelloSettings)
        {
            _trelloSettings = trelloSettings;

            _trello = new Trello(_trelloSettings.ApiKey);

            _trello.Authorize(_trelloSettings.Token);
        }
        public void Setup()
        {
            _trelloReadOnly = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]);
            _trelloReadOnly.Authorize(ConfigurationManager.AppSettings["MemberReadToken"]);

            _trelloReadWrite = new Trello(ConfigurationManager.AppSettings["ApplicationKey"]);
            _trelloReadWrite.Authorize(ConfigurationManager.AppSettings["MemberWriteToken"]);
        }
        public ChangeCardLabelsViewModel(object root) : base(root)
        {
            _eventAggregator = IoC.Get<IEventAggregator>();
            _api = IoC.Get<ITrello>();
            _progress = IoC.Get<IProgressService>();

            Labels = new BindableCollection<Label>();
        }
Exemple #15
0
 public ProfileViewModel(ITrello api,
                         ITrelloApiSettings settings,
                         INavigationService navigation,
                         IEventAggregator eventAggregator) : base(settings, navigation)
 {
     _api = api;
     _eventAggregator = eventAggregator;
 }
Exemple #16
0
        protected AbstractHandler(IEventAggregator events, ITrello api, IProgressService progress)
        {
            Api      = api;
            Progress = progress;

            Events = events;
            Events.Subscribe(this);
        }
Exemple #17
0
 public BoardViewModel(ITrelloApiSettings settings,
                       ITrello api,
                       INavigationService navigation,
                       IApplicationBar applicationBar,
                       Func <BoardListViewModel> listFactory) : base(navigation, applicationBar)
 {
     _api         = api;
     _listFactory = listFactory;
 }
Exemple #18
0
        public MyCardsViewModel(ITrello api, Func <CardViewModel> cardFactory)
        {
            _api         = api;
            _cardFactory = cardFactory;

            DisplayName = "cards";

            Cards = new BindableCollection <IGrouping <string, CardViewModel> >();
        }
Exemple #19
0
        public MyBoardsViewModel(INavigationService navigationService, ITrello api)
        {
            _navigationService = navigationService;
            _api = api;

            DisplayName = "boards";

            Boards = new BindableCollection <BoardViewModel>();
        }
Exemple #20
0
 public BoardViewModel(ITrelloApiSettings settings,
                       ITrello api,
                       INavigationService navigation,
                       IApplicationBar applicationBar,
                       Func<BoardListViewModel> listFactory) : base(navigation, applicationBar)
 {
     _api = api;
     _listFactory = listFactory;
 }
Exemple #21
0
        public TrelloHelper(Configuration configuration, ProjectsConfiguration projectsConfiguration)
        {
            _currentProjectId = projectsConfiguration.CurrentProjectId;
            _trello           = new Trello(configuration.Trello.ApiKey);
            _trello.Authorize(configuration.Trello.OAuthToken);
            var boardPlugins = _trello.Advanced.Get($"Boards/ZOUl8taI/boardPlugins").ToString();

            _trello.Advanced.Post("Boards/ZOUl8taI/boardPlugins", new { idPlugin = CustomFieldsPluginId });
            _currentBoardId = GetBoardForProject(projectsConfiguration);
        }
        public void DoWork(Card[] cards, ITrello trello, IDisplay display)
        {
            display.Skip();
            display.Write("Archiving cards...");

            foreach (var card in cards)
            {
                trello.Cards.Archive(card);
            }
        }
Exemple #23
0
 public MyTrelloApi(string authorizationToken = null, IUserInterface ui = null)
 {
     UI      = ui;
     _trello = new TrelloNet.Trello(ApplicationKey);
     if (string.IsNullOrEmpty(authorizationToken) || !TryAuthenticate(authorizationToken))
     {
         AuthorizationUrl = _trello.GetAuthorizationUrl("MyTrelloApi", Scope.ReadOnly, Expiration.Never);
         IsAuthorized     = false;
     }
 }
Exemple #24
0
 public TrelloClient(ITrelloConfig trelloConfig)
 {
     _trelloConfig = trelloConfig;
     _trello = Ioc.Container.Resolve<ITrello>(new ParameterOverride("key", _trelloConfig.TrelloKey));
     _trello.Authorize(_trelloConfig.TrelloToken);
     _lists = GetLists();
     _members = GetMembers();
     _cards = new List<TfsCard>();
     BoardId = new BoardId(trelloConfig.BoardId);
 }
Exemple #25
0
 public TrelloClient(ITrelloConfig trelloConfig)
 {
     _trelloConfig = trelloConfig;
     _trello       = Ioc.Container.Resolve <ITrello>(new ParameterOverride("key", _trelloConfig.TrelloKey));
     _trello.Authorize(_trelloConfig.TrelloToken);
     BoardId  = new BoardId(trelloConfig.BoardId);
     _lists   = GetLists();
     _members = GetMembers();
     _cards   = new List <TfsCard>();
 }
        public Card[] Fetch(ITrello trello, IOptions options)
        {
            var board = trello.Boards.WithId(options.BoardId);

            var list = trello.Lists
                .ForBoard(board)
                .First(x => string.Compare(x.Name, options.List, StringComparison.InvariantCultureIgnoreCase) == 0);

            return trello.Cards.ForList(list).ToArray();
        }
Exemple #27
0
        // DiscordSocketClient and CommandService are injected automatically from the IServiceProvider
        public Reminder(DiscordSocketClient discord,
                        IConfigurationRoot config,
                        IConfigurationRoot boards)
        {
            this.discord = discord;
            this.config  = config;
            this.boards  = boards;
            this.trello  = new Trello(this.config["tokens:trello"]);

            Console.Out.WriteLine("test");
        }
        public ImportCardsPresenter(IImportCardsView view, IMessageBus messageBus, ITrello trello, TaskScheduler taskScheduler)
        {
            this.view = view;
            this.messageBus = messageBus;
            this.trello = trello;
            this.taskScheduler = taskScheduler;
            trelloHelper = new TrelloHelper(trello);

            SetupMessageEventHandlers();
            SetupEventHandlers();
        }
        public MoveCardToBoardViewModel(object root) : base(root)
        {
            _eventAggregator = IoC.Get<IEventAggregator>();
            _api = IoC.Get<ITrello>();
            _progress = IoC.Get<IProgressService>();

            Boards = new BindableCollection<Board>();
            Lists = new BindableCollection<List>();

            PropertyChanged += OnPropertyChanged;
        }
        public void DoWork(Card[] cards, ITrello trello, IDisplay display)
        {
            var cardsGroupedByLabel = cards
                                        .Select(x => new ReleaseNotesCard(x))
                                        .GroupBy(x => x.Labels)
                                        .ToArray();

            File.WriteAllText(_options.Output,
                              Razor.Parse(File.ReadAllText(_options.Template),
                                          new { _options.SoftwareName, _options.SoftwareVersion, Groups = cardsGroupedByLabel }));
        }
Exemple #31
0
        public ImportCardsPresenter(IImportCardsView view, IMessageBus messageBus, ITrello trello, TaskScheduler taskScheduler)
        {
            this.view          = view;
            this.messageBus    = messageBus;
            this.trello        = trello;
            this.taskScheduler = taskScheduler;
            trelloHelper       = new TrelloHelper(trello);

            SetupMessageEventHandlers();
            SetupEventHandlers();
        }
Exemple #32
0
        public MoveCardToBoardViewModel(object root) : base(root)
        {
            _eventAggregator = IoC.Get <IEventAggregator>();
            _api             = IoC.Get <ITrello>();
            _progress        = IoC.Get <IProgressService>();

            Boards = new BindableCollection <Board>();
            Lists  = new BindableCollection <List>();

            PropertyChanged += OnPropertyChanged;
        }
 public void Init()
 {
     _trelloFake = A.Fake<ITrello>();
     var unityContainer = new UnityContainer();
     Ioc.Configure(unityContainer);
     unityContainer.RegisterInstance(_trelloFake);
     var trelloLists = new []{new List{Name = ListName, Id = "1"}};
     A.CallTo(() => _trelloFake.Lists.ForBoard(TrelloClient.BoardId, ListFilter.All)).Returns(trelloLists);
     var config = A.Fake<ITrelloConfig>();
     A.CallTo(() => config.BoardId).Returns("id");
     _trelloClient = new TrelloClient(config);
 }
Exemple #34
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(appKey) || appKey != this.textBox1.Text)
            {
                string[] tow = new string[] { this.textBox1.Text, token };
                File.WriteAllLines("data.txt", tow);
            }

            appKey = this.textBox1.Text;
            trello = new Trello(appKey);

            this.tabControl1.SelectedIndex = 1;
        }
        public ExportCardsPresenter(IExportCardsView view, ITrello trello, ICreateNewCards transformer, TaskScheduler taskScheduler, IMessageBus messageBus)
        {
            this.view = view;
            this.taskScheduler = taskScheduler;
            this.messageBus = messageBus;
            this.trello = trello;
            this.transformer = transformer;

            exportCardsCancellationTokenSource = new CancellationTokenSource();

            SetupMessageEventHandlers();
            SetupEventHandlers();
            SetupInitialState();
        }
Exemple #36
0
 public ArchiverJob(ITrello trello = null, string key = null, string secret = null)
 {
     this._key       = key ?? System.Configuration.ConfigurationManager.AppSettings["trellokey"];
     this._authToken = System.Configuration.ConfigurationManager.AppSettings["trelloauthtoken"];
     this._trello    = trello ?? new Trello(this._key);
     if (_authToken == null)
     {
         string msg = "You must authorize this app for your trello account. Use the url: " + _trello.GetAuthorizationUrl("Trello Archiver", Scope.ReadWrite, Expiration.Never).ToString();
         _log.Fatal(msg);
         throw new ArgumentException(msg);
     }
     _trello.Authorize(this._authToken);
     _log.InfoFormat("Authorized with token {0}", this._authToken);
 }
        public void DoWork(Card[] cards, ITrello trello, IDisplay display)
        {
            display.Skip();
            display.Write("Updating release version on cards...");

            foreach (var card in cards)
            {
                if (card.Desc.Contains(ReleaseTag(_options.SoftwareVersion)))
                    return;

                card.Desc += ReleaseTag(_options.SoftwareVersion);
                trello.Cards.ChangeDescription(card, card.Desc);
            }
        }
Exemple #38
0
        public TrelloWorldService(ITrello trello, IAsyncTrello asyncTrello, Settings settings)
        {
            if (asyncTrello == null)
            {
                throw new ArgumentNullException();
            }
            if (trello == null)
            {
                throw new ArgumentNullException();
            }

            _trello = trello;
            _trello.Authorize(settings.Token);
            _asyncTrello = asyncTrello;
        }
        public ExportCardsPresenter(IExportCardsView view, ITrello trello, ICreateNewCards transformer, TaskScheduler taskScheduler, IMessageBus messageBus)
        {
            this.view          = view;
            this.taskScheduler = taskScheduler;
            this.messageBus    = messageBus;
            this.trello        = trello;
            this.transformer   = transformer;
            trelloHelper       = new TrelloHelper(trello);

            exportCardsCancellationTokenSource = new CancellationTokenSource();

            SetupMessageEventHandlers();
            SetupEventHandlers();
            SetupInitialState();
        }
Exemple #40
0
        public BoardListViewModel(ITrello api,
                                  INavigationService navigation,
                                  IEventAggregator events,
                                  IWindowManager windows,
                                  Func <CardViewModel> cardFactory)
        {
            _api         = api;
            _navigation  = navigation;
            _events      = events;
            _windows     = windows;
            _cardFactory = cardFactory;

            _events.Subscribe(this);

            Cards = new BindableCollection <CardViewModel>();
        }
        public AuthorizePresenter(IAuthorizeView authorizeView, ITrello trello, IMessageBus messageBus)
        {
            this.authorizeView = authorizeView;
            this.trello        = trello;
            this.messageBus    = messageBus;

            authorizeView.AuthorizationTokenReceived += (sender, args) =>
            {
                trello.Authorize(args.Token);
                StoreTokenInSettings(args.Token);

                authorizeView.Hide();

                trello.Async.Members.Me()
                .ContinueWith(t => messageBus.Publish(new TrelloWasAuthorizedEvent(t.Result)));
            };
        }
        public void Init()
        {
            _trelloFake = A.Fake <ITrello>();
            var unityContainer = new UnityContainer();

            Ioc.Configure(unityContainer);
            unityContainer.RegisterInstance(_trelloFake);
            var trelloLists = new [] { new List {
                                           Name = ListName, Id = "1"
                                       } };

            A.CallTo(() => _trelloFake.Lists.ForBoard(TrelloClient.BoardId, ListFilter.All)).Returns(trelloLists);
            var config = A.Fake <ITrelloConfig>();

            A.CallTo(() => config.BoardId).Returns("id");
            _trelloClient = new TrelloClient(config);
        }
Exemple #43
0
 public void refreshData()
 {
     if (token != null && key != null)
     {
         if (trello == null)
         {
             trello = new Trello(key);
             trello.Authorize(token);
             enabled = true;
         }
         if (board == "")
         {
             getBoards();
         }
         else
         {
             getCards();
         }
     }
 }
        public CardDetailOverviewViewModel(ITrello api,
                                           ITrelloApiSettings settings,
                                           IProgressService progress,
                                           IEventAggregator eventAggregator,
                                           INavigationService navigation,
                                           IWindowManager windowManager)
        {
            DisplayName = "overview";

            _api             = api;
            _settings        = settings;
            _progress        = progress;
            _navigation      = navigation;
            _windowManager   = windowManager;
            _eventAggregator = eventAggregator;

            // we need to listen to other events even when not active
            _eventAggregator.Subscribe(this);

            Labels   = new BindableCollection <LabelViewModel>();
            Comments = new BindableCollection <ActivityViewModel>();
        }
Exemple #45
0
        public CardDetailPivotViewModel(ITrello api,
                                        ITrelloApiSettings settings,
                                        INavigationService navigation,
                                        IApplicationBar applicationBar,
                                        IEventAggregator eventAggregator,
                                        IWindowManager windowManager,
                                        Func <CardDetailOverviewViewModel> overview,
                                        Func <CardDetailChecklistViewModel> checklists,
                                        Func <CardDetailAttachmentsViewModel> attachments,
                                        Func <CardDetailMembersViewModel> members)
            : base(navigation, applicationBar)
        {
            _api           = api;
            _navigation    = navigation;
            _windowManager = windowManager;
            _overview      = overview;
            _checklists    = checklists;
            _attachments   = attachments;
            _members       = members;

            _eventAggregator = eventAggregator;
            _eventAggregator.Subscribe(this);
        }
Exemple #46
0
        public CardDetailMembersViewModel(ITrello api,
                                          IProgressService progress,
                                          IEventAggregator eventAggregator)
        {
            DisplayName = "members";

            _api             = api;
            _progress        = progress;
            _eventAggregator = eventAggregator;

            //_eventAggregator.Subscribe(this);

            AllMembersCount = 0;
            _members        = new BindableCollection <CardMemberViewModel>();
            _otherMembers   = new BindableCollection <CardMemberViewModel>();

            Members = new CollectionViewSource();
            Members.SortDescriptions.Add(new SortDescription("FullName", ListSortDirection.Descending));
            Members.Source = _members;

            OtherMembers = new CollectionViewSource();
            OtherMembers.SortDescriptions.Add(new SortDescription("FullName", ListSortDirection.Descending));
            OtherMembers.Source = _otherMembers;
        }
        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);
        }
 public TrelloHelper(ITrello trello)
 {
     this.trello = trello;
 }
        /// <summary>
        /// Get card Ids from all action
        /// </summary>
        /// <param name="trello">trello interface</param>
        /// <param name="boardId">board Id</param>
        /// <param name="startDate">filter start date</param>
        /// <param name="endDate">filter end date</param>
        /// <returns>List of card ids</returns>
        public static List<string> GetCardIdsFromActions(ITrello trello, string boardId, DateTime startDate, DateTime endDate)
        {
            var actions = trello.Actions.ForBoard(
                            new BoardId(boardId),
                            since: Since.Date(startDate),
                            paging: new Paging(1000, 0),
                            filter: CardActionTypes);
            var changedCardActions = actions.Where(a => a.Date > startDate && a.Date < endDate).ToList();
            var changedCardIds = new List<string>();
            foreach (var changedCardAction in changedCardActions)
            {
                // get only cards
                var cardId = GetCardIdFromAction(changedCardAction);

                // modified card
                if (!string.IsNullOrEmpty(cardId))
                {
                    // card id isnt exist
                    if (!changedCardIds.Contains(cardId))
                    {
                        changedCardIds.Add(cardId);
                    }
                }
            }

            return changedCardIds;
        }
Exemple #50
0
 public void setKey(string k)
 {
     key    = k;
     trello = new Trello(key);
 }
        /// <summary>
        /// Get cards for a report
        /// </summary>
        /// <param name="model">Input model</param>
        /// <param name="instance">Trello instance</param>
        /// <returns>Card list</returns>
        public static IEnumerable<Card> GetCards(ReportModel model, ITrello instance)
        {
            // set query start date
            var startDate = DateTimeHelper.GetStartDate(model.StartDate, model.ReportIntervalType);

            // set query end date
            var endDate = DateTimeHelper.GetEndDate(startDate, model.ReportIntervalType);

            // query cards
            var cards = instance.Cards.ForBoard(new BoardId(model.BoardId));

            // if interval type is actually, doesn't need activity filter
            if (model.ReportIntervalType != "actually")
            {
                // query card actions
                var changedCards = GetCardIdsFromActions(instance, model.BoardId, startDate, endDate);

                // filter cards by date interval
                cards = cards.Where(c => changedCards.Contains(c.Id));
            }

            // filter cards by lists
            cards = cards.Where(c => model.ListIds.Contains(c.IdList));

            // filter cards by user
            cards = cards.Where(c => c.Members.Select(m => m.Id).Intersect(model.UserIds).Any());

            // separated cards by labels
            cards = SepareteCardByLabels(cards);

            // order cards
            cards = OrderCards(cards);

            return cards;
        }
Exemple #52
0
 public TrelloHelper(ITrello trello)
 {
     this.trello = trello;
 }
 public void CleanUp()
 {
     _trelloFake = null;
     _trelloClient = null;
 }
Exemple #54
0
 public DetailCommandHandler(IEventAggregator events, ITrello api, IProgressService progress)
     : base(events, api, progress)
 {
 }
Exemple #55
0
 public MemberHandler(IEventAggregator events, ITrello api, IProgressService progress)
     : base(events, api, progress)
 {
 }