private void addEntry_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                var entryDate             = this.date.Date.Date;
                var entrySteps            = int.Parse(this.steps.Text);
                var entryDistance         = double.Parse(this.distance.Text);
                var entryCaloriesBurned   = int.Parse(this.caloriesBurned.Text);
                var entryFloors           = int.Parse(this.floors.Text);
                var entryActivityCalories = int.Parse(this.activityCalories.Text);
                var entryActiveMinutes    = MinuteConverter.ConvertMinutesToTimeSpan(int.Parse(this.activeMinutes.Text));

                var fitbitEntry = new FitbitEntry(entryDate, entrySteps, entryDistance, entryCaloriesBurned,
                                                  entryFloors, entryActivityCalories, entryActiveMinutes);
                this.FitbitEntry = fitbitEntry;
                this.doneAddingEntry_OnClick(sender, e);
            }

            catch (FormatException)
            {
                this.handleWhenNoEntryCreated(sender, e);
            }
            catch (ArgumentException)
            {
                this.handleWhenNoEntryCreated(sender, e);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     Parses the active minutes.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns></returns>
        private static TimeSpan parseActiveMinutes(string[] input)
        {
            var timeLine      = input[6];
            var timeInMinutes = int.Parse(timeLine);

            var activeMinutes = MinuteConverter.ConvertMinutesToTimeSpan(timeInMinutes);

            return(activeMinutes);
        }