public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
        {
            UniqueRoutesResult wrapper = (UniqueRoutesResult)element;

            switch(column.Id)
            {
                case SummaryColumnIds.ActColor:
                    return null;
                case SummaryColumnIds.StartTime:
                    return wrapper.StartTime;
                case SummaryColumnIds.StartDate:
                    return wrapper.StartDate;
                case SummaryColumnIds.Time:
                    return wrapper.Time;
                case SummaryColumnIds.Distance:
                    return wrapper.Distance;
                case SummaryColumnIds.AvgSpeed:
                    return wrapper.AvgSpeed;
                case SummaryColumnIds.AvgSpeedPace:
                    return wrapper.AvgSpeedPace;
                case SummaryColumnIds.AvgPace:
                    return wrapper.AvgPace;
                case SummaryColumnIds.AvgHR:
                    return wrapper.AvgHR;
                case SummaryColumnIds.CommonStretches:
                    return wrapper.CommonStretches;
                default:
                    string text = base.GetText(ActivityInfoCache.Instance.GetInfo(wrapper.Activity), column);
                    if (text != "")
                        return text;
                    else
                        return base.GetText(wrapper.Activity, column);                    
            }
        }
 public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
 {
     if (m_control != null)
     {
         m_control.ThemeChanged(visualTheme);
     }
 }
 public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
 {
     this.distanceBox.ThemeChanged(visualTheme);
     this.elinderBreakEvenBox.ThemeChanged(visualTheme);
     this.riegelFatigueFactorBox.ThemeChanged(visualTheme);
     this.bmiBox.ThemeChanged(visualTheme);
     this.shoeBox.ThemeChanged(visualTheme);
 }
 public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
 {
     m_visualTheme = visualTheme;
     this.bandwidthBox.ThemeChanged(visualTheme);
     this.ignoreBeginningBox.ThemeChanged(visualTheme);
     this.ignoreEndBox.ThemeChanged(visualTheme);
     this.boxCategory.ThemeChanged(visualTheme);
 }
 public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
 {
     distanceInputBox.ThemeChanged(visualTheme);
     timeInputBox.ThemeChanged(visualTheme);
     elevationInputBox.ThemeChanged(visualTheme);
     maxPulseBox.ThemeChanged(visualTheme);
     minPulseBox.ThemeChanged(visualTheme);
     this.highScoreControl1.ThemeChanged(visualTheme);
 }
 public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
 {
     PaceTempoResult wrapper = (PaceTempoResult)element;
     switch(column.Id)
     {
         case ResultColumnIds.Duration:
             return wrapper.Duration;
         case ResultColumnIds.Speed:
             return UnitUtil.PaceOrSpeed.ToString(Settings.ShowPace, wrapper.Speed);
         default:
             ActivityInfo actInfo = ActivityInfoCache.Instance.GetInfo(wrapper.Activity);
             string text = base.GetText(actInfo, column);
             if (text != "")
                 return text;
             else
                 return base.GetText(wrapper.Activity, column);                    
     }
 }
 public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
 {
     Result result = (Result)element;
     switch(column.Id)
     {
         case ResultColumnIds.Distance:
             return UnitUtil.Distance.ToString(result.Meters);
         case ResultColumnIds.Time:
             return UnitUtil.Time.ToString(result.Seconds);
         case ResultColumnIds.Speed:
             if (result.Seconds > 0 && result.Meters > 0)
             {
                 double speedMS = result.Meters / result.Seconds;
                 return UnitUtil.PaceOrSpeed.ToString(Settings.ShowPace, speedMS);
             }
             else
             {
                 return "-";
             }
         case ResultColumnIds.StartTime:
             return UnitUtil.Time.ToString(result.TimeStart);
         case ResultColumnIds.StartDistance:
             return UnitUtil.Distance.ToString(result.MeterStart);
         case ResultColumnIds.Elevation:
             return UnitUtil.Elevation.ToString(result.Elevations);
         case ResultColumnIds.AvgHR:
             if (!result.AveragePulse.Equals(double.NaN))
             {
                 return UnitUtil.HeartRate.ToString(result.AveragePulse);
             }
             return "-";
         case ResultColumnIds.Date:
             return result.Activity.StartTime.ToLocalTime().ToShortDateString();
         case ResultColumnIds.Location:
             return result.Activity.Location;
         default:
     ActivityInfo actInfo = ActivityInfoCache.Instance.GetInfo(result.Activity);
             string text = base.GetText(actInfo, column);
             if (text != "")
                 return text;
             else
                 return base.GetText(result.Activity, column);                    
     }
 }
 public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
 {
     IntervalResult wrapper = (IntervalResult)element;
     switch(column.Id)
     {
         case ResultColumnIds.Distance:
             return UnitUtil.Distance.ToString(wrapper.Distance);
         case ResultColumnIds.OneMile:
             return UnitUtil.Pace.ToString(wrapper.OneMile);
         case ResultColumnIds.FiveKm:
             return UnitUtil.Pace.ToString(wrapper.FiveKm);
         case ResultColumnIds.TenKm:
             return UnitUtil.Pace.ToString(wrapper.TenKm);
         default:
             ActivityInfo actInfo = ActivityInfoCache.Instance.GetInfo(wrapper.Activity);
             string text = base.GetText(actInfo, column);
             if (text != "")
                 return text;
             else
                 return base.GetText(wrapper.Activity, column);                    
     }
 }
 public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
 {
     TrainingResult wrapper = (TrainingResult)element;
     switch(column.Id)
     {
         case ResultColumnIds.ZoneDistance:
             return wrapper.ZoneDistance;
         case ResultColumnIds.PercentOfMax:
             return (100 * wrapper.PercentOfMax).ToString("F1");
         case ResultColumnIds.TrainRaceHR:
             return UnitUtil.HeartRate.ToString(wrapper.TrainRaceHR);
         case ResultColumnIds.Speed:
             return UnitUtil.PaceOrSpeed.ToString(Settings.ShowPace, wrapper.Speed);
         default:
             ActivityInfo actInfo = ActivityInfoCache.Instance.GetInfo(wrapper.Activity);
             string text = base.GetText(actInfo, column);
             if (text != "")
                 return text;
             else
                 return base.GetText(wrapper.Activity, column);                    
     }
 }
 public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
 {
     WeightResult wrapper = (WeightResult)element;
     switch(column.Id)
     {
         case ResultColumnIds.Weight:
             return UnitUtil.Weight.ToString(wrapper.Weight);
         case ResultColumnIds.AdjustedVDOT:
             return present(wrapper.AjustedVdot, 1);
         case ResultColumnIds.EstimatedTime:
             return UnitUtil.Time.ToString(wrapper.EstimatedTime);
         case ResultColumnIds.EstimatedSpeed:
             return UnitUtil.PaceOrSpeed.ToString(Settings.ShowPace, wrapper.EstimatedSpeed);
          default:
             ActivityInfo actInfo = ActivityInfoCache.Instance.GetInfo(wrapper.Activity);
             string text = base.GetText(actInfo, column);
             if (text != "")
                 return text;
             else
                 return base.GetText(wrapper.Activity, column);                    
     }
 }
        internal static bool boxCategory_ButtonClickedCommon(System.Windows.Forms.Label categoryLabel,
            ZoneFiveSoftware.Common.Visuals.TextBox boxCategory, 
            int noOfSelectedActivities, ITheme visualTheme)
        {
            TreeListPopup treeListPopup = new TreeListPopup();
            treeListPopup.ThemeChanged(visualTheme);
            treeListPopup.Tree.Columns.Add(new TreeList.Column());

            IList<object> list = new List<object>();
            list.Add(Util.StringResources.UseAllCategories);
            foreach (IActivityCategory category in Plugin.GetApplication().Logbook.ActivityCategories)
            {
                list.Add(category);
            }

            treeListPopup.Tree.RowData = list;
            treeListPopup.Tree.ContentProvider = new ActivityCategoryContentProvider(list);
            treeListPopup.Tree.ShowPlusMinus = true;
            treeListPopup.FitContent = false;

            if (Settings.SelectedCategory != null)
            {
                treeListPopup.Tree.Selected = new object[] { Settings.SelectedCategory };
            }
            //Expand by default
            System.Collections.IList parentCategories = new System.Collections.ArrayList();
            foreach (IActivityCategory category in Plugin.GetApplication().Logbook.ActivityCategories)
            {
                addNode(category, parentCategories);
            }
            treeListPopup.Tree.Expanded = parentCategories;

            bool result = false;
            treeListPopup.ItemSelected += delegate(object sender2, TreeListPopup.ItemSelectedEventArgs e2)
            {
                if (e2.Item is IActivityCategory)
                {
                    Settings.SelectedCategory = (IActivityCategory)e2.Item;
                }
                else
                {
                    Settings.SelectedCategory = null;
                }
                setCategoryLabel(categoryLabel, boxCategory, noOfSelectedActivities);
                result = true;
            };
            treeListPopup.Popup(boxCategory.Parent.RectangleToScreen(boxCategory.Bounds));
            return result;
        }
        internal static void setCategoryLabel(System.Windows.Forms.Label categoryLabel,
            ZoneFiveSoftware.Common.Visuals.TextBox boxCategory, int noOfSelectedActivities)
        {
            categoryLabel.Text = ZoneFiveSoftware.Common.Visuals.CommonResources.Text.LabelCategory + ":";
            if (noOfSelectedActivities > 1)
            {
                boxCategory.Text = string.Format(Resources.LimitingToSelected, noOfSelectedActivities);
                //categoryLabel.Text = string.Format(Resources.LimitingToSelected, selectedActivities.Count);
            }
            else
            {
                if (Settings.SelectedCategory == null)
                {
                    boxCategory.Text = Util.StringResources.UseAllCategories;
                    //categoryLabel.Text = Resources.IncludeAllActivitiesInSearch;
                }
                else
                {
                    boxCategory.Text = Settings.printFullCategoryPath(Settings.SelectedCategory);
                    //categoryLabel.Text = String.Format("{0}",//Resources.IncludeOnlyCategory,
                    //    Settings.printFullCategoryPath(Settings.SelectedCategory));
                }
            }
#if !ST_2_1
            //if (null != m_view && m_view.RouteSelectionProvider.SelectedItems.Count > 0)
            //{
            //    //TODO: Special info for selection?
            //    //categoryLabel.Text += " Using selected points";
            //}
#endif
            //btnChangeCategory.Location = new Point(
            //        summaryLabel.Location.X + summaryLabel.Width + 5,
            //             btnChangeCategory.Location.Y);
            //int btnOffset = btnChangeCategory.Visible ? btnChangeCategory.Width + 5 : 0;
            //categoryLabel.Location = new Point(
            //       btnChangeCategory.Location.X + btnOffset, summaryLabel.Location.Y);
        }
        public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
        {
            PredictorData wrapper = (PredictorData)element;

            //The time/speed fields
            if (column.Id == ResultColumnIds.PredictedTime)
            {
                PredictionModel model = Settings.Model;
                if (!wrapper.result.ContainsKey(model)) return null;
                return UnitUtil.Time.ToString(wrapper.result[Settings.Model].PredictedTime);
            }
            else if (column.Id == ResultColumnIds.Speed)
            {
                PredictionModel model = Settings.Model;
                if (!wrapper.result.ContainsKey(model)) return null;
                return UnitUtil.PaceOrSpeed.ToString(Settings.ShowPace, wrapper.Distance / wrapper.result[Settings.Model].PredictedTime);
            }
            else if (column.Id.StartsWith(ResultColumnIds.PredictedTimeModel))
            {
                string s = column.Id.Substring(ResultColumnIds.PredictedTimeModel.Length + 1);
                PredictionModel model = (PredictionModel)Enum.Parse(typeof(PredictionModel), s);
                if (!wrapper.result.ContainsKey(model)) return null;
                double time = wrapper.result[model].PredictedTime;
                return UnitUtil.Time.ToString(time);
            }
            else if (column.Id.StartsWith(ResultColumnIds.SpeedModel))
            {
                string s = column.Id.Substring(ResultColumnIds.SpeedModel.Length + 1);
                PredictionModel model = (PredictionModel)Enum.Parse(typeof(PredictionModel), s);
                if (!wrapper.result.ContainsKey(model)) return null;
                double time = wrapper.result[model].PredictedTime;
                return UnitUtil.PaceOrSpeed.ToString(Settings.ShowPace, wrapper.Distance / time);
            }

            if (wrapper.source == null)
            {
                return null;
            }

            switch (column.Id)
            {
                case ResultColumnIds.Distance:
                    return UnitUtil.Distance.ToString(wrapper.Distance);
                case ResultColumnIds.DistanceNominal:
                    return UnitUtil.Distance.ToString(wrapper.Distance, wrapper.Unit, "u");
                case ResultColumnIds.StartTime:
                    return wrapper.source.StartTime;
                case ResultColumnIds.UsedTime:
                    return UnitUtil.Time.ToString(wrapper.source.UsedTime);
                case ResultColumnIds.StartDistance:
                    return UnitUtil.Distance.ToString(wrapper.source.StartDistance);
                case ResultColumnIds.UsedDistance:
                    return UnitUtil.Distance.ToString(wrapper.source.UsedDistance);

                default:
                    ActivityInfo actInfo = ActivityInfoCache.Instance.GetInfo(wrapper.source.Activity);
                    string text = base.GetText(actInfo, column);
                    if (text != "")
                        return text;
                    else
                        return base.GetText(wrapper.source.Activity, column);
            }
        }
 public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
 {
     this.BackColor = visualTheme.Control;
 }
        public override string GetText(object element, ZoneFiveSoftware.Common.Visuals.TreeList.Column column)
        {
            ActivityWrapper wrapper = (ActivityWrapper)element;
            ActivityInfo actInfo = ActivityInfoCache.Instance.GetInfo(wrapper.Activity);
            ActivityInfo refActInfo = null;

            bool boRefExists = (CommonData.refActWrapper != null);
            if (boRefExists)
            {
                refActInfo = ActivityInfoCache.Instance.GetInfo(CommonData.refActWrapper.Activity);
            }

            switch(column.Id)
            {
                case OverlayColumnIds.Time:
                    return actInfo.Time.ToString();
                case OverlayColumnIds.StartTime:
                    return wrapper.Activity.StartTime.ToLocalTime().ToString();
                case OverlayColumnIds.Colour:
                    return null;
                case OverlayColumnIds.Offset:
                    if (Settings.UseTimeXAxis)
                        return wrapper.TimeOffset.ToString();
                    else
                        return UnitUtil.Distance.ToString(wrapper.DistanceOffset);
                case OverlayColumnIds.Visible:
                    return "";
                case OverlayColumnIds.Distance:
                    return UnitUtil.Distance.ToString(actInfo.DistanceMeters);
                case OverlayColumnIds.AvgSpeed:
                    return UnitUtil.Speed.ToString(actInfo.AverageSpeedMetersPerSecond);
                case OverlayColumnIds.AvgPace:
                    return UnitUtil.Pace.ToString(actInfo.AverageSpeedMetersPerSecond);
                case OverlayColumnIds.AvgHR:
                    return UnitUtil.HeartRate.ToString(actInfo.AverageHeartRate);
                case OverlayColumnIds.AvgCad:
                    return UnitUtil.Cadence.ToString(actInfo.AverageCadence);
                case OverlayColumnIds.AvgPower:
                    return UnitUtil.Power.ToString(actInfo.AveragePower);
                case OverlayColumnIds.MaxSpeed:
                    return UnitUtil.Speed.ToString(actInfo.FastestSpeedMetersPerSecond);
                case OverlayColumnIds.MaxPace:
                    return UnitUtil.Pace.ToString(actInfo.FastestSpeedMetersPerSecond);
                case OverlayColumnIds.TotAsc:
                    return UnitUtil.Elevation.ToString(actInfo.TotalAscendingMeters(Plugin.GetApplication().DisplayOptions.SelectedClimbZone));
                case OverlayColumnIds.TotDesc:
                    return UnitUtil.Elevation.ToString(actInfo.TotalDescendingMeters(Plugin.GetApplication().DisplayOptions.SelectedClimbZone));
                case OverlayColumnIds.DistanceDiff:
                    if (!boRefExists)
                        return "0";
                    else
                        return UnitUtil.Distance.ToString(actInfo.DistanceMeters - refActInfo.DistanceMeters);
                case OverlayColumnIds.AvgSpeedDiff:
                    if (!boRefExists)
                        return "0";
                    else
                        return UnitUtil.Speed.ToString(actInfo.AverageSpeedMetersPerSecond - refActInfo.AverageSpeedMetersPerSecond);
                case OverlayColumnIds.AvgPaceDiff:
                    if (!boRefExists)
                        return "0";
                    else
                    {
                        double pace = UnitUtil.Pace.ConvertFrom(actInfo.AverageSpeedMetersPerSecond);
                        double refPace = UnitUtil.Pace.ConvertFrom(refActInfo.AverageSpeedMetersPerSecond);
                        TimeSpan time = new TimeSpan(0, 0, (int)(pace-refPace));
                        return time.ToString();
                    }
                case OverlayColumnIds.AvgHRDiff:
                    if (!boRefExists)
                        return "0";
                    else
                        return UnitUtil.HeartRate.ToString(actInfo.AverageHeartRate - refActInfo.AverageHeartRate);
                case OverlayColumnIds.AvgPowerDiff:
                    if (!boRefExists)
                        return "0";
                    else
                        return UnitUtil.Power.ToString(actInfo.AveragePower - refActInfo.AveragePower);
                case OverlayColumnIds.AvgCadDiff:
                    if (!boRefExists)
                        return "0";
                    else
                        return UnitUtil.Cadence.ToString(actInfo.AverageCadence - refActInfo.AverageCadence);
                case OverlayColumnIds.TimeDiff:
                    if (!boRefExists)
                        return new TimeSpan(0).ToString();
                    else
                        return (actInfo.Time - refActInfo.Time).ToString();
                default:
                    string text = base.GetText(actInfo, column);
                    if (text != "")
                        return text;
                    else
                        return base.GetText(wrapper.Activity, column);                    
            }
        }
 private void dataChanged(object sender, ZoneFiveSoftware.Common.Data.NotifyDataChangedEventArgs e)
        public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
        {
            List<ZoneFiveSoftware.Common.Visuals.TextBox> TextBoxes = new List<ZoneFiveSoftware.Common.Visuals.TextBox>();

            this.PanelChoiceActionBanner.ThemeChanged(visualTheme);
            this.BackColor = visualTheme.Control;
            this.InputsPanel.ThemeChanged(visualTheme);
            this.ExportPreviewPanel.ThemeChanged(visualTheme);

            foreach (System.Windows.Forms.Control control in InputsPanel.Controls)
            {
                TextBoxes.AddRange(FindTextBoxes(control));
            }
            foreach (System.Windows.Forms.Control control in ExportPreviewPanel.Controls)
            {
                TextBoxes.AddRange(FindTextBoxes(control));
            }

            foreach (ZoneFiveSoftware.Common.Visuals.TextBox TB in TextBoxes)
            {
                TB.ThemeChanged(visualTheme);
            }

            // ThemeChanged combo box looks worse when following the colors of the theme
            // since the frame and arrow remain white
            //this.RPEComboBox.BackColor = visualTheme.Window;
            //this.RPEComboBox.ForeColor = visualTheme.ControlText;
        }
 public CategorySelector(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme, System.Globalization.CultureInfo culture)
     : this()
 {
     this.ThemeChanged(visualTheme);
     this.UICultureChanged(culture);
 }
 public override bool ValidateAfterZoneCategoryChanged(ZoneFiveSoftware.Common.Data.Fitness.IZoneCategory changedCategory)
 {
     return false;
 }
