Esempio n. 1
0
        public void UICultureChanged(CultureInfo culture)
        {
            this.ChartBanner.Text = Properties.Resources.TrailChartsName;
            foreach (TrailLineChart t in m_lineCharts)
            {
                t.UICultureChanged(culture);
            }
            this.speedToolStripMenuItem.Text     = LineChartUtil.ChartTypeString(LineChartTypes.Speed);
            this.paceToolStripMenuItem.Text      = LineChartUtil.ChartTypeString(LineChartTypes.Pace);
            this.speedPaceToolStripMenuItem.Text = LineChartUtil.ChartTypeString(LineChartTypes.SpeedPace);
            this.elevationToolStripMenuItem.Text = LineChartUtil.ChartTypeString(LineChartTypes.Elevation);
            this.cadenceToolStripMenuItem.Text   = LineChartUtil.ChartTypeString(LineChartTypes.Cadence);
            this.heartRateToolStripMenuItem.Text = LineChartUtil.ChartTypeString(LineChartTypes.HeartRateBPM);
            this.gradeStripMenuItem.Text         = LineChartUtil.ChartTypeString(LineChartTypes.Grade);
            this.powerToolStripMenuItem.Text     = LineChartUtil.ChartTypeString(LineChartTypes.Power);

            this.PowerBalanceToolStripMenuItem.Text                 = LineChartUtil.ChartTypeString(LineChartTypes.PowerBalance);
            this.TemperatureToolStripMenuItem.Text                  = LineChartUtil.ChartTypeString(LineChartTypes.Temperature);
            this.GroundContactTimeToolStripMenuItem.Text            = LineChartUtil.ChartTypeString(LineChartTypes.GroundContactTime);
            this.VerticalOscillationToolStripMenuItem.Text          = LineChartUtil.ChartTypeString(LineChartTypes.VerticalOscillation);
            this.SaturatedHemoglobinToolStripMenuItem.Text          = LineChartUtil.ChartTypeString(LineChartTypes.SaturatedHemoglobin);
            this.TotalHemoglobinConcentrationToolStripMenuItem.Text = LineChartUtil.ChartTypeString(LineChartTypes.TotalHemoglobinConcentration);

            this.diffTimeToolStripMenuItem.Text        = LineChartUtil.ChartTypeString(LineChartTypes.DiffTime);
            this.diffDistToolStripMenuItem.Text        = LineChartUtil.ChartTypeString(LineChartTypes.DiffDist);
            this.deviceToolStripMenuItem.Text          = CommonResources.Text.LabelDevice;
            this.deviceSpeedPaceToolStripMenuItem.Text = LineChartUtil.ChartTypeString(LineChartTypes.DeviceSpeedPace);
            this.deviceElevationToolStripMenuItem.Text = LineChartUtil.ChartTypeString(LineChartTypes.DeviceElevation);
            this.deviceDiffToolStripMenuItem.Text      = LineChartUtil.ChartTypeString(LineChartTypes.DeviceDiffDist);
            //Set when updating chart
            this.diffDistTimeToolStripMenuItem.Text                  = LineChartUtil.ChartTypeString(LineChartTypes.DiffDistTime);
            this.resyncDiffAtTrailPointsToolStripMenuItem.Text       = Properties.Resources.UI_Chart_resyncDiffAtTrailPoints;
            this.adjustResyncDiffAtTrailPointsToolStripMenuItem.Text = " " + Properties.Resources.UI_Chart_adjustResyncDiffAtTrailPoints;
            this.syncChartAtTrailPointsToolStripMenuItem.Text        = Properties.Resources.UI_Chart_syncChartAtTrailPoints;

            this.timeToolStripMenuItem.Text     = LineChartUtil.XAxisValueString(XAxisValue.Time);
            this.distanceToolStripMenuItem.Text = LineChartUtil.XAxisValueString(XAxisValue.Distance);
            this.showToolBarMenuItem.Text       = Properties.Resources.UI_Activity_Menu_ShowToolBar;
        }
