/* Processing */
        private void PopulateListBox(string repositoryType)
        {
            ClearListBox();
            IStockPricesRepository repository = RepositoryFactory.GetRepository(repositoryType);

            var prices = repository.GetStockPrice();

            foreach (var price in prices)
            {
                StockListBox.Items.Add(price);
            }

            ShowTicketText();
        }
Ejemplo n.º 2
0
        //FIELDS

        //CONSTRUCTORS

        //METHODS
        public static IStockPricesRepository GetRepository(string repositoryType)
        {
            IStockPricesRepository repository = null;

            switch (repositoryType)
            {
            case "API": repository = new APIRepository();
                break;

            case "CSV": repository = new CSVRepository();
                break;

            default:
                throw new ArgumentException("Invalid Repository Type Requested");
            }
            return(repository);
        }