Beispiel #20
0
 public static ZoneFiveSoftware.Common.Data.Measurement.Weight.Units SmallUnit(ZoneFiveSoftware.Common.Data.Measurement.Weight.Units unit)
 {
     if (unit == ZoneFiveSoftware.Common.Data.Measurement.Weight.Units.Kilogram)
     {
         unit = ZoneFiveSoftware.Common.Data.Measurement.Weight.Units.Gram;
     }
     else if (unit == ZoneFiveSoftware.Common.Data.Measurement.Weight.Units.Pound ||
         unit == ZoneFiveSoftware.Common.Data.Measurement.Weight.Units.Stone)
     {
         unit = ZoneFiveSoftware.Common.Data.Measurement.Weight.Units.Ounce;
     }
     else
     {
         //gram, oz
         //do not name to allow for new units without strange effects
     }
     return unit;
 }
Beispiel #21
0
 public static string ToString(double p, ZoneFiveSoftware.Common.Data.Measurement.Weight.Units unit, string fmt)
 {
     string dfmt = DefFmt;
     //Uvalue is in kg (SI), unit is presentation
     if (unit != Unit)
     {
         p = ZoneFiveSoftware.Common.Data.Measurement.Weight.Convert(p, Unit, unit);
     }
     if (unit == ZoneFiveSoftware.Common.Data.Measurement.Weight.Units.Gram)
     {
         dfmt = "F0";
     }
     else if (unit == ZoneFiveSoftware.Common.Data.Measurement.Weight.Units.Ounce)
     {
         dfmt = "F1";
     }
     if (fmt.ToLower().Equals("u") || string.IsNullOrEmpty(fmt)) { fmt = dfmt + fmt; }
     return ZoneFiveSoftware.Common.Data.Measurement.Weight.ToString(ConvertFrom(p), unit, fmt);
 }
 public static string TextShoeWeightColumn(ZoneFiveSoftware.Common.Data.Measurement.Weight.Units unit)
 {
     return ZoneFiveSoftware.Common.Visuals.CommonResources.Text.LabelWeight + " (" + ZoneFiveSoftware.Common.Data.Measurement.Weight.LabelAbbr(unit)+')';
 }
 public override void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
 {
 }
Beispiel #24
0
 public static double Parse(string p, ZoneFiveSoftware.Common.Data.Measurement.Weight.Units unit)
 {
     return ZoneFiveSoftware.Common.Data.Measurement.Weight.ParseWeightKilograms(p, unit);
 }