Esempio n. 2
0
        public void RefreshChart()
        {
            if (m_showPage && this.ChartVisible)
            {
                LineChartTypes speedPaceChart       = LineChartTypes.Speed;
                LineChartTypes deviceSpeedPaceChart = LineChartTypes.DeviceSpeed;
                if (Controller.TrailController.Instance.ReferenceActivity != null &&
                    Controller.TrailController.Instance.ReferenceActivity.Category.SpeedUnits.Equals(Speed.Units.Pace))
                {
                    speedPaceChart       = LineChartTypes.Pace;
                    deviceSpeedPaceChart = LineChartTypes.DevicePace;
                }
                LineChartTypes diffChart = LineChartTypes.DiffDist;
                if (Data.Settings.XAxisValue == XAxisValue.Distance)
                {
                    diffChart = LineChartTypes.DiffTime;
                }

                bool isData = Controller.TrailController.Instance.CurrentActivityTrailIsSelected;

                IList <Data.TrailResult> selectedPresentableResults =
                    TrailResultWrapper.TrailResults(Controller.TrailController.Instance.SelectedResults);
                if (selectedPresentableResults.Count > Data.Settings.MaxChartResults)
                {
                    //Move summary first, so it is not truncated
                    for (int i = 0; i < selectedPresentableResults.Count; i++)
                    {
                        TrailResult t = selectedPresentableResults[i];
                        if (t is SummaryTrailResult)
                        {
                            selectedPresentableResults.RemoveAt(i);
                            selectedPresentableResults.Insert(0, t);
                            break;
                        }
                    }

                    ((List <Data.TrailResult>)selectedPresentableResults).RemoveRange(Data.Settings.MaxChartResults,
                                                                                      selectedPresentableResults.Count - Data.Settings.MaxChartResults);
                }

                m_multiChart.ChartTypes = new List <LineChartTypes>();
                multiChart.ShowPage     = false;
                //TODO: Temporary handling. Cleanup and decide multiple graphs and charts
                TrailLineChart updateChart = m_multiChart;
                if (!m_expanded)
                {
                    foreach (TrailLineChart chart in m_lineCharts)
                    {
                        chart.ShowPage = false;
                    }
                    m_multiChart.BeginUpdate();
                    m_multiChart.XAxisReferential = Data.Settings.XAxisValue;
                    m_multiChart.TrailResults     = selectedPresentableResults;
                    foreach (LineChartTypes t in Data.Settings.MultiChartType)
                    {
                        LineChartTypes t2 = t;
                        if (t2 == LineChartTypes.SpeedPace)
                        {
                            t2 = speedPaceChart;
                        }
                        else if (t2 == LineChartTypes.DeviceSpeedPace)
                        {
                            t2 = deviceSpeedPaceChart;
                        }
                        else if (t2 == LineChartTypes.DiffDistTime)
                        {
                            t2 = diffChart;
                        }
                        if (!m_multiChart.ChartTypes.Contains(t2) &&
                            m_multiChart.HasValues(t2))
                        {
                            m_multiChart.ChartTypes.Add(t2);
                        }
                    }
                    m_multiChart.ShowPage = true;

                    if (!m_multiChart.AnyData())
                    {
                        m_multiChart.ShowPage      = false;
                        m_multiChart.LeftChartType = speedPaceChart;
                        m_multiChart.ShowPage      = true;
                    }
                    this.ChartBanner.Text = LineChartUtil.ChartTypeString(m_multiChart.LeftChartType) + " / " +
                                            LineChartUtil.XAxisValueString(m_multiChart.XAxisReferential);
                    m_multiChart.EndUpdate(true);
                }
                else
                {
                    foreach (TrailLineChart chart in m_lineCharts)
                    {
                        bool visible = false;

                        if (m_expanded &&
                            (Data.Settings.MultiGraphType.Contains(chart.LeftChartType) ||
                             chart.LeftChartType == speedPaceChart &&
                             (Data.Settings.MultiGraphType.Contains(LineChartTypes.SpeedPace) || Data.Settings.MultiGraphType.Contains(LineChartTypes.DeviceSpeedPace)) ||
                             chart.LeftChartType == diffChart &&
                             (Data.Settings.MultiGraphType.Contains(LineChartTypes.DiffDistTime) || Data.Settings.MultiGraphType.Contains(LineChartTypes.DeviceDiffDist))) ||

                            !m_expanded &&
                            (chart.LeftChartType == Data.Settings.ChartType ||
                             chart.LeftChartType == speedPaceChart &&
                             (LineChartTypes.SpeedPace == Data.Settings.ChartType || LineChartTypes.DeviceSpeedPace == Data.Settings.ChartType) ||
                             chart.LeftChartType == diffChart &&
                             (LineChartTypes.DiffDistTime == Data.Settings.ChartType || LineChartTypes.DiffDistTime == Data.Settings.ChartType)))
                        {
                            visible = true;
                        }

                        updateChart = chart;
                        updateChart.BeginUpdate();
                        chart.ShowPage = false;
                        if (visible && isData)
                        {
                            updateChart.XAxisReferential = Data.Settings.XAxisValue;
                            updateChart.TrailResults     = selectedPresentableResults;
                            if (!m_expanded && updateChart.ChartTypes.Count == 1)
                            {
                                this.ChartBanner.Text = LineChartUtil.ChartTypeString(chart.LeftChartType) + " / " +
                                                        LineChartUtil.XAxisValueString(chart.XAxisReferential);
                            }
                            if (updateChart.HasValues(chart.LeftChartType))
                            {
                                updateChart.ShowPage = visible;
                            }
                            else
                            {
                                if (visible && !updateChart.HasValues(chart.LeftChartType))
                                {
                                    chart.ShowPage = false;
                                    //Replace empty chart
                                    if (!m_expanded && chart.LeftChartType != speedPaceChart)
                                    {
                                        foreach (TrailLineChart replaceChart in m_lineCharts)
                                        {
                                            if (replaceChart.LeftChartType == speedPaceChart)
                                            {
                                                replaceChart.BeginUpdate();
                                                replaceChart.ShowPage         = false;
                                                replaceChart.XAxisReferential = Data.Settings.XAxisValue;
                                                replaceChart.TrailResults     = selectedPresentableResults;
                                                if (!m_expanded)
                                                {
                                                    this.ChartBanner.Text = LineChartUtil.ChartTypeString(replaceChart.LeftChartType) + " / " +
                                                                            LineChartUtil.XAxisValueString(replaceChart.XAxisReferential);
                                                }
                                                replaceChart.ShowPage = visible;
                                                replaceChart.EndUpdate(true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        updateChart.EndUpdate(true);
                    }
                }
                RefreshRows();
                RefreshChartMenu();
            }
        }