public System.Drawing.Image GetImage(object element, TreeList.Column column) { ActivityTrail t = ((ActivityTrailWrapper)element).ActivityTrail; //if (t.ActivityCount == 0) //{ // return Properties.Resources.square_blue; //} switch (t.Status) { case TrailOrderStatus.Match: return(Properties.Resources.square_green); case TrailOrderStatus.MatchNoCalc: return(Properties.Resources.square_green_check); case TrailOrderStatus.MatchPartial: return(Properties.Resources.square_green_minus); case TrailOrderStatus.InBoundNoCalc: return(Properties.Resources.square_green_plus); case TrailOrderStatus.InBoundMatchPartial: return(Properties.Resources.square_red_plus); case TrailOrderStatus.InBound: return(Properties.Resources.square_red); case TrailOrderStatus.NotInBound: return(Properties.Resources.square_blue); default: //NoConfiguration, NoInfo, NotInstalled return(null); } }
public string GetText(object element, TreeList.Column column) { ActivityTrail at = ((ActivityTrailWrapper)element).ActivityTrail; string name = at.Trail.Name; if (at.Trail.Parent != null) { //Remove parent part, colon/space is flexible name = name.Substring(at.Trail.Parent.Name.Length + 1).TrimStart(' ', ':'); } if (at.Trail.IsReference && null != at.Trail.ReferenceActivity) { DateTime time = ActivityInfoCache.Instance.GetInfo(at.Trail.ReferenceActivity).ActualTrackStart; if (DateTime.MinValue == time) { time = at.Trail.ReferenceActivity.StartTime; } name += " " + time.ToLocalTime().ToString(); } if (at.Status == TrailOrderStatus.Match || at.Status == TrailOrderStatus.MatchPartial) { int n = at.Results.Count; foreach (Trail t2 in at.Trail.AllChildren) { n += Controller.TrailController.Instance.GetActivityTrail(t2).Results.Count; } name += " (" + n; if (at.Trail.IsURFilter && at.FilteredResults.Count > 0) { name += " ," + at.FilteredResults.Count; } name += ")"; } else if (at.Status == TrailOrderStatus.MatchNoCalc) { if (at.Trail.TrailType == Trail.CalcType.Splits || at.Trail.TrailType == Trail.CalcType.UniqueRoutes) { name += " (" + Controller.TrailController.Instance.Activities.Count + ")"; } } else if ((at.Status == TrailOrderStatus.InBoundMatchPartial) && at.m_noResCount.ContainsKey(at.Status)) { name += " (" + at.m_noResCount[at.Status]; if (at.m_noResCount.ContainsKey(TrailOrderStatus.InBound)) { name += ", " + at.m_noResCount[TrailOrderStatus.InBound]; } name += ")"; } //Other results else if (at.m_noResCount.ContainsKey(at.Status)) { name += " (" + at.m_noResCount[at.Status] + ")"; } return(name); }
protected override FontStyle GetCellFontStyle(object element, TreeList.Column column) { if (IsTotalRow(element)) { return(FontStyle.Bold); } return(FontStyle.Regular); }
//public override Image GetImage(object element, TreeList.Column column) //{ // return base.GetImage(row.Activity, column); //} public override string GetText(object element, TreeList.Column column) { Data.EditTrailRow row = (EditTrailRow)(element); switch (column.Id) { case EditTrailColumnIds.Required: return(null); case EditTrailColumnIds.Distance: if (row.m_distance != null) { return(UnitUtil.Distance.ToString((double)row.m_distance, "u", false)); } else { return(""); } case EditTrailColumnIds.Time: if (row.m_time != null) { return(UnitUtil.Time.ToString((double)row.m_time)); } else { return(""); } case EditTrailColumnIds.ResultElevation: if (row.m_elevation == null || float.IsNaN((float)row.m_elevation)) { return(""); } else { return(UnitUtil.Elevation.ToString((double)row.m_elevation, "u")); } case EditTrailColumnIds.Diff: return(UnitUtil.Elevation.ToString(row.m_diff, "u")); case EditTrailColumnIds.ElevationMeters: if (float.IsNaN(row.TrailGPS.ElevationMeters)) { return(""); } else { return(UnitUtil.Elevation.ToString(row.TrailGPS.ElevationMeters, "u")); } default: //All TrailGPS return(base.GetText(row.TrailGPS, column)); } }
protected override FontStyle GetCellFontStyle(object element, TreeList.Column column) { QAActivity activity = element as QAActivity; // Bold totals row if (activity != null && activity.IsTotalsRow) { return(FontStyle.Bold); } return(base.GetCellFontStyle(element, column)); }
public override Image GetImage(object element, TreeList.Column column) { Data.TrailResult row = (element as TrailResultWrapper).Result; if (column.Id == TrailResultColumnIds.ResultColor) { return(CommonIcons.ResultColorCache(column.Width, 15, row.ResultColor.LineNormal)); } else { //No other image used, no need for reflection //return base.GetImage(row.Activity, column); } return(null); }
public string GetText(object element, TreeList.Column column) { if (element != null && element is string) { return(element as string); //TBD } if (!(element is IActivity)) { return(""); } IActivity act = element as IActivity; string name = act.StartTime.ToLongDateString() + " " + act.Name; return(name); }
protected override System.Drawing.FontStyle GetCellFontStyle(object element, TreeList.Column column) { if (element is TrailResultWrapper) { TrailResultWrapper wrapper = (element as TrailResultWrapper); if (wrapper.Result is SummaryTrailResult) { if ((wrapper.Element as SummaryTrailResult).IsTotal) { return(System.Drawing.FontStyle.Bold); } return(System.Drawing.FontStyle.Italic); } else if (wrapper.Result is PausedChildTrailResult) { PausedChildTrailResult pause = wrapper.Result as PausedChildTrailResult; System.Drawing.FontStyle res = System.Drawing.FontStyle.Strikeout; if (pause.pauseType == PauseType.Stopped) { res |= FontStyle.Italic; } if (pause.pauseType == PauseType.Timer) { res |= FontStyle.Bold; } return(res); } else { if (Controller.TrailController.Instance.ReferenceResult != null && wrapper.Result == Controller.TrailController.Instance.ReferenceResult.Result) { return(System.Drawing.FontStyle.Italic); } } } return(base.GetCellFontStyle(element, column)); }
public System.Drawing.Image GetImage(object element, TreeList.Column column) { return(null); }
private void updateColumns() { temperatureList.Columns.Clear(); foreach (string id in ResultColumnIds.TemperatureColumns) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); temperatureList.Columns.Add(column); break; } } } weightList.Columns.Clear(); foreach (string id in ResultColumnIds.WeightColumns) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); weightList.Columns.Add(column); break; } } } shoeList.Columns.Clear(); foreach (string id in ResultColumnIds.ShoeColumns) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); shoeList.Columns.Add(column); break; } } } ageList.Columns.Clear(); foreach (string id in ResultColumnIds.AgeColumns) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); ageList.Columns.Add(column); break; } } } }
protected override void DrawCell(Graphics graphics, TreeList.DrawItemState rowState, object element, TreeList.Column column, Rectangle cellRect) { Feature feature = element as Feature; if (feature != null) { if (feature.selectedColor != Color.Empty) { // If this is the ID column and the feature.selectedColor isn't empty, color the cell and return. We don't need an id if (column.Id == "HillId") { Brush selectedBrush = new SolidBrush(feature.selectedColor); graphics.FillRectangle(selectedBrush, cellRect); return; } } } base.DrawCell(graphics, rowState, element, column, cellRect); }
private void RefreshColumns() { summaryList.Columns.Clear(); ICollection<IListColumnDefinition> allCols = SummaryColumnIds.ColumnDefs(this.m_refActivity); //Permanent fields foreach (IListColumnDefinition columnDef in SummaryColumnIds.PermanentMultiColumnDefs()) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); summaryList.Columns.Add(column); } foreach (string id in Settings.ActivityPageColumns) { foreach (ListColumnDefinition columnDef in allCols) { if (columnDef.Id == id) { TreeList.Column col = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); col.CanSelect = columnDef.CanSelect; summaryList.Columns.Add(col); break; } } } }
public CalculatedFieldsSettingsPageControl() { this.InitializeComponent(); buttonAdd.Image = CommonResources.Images.DocumentAdd16; buttonAddNested.Image = CommonResources.Images.DocumentAdd16; buttonAddVirtual.Image = CommonResources.Images.DocumentAdd16; buttonRemove.Image = CommonResources.Images.Delete16; buttonRemoveNested.Image = CommonResources.Images.Delete16; buttonRemoveVirtual.Image = CommonResources.Images.Delete16; buttonUpdate.Image = CommonResources.Images.Edit16; buttonUpdateNested.Image = CommonResources.Images.Edit16; buttonUpdateVirtual.Image = CommonResources.Images.Edit16; buttonTestSelected.Image = CommonResources.Images.Analyze16; buttonCalculateSelected.Image = CommonResources.Images.Calculator16; buttonClearSelected.Image = CommonResources.Images.Delete16; ICustomDataFieldObjectType type = CustomDataFieldDefinitions.StandardObjectType(typeof(IActivity)); foreach (ICustomDataFieldDefinition definition in CalculatedFields.GetLogBook().CustomDataFieldDefinitions) { if (definition.ObjectType == type) { if (!comboBoxCustomField.Items.Contains(definition.Name)) { comboBoxCustomField.Items.Add(definition.Name); } } } GlobalSettings.LoadSettings(); GlobalSettings.calculatedFieldsRows.Sort(); GlobalSettings.nestedFieldsRows.Sort(); this.checkBoxAfterImport.Checked = GlobalSettings.runAfterImport; this.checkBoxAfterImportFuture.Checked = GlobalSettings.calculateFutureAfterImport; this.comboBoxDataTrackResolution.SelectedItem = GlobalSettings.dataTrackResolution.ToString(); ITheme visualTheme = CalculatedFields.GetApplication().VisualTheme; var active = new TreeList.Column("Active", "Active", 50, StringAlignment.Center); var customField = new TreeList.Column("CustomField", "Calculated Custom Field", 150, StringAlignment.Near); var calculatedExpression = new TreeList.Column("CalculatedExpression", "Expression", 300, StringAlignment.Near); var condition = new TreeList.Column("Condition", "Condition", 200, StringAlignment.Near); //var parsingTime = new TreeList.Column("ParsingTime", "Parsing Time", 100, StringAlignment.Near); //var compilationTime = new TreeList.Column("CompilationTime", "Compilation Time", 100, StringAlignment.Near); treeListCalculatedFields.Columns.Add(customField); treeListCalculatedFields.Columns.Add(calculatedExpression); treeListCalculatedFields.Columns.Add(condition); treeListCalculatedFields.Columns.Add(active); //treeListCalculatedFields.Columns.Add(parsingTime); //treeListCalculatedFields.Columns.Add(compilationTime); treeListCalculatedFields.RowData = GlobalSettings.calculatedFieldsRows; treeListCalculatedFields.ThemeChanged(visualTheme); var nestedExpressionName = new TreeList.Column("NestedExpression", "Nested Expression Name", 150, StringAlignment.Near); var nestedExpression = new TreeList.Column("Expression", "Expression", 500, StringAlignment.Near); treeListNestedExpressions.Columns.Add(nestedExpressionName); treeListNestedExpressions.Columns.Add(nestedExpression); treeListNestedExpressions.RowData = GlobalSettings.nestedFieldsRows; treeListNestedExpressions.ThemeChanged(visualTheme); var virtualField = new TreeList.Column("CustomField", "Virtual Field", 150, StringAlignment.Near); var virtualExpression = new TreeList.Column("CalculatedExpression", "Expression", 300, StringAlignment.Near); treeListVirtualExpressions.Columns.Add(virtualField); treeListVirtualExpressions.Columns.Add(virtualExpression); treeListVirtualExpressions.Columns.Add(condition); treeListVirtualExpressions.Columns.Add(active); treeListVirtualExpressions.RowData = GlobalSettings.virtualFieldsRows; treeListVirtualExpressions.ThemeChanged(visualTheme); if (Trails.TestIntegration()) { labelTrailsIntegration.Text = "Integration with Trails plugin is enabled"; labelTrailsIntegration.ForeColor = Color.Black; } stripActivity.DropDownItems.Add(new ToolStripMenuItem("EQUIPMENT")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("CATEGORY")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("TEMPERATURE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("WEATHERNOTES")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("LOCATION")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("NAME")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("DATETIME")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("DATE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("NOTES")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("INTENSITY")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("TIME")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("HALFTIME")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("TIMESTOPPED")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("DISTANCE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("HALFDISTANCE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGPACE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGCADENCE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGGRADE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGHR")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGPOWER")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGSPEED")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGVERTICALOSCILLATION")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("AVGGROUNDCONTACT")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("MAXCADENCE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("MAXGRADE")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("MAXHR")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("MAXPOWER")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("ASCENDING")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("DESCENDING")); stripActivity.DropDownItems.Add(new ToolStripMenuItem("CALORIES")); foreach (ToolStripMenuItem item in stripActivity.DropDownItems) { item.Click += fieldItem_Click; } stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVETIME")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEHALFTIME")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEDISTANCE")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEHALFDISTANCE")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEAVGPACE")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEAVGSPEED")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEAVGCADENCE")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEAVGHR")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEAVGPOWER")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEMAXCADENCE")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEMAXHR")); stripActive.DropDownItems.Add(new ToolStripMenuItem("ACTIVEMAXPOWER")); foreach (ToolStripMenuItem item in stripActive.DropDownItems) { item.Click += fieldItem_Click; } stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTTIME")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTDISTANCE")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTAVGPACE")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTAVGSPEED")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTAVGCADENCE")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTAVGHR")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTAVGPOWER")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTMAXCADENCE")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTMAXHR")); stripRest.DropDownItems.Add(new ToolStripMenuItem("RESTMAXPOWER")); foreach (ToolStripMenuItem item in stripRest.DropDownItems) { item.Click += fieldItem_Click; } stripSplits.DropDownItems.Add(new ToolStripMenuItem("NOTES")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("AVGPACE")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("AVGSPEED")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("DISTANCE")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("TIME")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("AVGCADENCE")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("AVGHR")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("AVGPOWER")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("MAXCADENCE")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("MAXHR")); stripSplits.DropDownItems.Add(new ToolStripMenuItem("MAXPOWER")); foreach (ToolStripMenuItem item in stripSplits.DropDownItems) { item.Click += fieldItem_Click; } stripTrails.DropDownItems.Add(new ToolStripMenuItem("AVGPACE")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("DISTANCE")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("TIME")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("AVGCADENCE")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("AVGGRADE")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("AVGHR")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("AVGPOWER")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("AVGSPEED")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("ELEVATIONCHANGE")); stripTrails.DropDownItems.Add(new ToolStripMenuItem("MAXHR")); foreach (ToolStripMenuItem item in stripTrails.DropDownItems) { item.Click += fieldItem_Click; } stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEBMI")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEBODYFATPERCENTAGE")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETECALORIES")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEDATE")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEDIARY")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEDIASTOLICBLOODPRESSURE")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETESYSTOLICBLOODPRESSURE")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEINJURED")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEINJUREDTEXT")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEMAXHR")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEMISSEDWORKOUT")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEMISSEDWORKOUTTEXT")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEMOOD")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETERESTHR")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETESICK")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETESICKTEXT")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETESKINFOLD")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETESLEEPHOURS")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETESLEEPQUALITY")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEWEIGHT")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEHEIGHT")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETESEX")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEBIRTHDATE")); stripAthlete.DropDownItems.Add(new ToolStripMenuItem("ATHLETEAGE")); foreach (ToolStripMenuItem item in stripAthlete.DropDownItems) { item.Click += fieldItem_Click; } stripZones.DropDownItems.Add(new ToolStripMenuItem("HR Zone Standard Zone 3 Low bound")); stripZones.DropDownItems.Add(new ToolStripMenuItem("HR Zone Standard Zone 4 High bound")); stripZones.DropDownItems.Add(new ToolStripMenuItem("Cadence Zone Standard Zone 2 Low bound")); stripZones.DropDownItems.Add(new ToolStripMenuItem("Power Zone Standard Strength training High bound")); stripZones.DropDownItems.Add(new ToolStripMenuItem("Speed Zone Running Jogging Low bound")); stripZones.DropDownItems.Add(new ToolStripMenuItem("Climb Zone Standard Flat High bound")); foreach (ToolStripMenuItem item in stripZones.DropDownItems) { item.Click += fieldItem_Click; } stripAggregate.DropDownItems.Add(new ToolStripMenuItem("Sum")); stripAggregate.DropDownItems.Add(new ToolStripMenuItem("Avg")); stripAggregate.DropDownItems.Add(new ToolStripMenuItem("Min")); stripAggregate.DropDownItems.Add(new ToolStripMenuItem("Max")); stripAggregate.DropDownItems.Add(new ToolStripMenuItem("Count")); stripAggregate.DropDownItems.Add(new ToolStripMenuItem("Get")); foreach (ToolStripMenuItem item in stripAggregate.DropDownItems) { item.Click += fieldItem_Click; } stripTracks.DropDownItems.Add(new ToolStripMenuItem("HASGPSTRACK")); stripTracks.DropDownItems.Add(new ToolStripMenuItem("HASHRTRACK")); stripTracks.DropDownItems.Add(new ToolStripMenuItem("HASELEVATIONTRACK")); stripTracks.DropDownItems.Add(new ToolStripMenuItem("HASCADENCETRACK")); stripTracks.DropDownItems.Add(new ToolStripMenuItem("HASPOWERTRACK")); stripTracks.DropDownItems.Add(new ToolStripMenuItem("HASVERTICALOSCILLATIONTRACK")); stripTracks.DropDownItems.Add(new ToolStripMenuItem("HASGROUNDCONTACTTRACK")); foreach (ToolStripMenuItem item in stripTracks.DropDownItems) { item.Click += fieldItem_Click; } stripRange.DropDownItems.Add(new ToolStripMenuItem("Time in HR between 150-180")); stripRange.DropDownItems.Add(new ToolStripMenuItem("HR in Pace between 5:00-5:30")); stripRange.DropDownItems.Add(new ToolStripMenuItem("Time of first half of distance")); stripRange.DropDownItems.Add(new ToolStripMenuItem("Average HR of second half of distance")); stripRange.DropDownItems.Add(new ToolStripMenuItem("Time of first half of distance (only active parts)")); stripRange.DropDownItems.Add(new ToolStripMenuItem("Average HR of second half of distance (only active parts)")); foreach (ToolStripMenuItem item in stripRange.DropDownItems) { item.Click += fieldItem_Click; } stripPeak.DropDownItems.Add(new ToolStripMenuItem("Fastest 1000 meters")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Start Time of fastest 1000 meters without pauses")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("End Time of fastest 1000 meters without pauses")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Start Time of fastest 1000 meters with pauses")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Return average HR of your fastest 1000 meters")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Fastest 300 seconds")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("HR peak for 30 seconds")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Power peak for 20 seconds")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Power peak for 1000 meters")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Return average cadence for power peak for 20 seconds")); stripPeak.DropDownItems.Add(new ToolStripMenuItem("Return average HR for power peak for 20 seconds")); foreach (ToolStripMenuItem item in stripPeak.DropDownItems) { item.Click += fieldItem_Click; } stripDataTrack.DropDownItems.Add(new ToolStripMenuItem("HR in Pace between 5:00-5:30 (any resolution)")); stripDataTrack.DropDownItems.Add(new ToolStripMenuItem("Time in HR between 150-180 (1000 ms resolution)")); stripDataTrack.DropDownItems.Add(new ToolStripMenuItem("Time in HR between 150-180 (100 ms resolution, only for active parts)")); stripDataTrack.DropDownItems.Add(new ToolStripMenuItem("Distance within first 300 seconds (any resolution)")); stripDataTrack.DropDownItems.Add(new ToolStripMenuItem("Average HR of split with notes First segment")); foreach (ToolStripMenuItem item in stripDataTrack.DropDownItems) { item.Click += fieldItem_Click; } stripFormulas.DropDownItems.Add(new ToolStripMenuItem("RECOVERYHR")); stripFormulas.DropDownItems.Add(new ToolStripMenuItem("Decoupling ratio of first half and second half of your activity (Ruskie)")); stripFormulas.DropDownItems.Add(new ToolStripMenuItem("Decoupling ratio of first half and second half of your activity (active parts)")); stripFormulas.DropDownItems.Add(new ToolStripMenuItem("Speed ratio between first half and second half of your activity (Decoupling ratio without HR) (Kuki)")); stripFormulas.DropDownItems.Add(new ToolStripMenuItem("Speed ratio between first half and second half of your activity (active parts)")); foreach (ToolStripMenuItem item in stripFormulas.DropDownItems) { item.Click += fieldItem_Click; } stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("Bike score to show climby bike index (Stumpjumper68)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("Stride length in mm, you need footpod for this formula (dave a walker)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("Elevation change (GaryS)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("Estimated distance taking ascent into account (vax)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("First half distance Pace (GaryS)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("Second half distance Pace (GaryS)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("% VO2max (Scorpion79)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("Vdot (Scorpion79)")); stripFormulasPool.DropDownItems.Add(new ToolStripMenuItem("VO2max (Scorpion79)")); foreach (ToolStripMenuItem item in stripFormulasPool.DropDownItems) { item.Click += fieldItem_Click; } stripExamples.DropDownItems.Add(new ToolStripMenuItem("Avg. HR/min")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Sum of last 7 days distance")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Sum of last 21 days distance")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Sum of last 7 days distance only for category Running")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Distance to Km")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Distance to Miles")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Speed to Speed in Miles")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Adjust Distance by 3%")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Condition for Category is Race OR Category is Trail")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Condition for Category is Race AND Distance is greater than 7000m")); stripExamples.DropDownItems.Add(new ToolStripMenuItem("Avg pace for Trail with name Pernek")); foreach (ToolStripMenuItem item in stripExamples.DropDownItems) { item.Click += fieldItem_Click; } }
protected override void DrawCell(Graphics graphics, TreeList.DrawItemState rowState, object element, TreeList.Column column, Rectangle cellRect) { QAActivity activity = element as QAActivity; StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = column.TextAlign; // Draw colored square in column 1 if (column.Id == "id" && activity != null && activity.Color != Color.Empty) { Brush selectedBrush = new SolidBrush(activity.Color); graphics.FillRectangle(selectedBrush, cellRect); } if (column.Id == "Q1Percent" || column.Id == "Q2Percent" || column.Id == "Q3Percent" || column.Id == "Q4Percent" || column.Id == "Q2PercentHigh" || column.Id == "Q2PercentLow" || column.Id == "Q4PercentHigh" || column.Id == "Q4PercentLow") { // Display percentage in appropriate format Type type = typeof(QAActivity); float value = (float)type.GetProperty(column.Id).GetValue(activity, null); graphics.DrawString(value.ToString("P1", CultureInfo.CurrentCulture), base.Font(GetCellFontStyle(element, column)), new SolidBrush(PluginMain.GetApplication().VisualTheme.ControlText), cellRect, stringFormat); } else if (column.Id == "Q1Time" || column.Id == "Q2Time" || column.Id == "Q2TimeHigh" || column.Id == "Q2TimeLow" || column.Id == "Q3Time" || column.Id == "Q4Time" || column.Id == "Q4TimeHigh" || column.Id == "Q4TimeLow") { // Display formatted time Type type = typeof(QAActivity); TimeSpan value = (TimeSpan)type.GetProperty(column.Id).GetValue(activity, null); string display = Util.Utilities.ToTimeString(value); graphics.DrawString(display, base.Font(GetCellFontStyle(element, column)), new SolidBrush(PluginMain.GetApplication().VisualTheme.ControlText), cellRect, stringFormat); } else if (activity.IsTotalsRow && column.Id == "StartTime") { // Displat "Totals" graphics.DrawString(CommonResources.Text.LabelTotal, base.Font(GetCellFontStyle(element, column)), new SolidBrush(PluginMain.GetApplication().VisualTheme.ControlText), cellRect, stringFormat); } else if (activity.IsTotalsRow && column.Id == "check") { // Don't draw checkbox on totals row } else { // Everything else base.DrawCell(graphics, rowState, element, column, cellRect); } }
public override string GetText(object element, TreeList.Column column) { Data.TrailResult row = (element as TrailResultWrapper).Result; //Some special for Summary if (row is SummaryTrailResult) { switch (column.Id) { case TrailResultColumnIds.AveragePowerBalance: case TrailResultColumnIds.AverageTemperature: case TrailResultColumnIds.AverageGroundContactTime: case TrailResultColumnIds.AverageVerticalOscillation: case TrailResultColumnIds.AverageSaturatedHemoglobin: case TrailResultColumnIds.AverageTotalHemoglobinConcentration: //No implementation, ignore return(null); default: if (!Controller.TrailController.Instance.ExplicitSelection && TrailResultColumnIds.ClimbFields.Contains(column.Id) && !row.ClimbCalculated) { //Potentially many selections (of Ascent etc), no value set return(null); } break; } if (TrailsPlugin.Data.Settings.ResultSummaryStdDev) { SummaryTrailResult row2 = row as SummaryTrailResult; if (!row2.IsTotal && row2.Results.Count > 1) { switch (column.Id) { case TrailResultColumnIds.StartTime: //Not interesting to average time when only one activity. Other multi may be interesting. if (row2.Activities.Count <= 1) { return(null); } //Only time of day, averaged return(row.StartTime.ToLocalTime().ToString("T")); case TrailResultColumnIds.Duration: { SummaryValue <TimeSpan> a = row2.DurationStdDev(); return(UnitUtil.Time.ToString(a.Value, "") + " σ" + UnitUtil.Time.ToString(a.StdDev, "")); } case TrailResultColumnIds.Distance: { SummaryValue <double> a = row2.DistanceStdDev(); string d; if (row.PoolLengthInfo != null) { d = UnitUtil.Distance.ToString(a.Value, row.PoolLengthInfo.DistanceUnits, "F0"); } else { d = UnitUtil.Distance.ToString(a.Value, Controller.TrailController.Instance.ReferenceActivity, ""); } return(d + " σ" + UnitUtil.Elevation.ToString(a.StdDev, Controller.TrailController.Instance.ReferenceActivity, "")); } case TrailResultColumnIds.AvgPace: { SummaryValue <double> a = row2.AvgPaceStdDev(); return(UnitUtil.Pace.ToString(a.Value, Controller.TrailController.Instance.ReferenceActivity, "") + " σ" + UnitUtil.Pace.ToString(a.StdDev, Controller.TrailController.Instance.ReferenceActivity, "")); } case TrailResultColumnIds.AvgSpeed: { SummaryValue <double> a = row2.AvgSpeedStdDev(); return(UnitUtil.Speed.ToString(a.Value, Controller.TrailController.Instance.ReferenceActivity, "") + " σ" + UnitUtil.Speed.ToString(a.StdDev, Controller.TrailController.Instance.ReferenceActivity, "")); } case TrailResultColumnIds.AvgSpeedPace: { SummaryValue <double> a; if (UnitUtil.PaceOrSpeed.IsPace(Controller.TrailController.Instance.ReferenceActivity)) { a = row2.AvgPaceStdDev(); return(UnitUtil.Pace.ToString(a.Value, Controller.TrailController.Instance.ReferenceActivity, "") + " σ" + UnitUtil.Pace.ToString(a.StdDev, Controller.TrailController.Instance.ReferenceActivity, "")); } else { a = row2.AvgSpeedStdDev(); return(UnitUtil.Speed.ToString(a.Value, Controller.TrailController.Instance.ReferenceActivity, "") + " σ" + UnitUtil.Speed.ToString(a.StdDev, Controller.TrailController.Instance.ReferenceActivity, "")); } } //case TrailResultColumnIds.GradeRunAdjustedTime: // { // SummaryValue<double> a = row2.GradeRunAdjustedTimeStdDev(); // return UnitUtil.Time.ToString(a.Value, "") + " σ" + UnitUtil.Time.ToString(a.StdDev, ""); // } //case TrailResultColumnIds.GradeRunAdjustedPace: // { // SummaryValue<TimeSpan> a = row2.GradeRunAdjustedPaceStdDev(); // return UnitUtil.Pace.ToString(a.Value, Controller.TrailController.Instance.ReferenceActivity, "") + " σ" + UnitUtil.Pace.ToString(a.StdDev, Controller.TrailController.Instance.ReferenceActivity, ""); // } //case TrailResultColumnIds.Diff: // { // SummaryValue<double> a = row2.DiffStdDev(); // return UnitUtil.Elevation.ToString(a.Value, Controller.TrailController.Instance.ReferenceActivity, "") + " σ" + UnitUtil.Elevation.ToString(a.StdDev, Controller.TrailController.Instance.ReferenceActivity, ""); // } default: break; } } } } if (row is PausedChildTrailResult) { switch (column.Id) { //Some paused fields should not be visible case TrailResultColumnIds.Order: return(null); default: break; } } if (row is SubChildTrailResult) { switch (column.Id) { //Ignore wildly inaccurate data, few points for Pool swimming, can be lower than Avg //(not always good on lap level too) case TrailResultColumnIds.FastestSpeed: case TrailResultColumnIds.FastestPace: return(null); default: break; } } switch (column.Id) { case TrailResultColumnIds.ResultColor: return(null); //String output without formatting case TrailResultColumnIds.Order: case TrailResultColumnIds.Name: case TrailResultColumnIds.TrailName: return(base.GetText(row, column)); case TrailResultColumnIds.StartTime: if (row.Activity == null) { return(null); } string date = ""; if (m_multiple) { date = row.StartTime.ToLocalTime().ToShortDateString() + " "; } return(date + row.StartTime.ToLocalTime().ToString("T")); case TrailResultColumnIds.StartDistance: if (row.PoolLengthInfo != null) { return(UnitUtil.Distance.ToString(row.StartDistance, row.PoolLengthInfo.DistanceUnits, "F0u")); } else { return(UnitUtil.Distance.ToString(row.StartDistance, Controller.TrailController.Instance.ReferenceActivity, "")); } case TrailResultColumnIds.EndTime: if (row.Activity == null) { return(null); } return(row.EndTime.ToLocalTime().ToString("T")); case TrailResultColumnIds.Duration: return(UnitUtil.Time.ToString(row.Duration, "")); case TrailResultColumnIds.Distance: if (row.PoolLengthInfo != null) { return(UnitUtil.Distance.ToString(row.Distance, row.PoolLengthInfo.DistanceUnits, "F0u")); } else { return(UnitUtil.Distance.ToString(row.Distance, Controller.TrailController.Instance.ReferenceActivity, "")); } case TrailResultColumnIds.AvgCadence: return(UnitUtil.Cadence.ToString(row.AvgCadence)); case TrailResultColumnIds.AvgHR: return(UnitUtil.HeartRate.ToString(row.AvgHR)); case TrailResultColumnIds.MaxHR: return(UnitUtil.HeartRate.ToString(row.MaxHR)); case TrailResultColumnIds.Ascent: return(UnitUtil.Elevation.ToString(row.Ascent)); case TrailResultColumnIds.Descent: return(UnitUtil.Elevation.ToString(row.Descent)); case TrailResultColumnIds.ElevChg: return((row.ElevChg > 0 ? "+" : "") + UnitUtil.Elevation.ToString(row.ElevChg, "")); case TrailResultColumnIds.AvgPower: return(UnitUtil.Power.ToString(row.AvgPower)); case TrailResultColumnIds.AscAvgGrade: return((row.AscAvgGrade).ToString("0.0%")); case TrailResultColumnIds.AscMaxAvgGrade: return((row.AscMaxAvgGrade).ToString("0.0%")); case TrailResultColumnIds.DescAvgGrade: return((row.DescAvgGrade).ToString("0.0%")); case TrailResultColumnIds.AvgSpeed: return(UnitUtil.Speed.ToString(row.AvgSpeed, Controller.TrailController.Instance.ReferenceActivity, "")); case TrailResultColumnIds.FastestSpeed: return(UnitUtil.Speed.ToString(row.FastestSpeed, Controller.TrailController.Instance.ReferenceActivity, "")); case TrailResultColumnIds.AvgPace: return(UnitUtil.Pace.ToString(row.AvgSpeed, Controller.TrailController.Instance.ReferenceActivity, "")); case TrailResultColumnIds.FastestPace: return(UnitUtil.Pace.ToString(row.FastestSpeed, Controller.TrailController.Instance.ReferenceActivity, "")); case TrailResultColumnIds.AvgSpeedPace: return(UnitUtil.PaceOrSpeed.ToString(row.AvgSpeed, Controller.TrailController.Instance.ReferenceActivity, "")); case TrailResultColumnIds.FastestSpeedPace: return(UnitUtil.PaceOrSpeed.ToString(row.FastestSpeed, Controller.TrailController.Instance.ReferenceActivity, "")); case TrailResultColumnIds.PredictDistance: return(UnitUtil.Time.ToString(row.PredictDistance, "")); case TrailResultColumnIds.IdealTime: return(UnitUtil.Time.ToString(row.IdealTime, "")); case TrailResultColumnIds.GradeRunAdjustedTime: return(UnitUtil.Time.ToString(row.GradeRunAdjustedTime, "")); case TrailResultColumnIds.GradeRunAdjustedPace: return(UnitUtil.Pace.ToString(row.GradeRunAdjustedSpeed, Controller.TrailController.Instance.ReferenceActivity, "")); case TrailResultColumnIds.Diff: return(UnitUtil.Elevation.ToString(row.Diff, "")); case TrailResultColumnIds.AscendingSpeed_VAM: return(UnitUtil.Elevation.ToString(row.AscendingSpeed_VAM, "")); case TrailResultColumnIds.AveragePowerBalance: return((row.AveragePowerBalance / 100).ToString("0.0%")); case TrailResultColumnIds.AverageTemperature: return((row.AverageTemperature).ToString("0.0")); case TrailResultColumnIds.AverageGroundContactTime: return((row.AverageGroundContactTime).ToString("0")); case TrailResultColumnIds.AverageVerticalOscillation: return((row.AverageVerticalOscillation).ToString("0.0")); case TrailResultColumnIds.AverageSaturatedHemoglobin: return((row.AverageSaturatedHemoglobin / 100).ToString("0.0%")); case TrailResultColumnIds.AverageTotalHemoglobinConcentration: return((row.AverageTotalHemoglobinConcentration).ToString("0.0")); default: if (TrailResultColumns.IsLapField(column.Id)) { ILapInfo lap = row.LapInfo; if (lap != null) { //The column Id is faked to not clash with the internal ids TreeList.Column c = new TreeList.Column(TrailResultColumns.LapId(column.Id)); return(base.GetText(lap, c)); } //Not Splits trail return(null); } else if (TrailResultColumns.IsSwimLapField(column.Id)) { IPoolLengthInfo lap = row.PoolLengthInfo; if (lap != null) { //The column Id is faked to not clash with the internal ids TreeList.Column c = new TreeList.Column(TrailResultColumns.SwimLapId(column.Id)); return(base.GetText(lap, c)); } //Not Splits trail return(null); } else if (TrailResultColumns.IsActivityField(column.Id)) { if (row is ParentTrailResult) { if (row.Activity == null) { return(null); } if (column.Id == TrailResultColumnIds.MetaData_Source) { return(row.Activity.Metadata.Source); } return(base.GetText(row.Activity, column)); } return(null); } else { if (row.Activity == null) { return(null); } ICustomDataFieldDefinition cust = TrailResultColumns.CustomDef(column.Id); if (cust != null) { if (row is ParentTrailResult) { return(row.Activity.GetCustomDataValue(TrailResultColumns.CustomDef(column.Id)).ToString()); } return(null); } } System.Diagnostics.Debug.Assert(false, string.Format("No label info for id {0}", column.Id)); return(null); } }
private void RefreshColumns(bool isMultiple) { summaryList.Columns.Clear(); IList<string> cols; if (isMultiple) { cols = ResultColumnIds.LocAndDateColumns; } else { cols = ResultColumnIds.DefaultColumns; } foreach (string id in cols) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); summaryList.Columns.Add(column); break; } } } //summaryList.NumLockedColumns = Data.Settings.ActivityPageNumFixedColumns; }
public void InitControls(IDetailPage detailPage, IDailyActivityView view, TrailPointsLayer layer, PerformancePredictorControl ppControl) { #if !ST_2_1 m_DetailPage = detailPage; m_view = view; m_layer = layer; #endif m_ppcontrol = ppControl; //Set in user code rather than generated code, to make GUI editing possible this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; copyTableMenuItem.Image = ZoneFiveSoftware.Common.Visuals.CommonResources.Images.DocumentCopy16; trainingList.LabelProvider = new TrainingLabelProvider(); paceTempoList.LabelProvider = new PaceTempoLabelProvider(); intervalList.LabelProvider = new IntervalLabelProvider(); trainingList.Columns.Clear(); foreach (string id in ResultColumnIds.TrainingColumns) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); trainingList.Columns.Add(column); break; } } } paceTempoList.Columns.Clear(); foreach (string id in ResultColumnIds.PaceTempoColumns) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); paceTempoList.Columns.Add(column); break; } } } intervalList.Columns.Clear(); foreach (string id in ResultColumnIds.IntervallColumns) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); intervalList.Columns.Add(column); break; } } } }
private void RefreshColumns(bool multi) { summaryList.Columns.Clear(); IList<string> cols; if (multi) { cols = ResultColumnIds.TimePredictMultiColumns; } else { cols = ResultColumnIds.TimePredictSingleColumns; } foreach (string id in cols) { foreach (IListColumnDefinition columnDef in ResultColumnIds.ColumnDefs()) { if (columnDef.Id == id) { TreeList.Column column = new TreeList.Column( columnDef.Id, columnDef.Text(columnDef.Id), columnDef.Width, columnDef.Align ); summaryList.Columns.Add(column); break; } } } foreach (PredictionModel model in PredictionModelUtil.List) { //List all but the primary model after the other if (model != Settings.Model) { IListColumnDefinition columnDef = ResultColumnIds.PredictedTimeModelColumn(); //The id suffix is used to get the model for the results ( //It may be possible to use comn.Tag, but no description to do that string nameSuffix = " (" + PredictionModelUtil.Name(model) + ")"; string idSuffix = "_" + model.ToString(); TreeList.Column column = new TreeList.Column( columnDef.Id + idSuffix, columnDef.Text(columnDef.Id) + nameSuffix, columnDef.Width, columnDef.Align ); summaryList.Columns.Add(column); columnDef = ResultColumnIds.SpeedModelColumn(); column = new TreeList.Column( columnDef.Id + idSuffix, columnDef.Text(columnDef.Id) + nameSuffix, columnDef.Width, columnDef.Align ); summaryList.Columns.Add(column); } } //summaryList.NumLockedColumns = Data.Settings.ActivityPageNumFixedColumns; }