예제 #1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            ChartBrush = new SolidColorBrush((Color)Application.Current.Resources["PhoneAccentColor"]);
            //LineGraphTitle = new String("Title");

            // pull the summary object out of phone application state:
            if (PhoneApplicationService.Current.State.Keys.Contains("summary"))
            {
                Helpers.SummaryData summary = (Helpers.SummaryData)PhoneApplicationService.Current.State["summary"];

                UserSettings settings = UserSettings.GetUserSettings();

                // FIRST PIVOT  (SUMMARY):
                lblTotalDistance.Text    = ValueFormatter.GetDistanceFormatted(summary.TotalDistanceInMeters, settings.Options.DistanceUnit, false);
                lblTotalTime.Text        = GetTimeString(summary.TotalTime);
                lblHighestElevation.Text = ValueFormatter.GetElevationFormatted(summary.HighestElevation, settings.Options.ElevationUnit);
                lblLowestElevation.Text  = ValueFormatter.GetElevationFormatted(summary.LowestElevation, settings.Options.ElevationUnit);
                lblAverageElevation.Text = ValueFormatter.GetElevationFormatted(summary.AverageElevation, settings.Options.ElevationUnit);



                //// APPLY THE TITLE BASED ON THE ELEVATION UNIT:
                //switch (settings.Options.ElevationUnit)
                //{
                //    case (int)Helpers.Enumerations.ElevationUnit.Kilometers:
                //        ElevationLineGraph.Title = AppResources.ElevationInKilos;
                //        break;
                //    case (int)Helpers.Enumerations.ElevationUnit.Meters:
                //        ElevationLineGraph.Title = AppResources.ElevationInMeters;
                //        break;
                //    case (int)Helpers.Enumerations.ElevationUnit.Miles:
                //        ElevationLineGraph.Title = AppResources.ElevationInMiles;
                //        break;
                //    default:
                //        break;
                //}

                // SECOND PIVOT (ELEVATION LINE GRAPH):
                Data = new ObservableCollection <ChartData>();
                foreach (ChartData cd in summary.ChartData)
                {
                    Data.Add(cd);
                }
            }
        }