Ejemplo n.º 1
0
 private void bucketSize_CheckedChanged(object sender, RoutedEventArgs e)
 {
     if (this.currentWeatherCollection != null)
     {
         var reportBuilder = new WeatherReportBuilder(this.lowerBound, this.upperBound);
         var report        = reportBuilder.CreateReport(this.currentWeatherCollection, this.getBucketSize());
         this.summaryTextBox.Text = report + this.errors;
     }
 }
Ejemplo n.º 2
0
        private async void addDayButton_Click(object sender, RoutedEventArgs e)
        {
            this.currentWeatherCollection = await DayAdder.AddNewDay(this.currentWeatherCollection);

            var reportBuilder = new WeatherReportBuilder(this.lowerBound, this.upperBound);
            var report        = reportBuilder.CreateReport(this.currentWeatherCollection, this.getBucketSize());

            this.summaryTextBox.Text = report + this.errors;
        }
Ejemplo n.º 3
0
 private void BoundsTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (this.currentWeatherCollection != null)
     {
         int.TryParse(this.lowerBoundTextBox.Text, out this.lowerBound);
         int.TryParse(this.upperBoundTextBox.Text, out this.upperBound);
         var reportBuilder = new WeatherReportBuilder(this.lowerBound, this.upperBound);
         var report        = reportBuilder.CreateReport(this.currentWeatherCollection, this.getBucketSize());
         this.summaryTextBox.Text = report + this.errors;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        ///     Handles the ClickAsync event of the loadFile control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private async void loadFile_ClickAsync(object sender, RoutedEventArgs e)
        {
            var filePicker = new FileOpenPicker {
                ViewMode = PickerViewMode.Thumbnail,
                SuggestedStartLocation = PickerLocationId.DocumentsLibrary
            };

            filePicker.FileTypeFilter.Add(".csv");
            filePicker.FileTypeFilter.Add(".txt");

            var chosenFile = await filePicker.PickSingleFileAsync();

            if (chosenFile == null)
            {
                this.summaryTextBox.Text = "No file was chosen.";
            }
            else
            {
                var fileParser = new WeatherFileParser();

                int.TryParse(this.lowerBoundTextBox.Text, out this.lowerBound);
                int.TryParse(this.upperBoundTextBox.Text, out this.upperBound);
                var reportBuilder = new WeatherReportBuilder(this.lowerBound, this.upperBound);

                var newWeatherCollection = await fileParser.ParseTemperatureFileAsync(chosenFile);

                if (this.currentWeatherCollection == null)
                {
                    this.currentWeatherCollection = newWeatherCollection;
                }
                else
                {
                    await this.handleNewFileWithExistingFile(newWeatherCollection);
                }

                this.errors = fileParser.ErrorMessages;
                var report = reportBuilder.CreateReport(this.currentWeatherCollection, this.getBucketSize());
                this.summaryTextBox.Text = report + this.errors;
            }
        }