Exemplo n.º 1
0
        private void prepareBeginningWindow()
        {
            var today = new Date
            {
                Day   = DateTime.Today.Day,
                Month = DateTime.Today.Month,
                Year  = DateTime.Today.Year
            };

            try
            {
                PopularCurrencies = WebsiteReader.GetCurrencries(today);
            }
            catch (Exception e)
            {
                Helper.Message(e.Message);
            }
            List <DateTime> dateTimeList = WebsiteReader.DownloadAllCurrenciesWithDates();
            var             datetime     = dateTimeList.Select(x => new Date
            {
                Day   = x.Day,
                Month = x.Month,
                Year  = x.Year
            }).ToList();

            date_list_view.ItemsSource = datetime;
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            // CreateWebHostBuilder(args).Build().Run();
            WebsiteReader wb = new WebsiteReader();

            wb.DownloadLines("http://www.nbp.pl/kursy/xml/dir.txt");
            wb.GatherData();
        }
        public async Task TestReadPageFail(HttpStatusCode statusCode)
        {
            var url = _mockServer.Urls.First();

            _mockServer.Given(Request.Create().UsingGet())
            .RespondWith(Response.Create()
                         .WithBody("SuccessFullRequest")
                         .WithStatusCode(statusCode));

            using (var client = new HttpClient())
            {
                var reader = new WebsiteReader(client);
                await Assert.ThrowsAnyAsync <Exception>(() => reader.ReadPageAsync(url));
            }
        }
        public async Task TestReadPage()
        {
            var url = _mockServer.Urls.First();

            _mockServer.Given(Request.Create().UsingGet())
            .RespondWith(Response.Create()
                         .WithBody("SuccessFullRequest")
                         .WithStatusCode(HttpStatusCode.OK));

            using (var client = new HttpClient())
            {
                var reader  = new WebsiteReader(client);
                var content = await reader.ReadPageAsync(url);

                Assert.Equal("SuccessFullRequest", content);
            }
        }
Exemplo n.º 5
0
 private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     WebsiteReader.SelectedDate = (Date)e.AddedItems[0];
     PopularCurrencies          = WebsiteReader.GetCurrencries(WebsiteReader.SelectedDate);
     currency_grid.ItemsSource  = PopularCurrencies;
 }
Exemplo n.º 6
0
 public MainPage()
 {
     this.InitializeComponent();
     websiteReader = new WebsiteReader();
     prepareBeginningWindow();
 }