예제 #1
0
        /// <summary>
        /// Get activities from current view
        /// </summary>
        /// <param name="all">Get All activities if True, or just selected activities if False.
        /// NOTE: This only applies to Reports View.</param>
        /// <returns>Activities from this page's associated view (defined in constructor)</returns>
        internal IEnumerable <IActivity> GetActivities(bool all)
        {
            IList <IActivity> activities = new List <IActivity>();

            // Prevent null ref error during startup
            if (PluginMain.GetApplication().Logbook == null ||
                PluginMain.GetApplication().ActiveView == null)
            {
                return(activities);
            }

            IView view = PluginMain.GetApplication().ActiveView;

            if (view != null && IsDailyActivityView)
            {
                IDailyActivityView activityView = view as IDailyActivityView;
                activities = CollectionUtils.GetAllContainedItemsOfType <IActivity>(activityView.SelectionProvider.SelectedItems);
            }
            else if (view != null && IsReportView)
            {
                IActivityReportsView reportsView = view as IActivityReportsView;

                if (all)
                {
                    activities = reportsView.ActiveReport.Activities;
                }
                else
                {
                    activities = CollectionUtils.GetAllContainedItemsOfType <IActivity>(reportsView.SelectionProvider.SelectedItems);
                }
            }

            return(activities);
        }
        private void menuTreeItem_Click(object sender, EventArgs e)
        {
            ListSettingsDialog listDialog = new ListSettingsDialog();
            ICollection <IListColumnDefinition> available = new List <IListColumnDefinition>();

            available.Add(new ColumnDefinition(ColumnDefinition.Q1Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2PercentHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2PercentLow));
            available.Add(new ColumnDefinition(ColumnDefinition.Q3Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4PercentHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4PercentLow));
            available.Add(new ColumnDefinition(ColumnDefinition.Q1Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2TimeHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2TimeLow));
            available.Add(new ColumnDefinition(ColumnDefinition.Q3Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4TimeHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4TimeLow));

            listDialog.AvailableColumns = available;

            List <string> selected = new List <string>();

            foreach (string id in GlobalSettings.Instance.TreeColumns)
            {
                ColumnDefinition value = new ColumnDefinition(id);

                if (available.Contains(value) && !selected.Contains(id))
                {
                    selected.Add(id);
                }
            }

            listDialog.SelectedColumns        = selected;
            listDialog.Text                   = CommonResources.Text.LabelCharts;
            listDialog.SelectedItemListLabel  = Resources.Strings.Label_SelectedCharts;
            listDialog.AddButtonLabel         = CommonResources.Text.ActionAdd;
            listDialog.AllowFixedColumnSelect = false;
            listDialog.AllowZeroSelected      = true;
            listDialog.Icon                   = Util.Utilities.GetIcon(Resources.Images.Charts);

            listDialog.ThemeChanged(PluginMain.GetApplication().VisualTheme);

            if (listDialog.ShowDialog() == DialogResult.OK)
            {
                GlobalSettings.Instance.TreeColumns = listDialog.SelectedColumns as List <string>;

                InitializeTreelist(maximized);

                RefreshPage();
            }

            listDialog.Close();
            listDialog.Dispose();

            return;
        }
        private void SaveImageButton_Click(object sender, EventArgs e)
        {
            ITheme theme = PluginMain.GetApplication().VisualTheme;

            SaveImageDialog save = new SaveImageDialog();

            save.ThemeChanged(theme);
            save.CanChangeImageSize = false;

            save.FileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                                   Resources.Strings.Label_QuadrantAnalysis + " " + DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture));

            if (save.ShowDialog() == DialogResult.OK)
            {
                // Image Saved (save occurs in SaveDialog)
                string filename = save.FileName;

                if (System.IO.File.Exists(filename))
                {
                    if (MessageDialog.Show("File exists.  Overwrite?", "File Save", MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                zedChart.GetImage().Save(save.FileName, save.ImageFormat);
            }

            save.Dispose();
        }
예제 #4
0
        private void AddEquipmentToCombobox(string selectedId)
        {
            EquipmentComboBox.Items.Clear();
            int selectedIndex = 0;

            m_SetupEquipmentIds = Common.Data.GetEquipmentIds();

            foreach (string currentId in m_SetupEquipmentIds)
            {
                foreach (IEquipmentItem currentEquipment in PluginMain.GetApplication().Logbook.Equipment)
                {
                    if (currentEquipment.ReferenceId == currentId)
                    {
                        EquipmentComboBox.Items.Add(currentEquipment.Name);

                        if (selectedId == currentId)
                        {
                            selectedIndex = EquipmentComboBox.Items.Count - 1;
                        }

                        break;
                    }
                }
            }

            if (EquipmentComboBox.Items.Count > 0)
            {
                EquipmentComboBox.SelectedIndex = selectedIndex;
            }
        }
예제 #5
0
파일: SaveImage.cs 프로젝트: mechgt/meanmax
        private void btnDirTree_Click(object sender, EventArgs e)
        {
            this.dirTree = new DirectoryTreePopup();
            this.dirTree.ThemeChanged(PluginMain.GetApplication().VisualTheme);

            // Display a DirectoryTreePopup
            if (Directory.Exists(txtDirectory.Text))
            {
                this.dirTree.Tree.SelectedPath = txtDirectory.Text;
            }

            // Define size and location
            this.dirTree.Location = txtDirectory.Location;

            // Show the directory tree
            Rectangle rect = new Rectangle(txtDirectory.Location, txtDirectory.Size);

            rect.Offset(this.Location);
            rect.Offset(4, txtDirectory.Height + 4);

            // Add event handlers for selecting folder
            this.dirTree.ItemSelected += new DirectoryTreePopup.ItemSelectedEventHandler(dirTree_ItemSelected);

            this.dirTree.Popup(rect);
        }
예제 #6
0
 public PopupProgress()
 {
     InitializeComponent();
     status.Text      = string.Empty;
     progress.Percent = 0f;
     ThemeChanged(PluginMain.GetApplication().VisualTheme);
 }
예제 #7
0
        public SettingsPopup()
        {
            elevationPercent      = GlobalSettings.Instance.ElevationPercent;
            distancePercent       = GlobalSettings.Instance.DistancePercent;
            gainElevationRequired = Length.Convert(GlobalSettings.Instance.GainElevationRequired, Length.Units.Meter, PluginMain.GetApplication().SystemPreferences.ElevationUnits);
            hillDistanceRequired  = Length.Convert(GlobalSettings.Instance.HillDistanceRequired, Length.Units.Meter, PluginMain.GetApplication().SystemPreferences.DistanceUnits);
            maxDescentElevation   = Length.Convert(GlobalSettings.Instance.MaxDescentElevation, Length.Units.Meter, PluginMain.GetApplication().SystemPreferences.ElevationUnits);
            maxDescentLength      = Length.Convert(GlobalSettings.Instance.MaxDescentLength, Length.Units.Meter, PluginMain.GetApplication().SystemPreferences.DistanceUnits);
            minAvgGrade           = GlobalSettings.Instance.MinAvgGrade;

            InitializeComponent();

            this.Icon = Utilities.MakeIcon(Resources.Images.gear, 16, true);

            ThemeChanged(PluginMain.GetApplication().VisualTheme);
            UICultureChanged(PluginMain.GetApplication().SystemPreferences.UICulture);

            textBox_distancePercent.Text       = distancePercent.ToString("0.00", CultureInfo.CurrentCulture);
            textBox_elevationPercent.Text      = elevationPercent.ToString("0.00", CultureInfo.CurrentCulture);
            textbox_gainElevationRequired.Text = gainElevationRequired.ToString("0", CultureInfo.CurrentCulture);
            textbox_hillDistanceRequired.Text  = hillDistanceRequired.ToString("0.0#", CultureInfo.CurrentCulture);
            textBox_maxDescentElevation.Text   = maxDescentElevation.ToString("0", CultureInfo.CurrentCulture);
            textBox_maxDescentLength.Text      = maxDescentLength.ToString("0.0#", CultureInfo.CurrentCulture);
            textBox_minAvgGrade.Text           = minAvgGrade.ToString("0.00", CultureInfo.CurrentCulture);
        }
예제 #8
0
 public void ShowPage(string bookmark)
 {
     visible = true;
     PluginMain.GetApplication().ActiveView.PropertyChanged += new PropertyChangedEventHandler(ActiveView_PropertyChanged);
     View.ActiveReport.PropertyChanged += new PropertyChangedEventHandler(ActiveView_PropertyChanged);
     control.RefreshPage();
 }
예제 #9
0
 /// <summary>
 /// Called when exiting view.
 /// </summary>
 /// <returns></returns>
 public bool HidePage()
 {
     // Save any changes on settings exit
     PluginMain.GetApplication().PropertyChanged -= SportTracksApplication_PropertyChanged;
     pageLoaded = false;
     return(true);
 }
예제 #10
0
        private void ExtraChartsButton_Click(object sender, EventArgs e)
        {
            ListSettingsDialog listDialog = new ListSettingsDialog();
            ICollection <IListColumnDefinition> available = new List <IListColumnDefinition>();
            List <string> selected = new List <string>();

            // Define available and selected items
            foreach (CriticalLineDefinition line in GlobalSettings.Instance.CriticalPowerLines)
            {
                available.Add(new ColumnDefinition(line.Name, 100));

                if (line.Selected)
                {
                    selected.Add(line.Name);
                }
            }

            // Setup list selection dialog
            listDialog.AvailableColumns       = available;
            listDialog.SelectedColumns        = selected;
            listDialog.Text                   = CommonResources.Text.LabelCharts;
            listDialog.SelectedItemListLabel  = Resources.Strings.Label_SelectedCharts;
            listDialog.AddButtonLabel         = CommonResources.Text.ActionAdd;
            listDialog.AllowFixedColumnSelect = false;
            listDialog.AllowZeroSelected      = false;
            listDialog.Icon                   = Utilities.GetIcon(Images.Charts);
            listDialog.ThemeChanged(PluginMain.GetApplication().VisualTheme);

            // Popup list dialog
            if (listDialog.ShowDialog() == DialogResult.OK)
            {
                selected = listDialog.SelectedColumns as List <string>;

                // Save selected lines
                int countSelected = 0;
                foreach (CriticalLineDefinition line in GlobalSettings.Instance.CriticalPowerLines)
                {
                    // NOTE: Eval limitation: Number of charts
                    if (selected.Contains(line.Name))
                    {
                        countSelected++;
                        line.Selected = true;
                    }
                    else
                    {
                        line.Selected = false;
                    }
                }

                RefreshPage();
            }

            listDialog.Close();
            listDialog.Dispose();

            return;
        }
예제 #11
0
        public ActivityDataChangedHelper(IActivity activity)
        {
            Activity         = activity;
            m_CurrentLogbook = PluginMain.GetApplication().Logbook;

            PluginMain.GetApplication().SystemPreferences.PropertyChanged += new PropertyChangedEventHandler(OnSystemPreferencesPropertyChanged);
            PluginMain.GetApplication().PropertyChanged += new PropertyChangedEventHandler(AppPropertyChanged);
            GearChart.Common.Data.BikeSetupChanged += new GearChart.Common.Data.BikeSetupChangedEventHandler(OnGearChartBikeSetupChanged);
            RegisterCategoryCallback(PluginMain.GetApplication().Logbook);
        }
예제 #12
0
        private void AppPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e != null && e.PropertyName == "Logbook")
            {
                UnregisterCategoryCallback(m_CurrentLogbook);

                m_CurrentLogbook = PluginMain.GetApplication().Logbook;

                RegisterCategoryCallback(m_CurrentLogbook);
            }
        }
예제 #13
0
        /// <summary>
        /// Refresh the SportTracks Calendar with the selected activities
        /// </summary>
        /// <param name="activities">These activity dates will be highlighted on the calendar</param>
        public static void RefreshCalendar(IList <IActivity> activities)
        {
            IList <DateTime> dates = new List <DateTime>();

            foreach (IActivity activity in activities)
            {
                dates.Add(activity.StartTime.ToLocalTime().Date);
            }

            PluginMain.GetApplication().Calendar.SetHighlightedDates(dates);
        }
예제 #14
0
파일: Units.cs 프로젝트: tsofron/trails
 public static float GetElevation(double value, IActivity activity)
 {
     Length.Units du;
     if (activity != null)
     {
         du = activity.Category.ElevationUnits;
     }
     else
     {
         du = PluginMain.GetApplication().SystemPreferences.ElevationUnits;
     }
     return(GetLength(value, du));
 }
예제 #15
0
파일: Units.cs 프로젝트: tsofron/trails
 public static string GetDistanceLabel(IActivity activity)
 {
     Length.Units du;
     if (activity != null)
     {
         du = activity.Category.DistanceUnits;
     }
     else
     {
         du = PluginMain.GetApplication().SystemPreferences.DistanceUnits;
     }
     return(Length.LabelAbbr(du));
 }
예제 #16
0
파일: Units.cs 프로젝트: tsofron/trails
 public static double SetDistance(double value, IActivity activity)
 {
     Length.Units du;
     if (activity != null)
     {
         du = activity.Category.DistanceUnits;
     }
     else
     {
         du = PluginMain.GetApplication().SystemPreferences.DistanceUnits;
     }
     return(SetLength(value, du));
 }
예제 #17
0
        /// <summary>
        /// Get a Training Load related custom parameter
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public static ICustomDataFieldDefinition GetCustomProperty(CSCustomFields field)
        {
            // All data types so far are numbers
            ICustomDataFieldDefinition fieldDef = null;
            ICustomDataFieldDataType   dataType = CustomDataFieldDefinitions.StandardDataType(CustomDataFieldDefinitions.StandardDataTypes.NumberDataTypeId);
            ICustomDataFieldObjectType objType;

            Guid   id;
            string name;
            string options = "";

            switch (field)
            {
            case CSCustomFields.CourseScoreCycling:
                objType = CustomDataFieldDefinitions.StandardObjectType(typeof(IActivity));
                id      = GUIDs.customCSCycling;
                name    = Resources.Strings.Label_CourseScore
                          + ": " + Resources.Strings.Label_Cycling;
                fieldDef = GetCustomProperty(dataType, objType, id, name);
                options  = "2";
                break;

            case CSCustomFields.CourseScoreRunning:
                objType = CustomDataFieldDefinitions.StandardObjectType(typeof(IActivity));
                id      = GUIDs.customCSRunning;
                name    = Resources.Strings.Label_CourseScore
                          + ": " + Resources.Strings.Label_Running;
                fieldDef = GetCustomProperty(dataType, objType, id, name);
                break;

            case CSCustomFields.ScoreDistanceCycling:
                objType = CustomDataFieldDefinitions.StandardObjectType(typeof(IActivity));
                id      = GUIDs.customCSCyclingDistance;
                name    = Resources.Strings.Label_CourseScore + "/" +
                          Length.LabelAbbr(PluginMain.GetApplication().SystemPreferences.DistanceUnits)
                          + ": " + Resources.Strings.Label_Cycling;
                fieldDef = GetCustomProperty(dataType, objType, id, name);
                break;

            case CSCustomFields.ScoreDistanceRunning:
                objType = CustomDataFieldDefinitions.StandardObjectType(typeof(IActivity));
                id      = GUIDs.customCSRunningDistance;
                name    = Resources.Strings.Label_CourseScore + "/" +
                          Length.LabelAbbr(PluginMain.GetApplication().SystemPreferences.DistanceUnits)
                          + ": " + Resources.Strings.Label_Running;
                fieldDef = GetCustomProperty(dataType, objType, id, name);
                break;
            }

            return(fieldDef);
        }
예제 #18
0
파일: Units.cs 프로젝트: tsofron/trails
        public static string GetSpeedLabel(IActivity activity, Speed.Units kind)
        {
            string speedUnitLabel;

#if ST_2_1
            Length.Units du;
            if (activity != null)
            {
                du = activity.Category.DistanceUnits;
            }
            else
            {
                du = PluginMain.GetApplication().SystemPreferences.DistanceUnits;
            }
            if (kind == Speed.Units.Speed)
            {
                if (IsMetric(du))
                {
                    speedUnitLabel = CommonResources.Text.LabelKmPerHour;
                }
                else
                {
                    speedUnitLabel = CommonResources.Text.LabelMilePerHour;
                }
            }
            else
            {
                if (IsMetric(du))
                {
                    speedUnitLabel = CommonResources.Text.LabelMinPerKm;
                }
                else
                {
                    speedUnitLabel = CommonResources.Text.LabelMinPerMile;
                }
            }
#else
            Length du;
            if (activity != null)
            {
                du = activity.Category.SpeedDistance;
            }
            else
            {
                du = new Length(1, PluginMain.GetApplication().SystemPreferences.DistanceUnits);
            }
            speedUnitLabel = ZoneFiveSoftware.Common.Data.Measurement.Speed.Label(kind, du);
#endif
            return(speedUnitLabel);
        }
예제 #19
0
        private void ExtraChartsButton_Click(object sender, EventArgs e)
        {
            ListSettingsDialog listDialog = new ListSettingsDialog();
            ICollection <IListColumnDefinition> available = new List <IListColumnDefinition>();

            available.Add(new ColumnDefinition(ColumnDefinition.cadenceID, 100));
            available.Add(new ColumnDefinition(ColumnDefinition.gradeID, 100));
            available.Add(new ColumnDefinition(ColumnDefinition.hrID, 100));
            available.Add(new ColumnDefinition(ColumnDefinition.powerID, 100));

            List <string> selected = new List <string>();

            foreach (string id in GlobalSettings.Instance.ChartLines)
            {
                foreach (ColumnDefinition column in available)
                {
                    if (id == column.Id)
                    {
                        selected.Add(column.Id);
                        break;
                    }
                }
            }

            listDialog.AvailableColumns = available;
            listDialog.SelectedColumns  = selected;
            listDialog.Text             = CommonResources.Text.LabelCharts;

            listDialog.SelectedItemListLabel  = Resources.Strings.Label_SelectedCharts;
            listDialog.AddButtonLabel         = CommonResources.Text.ActionAdd;
            listDialog.AllowFixedColumnSelect = false;
            listDialog.AllowZeroSelected      = true;
            listDialog.Icon = Utilities.GetIcon(Images.Charts);

            listDialog.ThemeChanged(PluginMain.GetApplication().VisualTheme);

            if (listDialog.ShowDialog() == DialogResult.OK)
            {
                GlobalSettings.Instance.ChartLines = listDialog.SelectedColumns as List <string>;

                SetupSecondaryAxes(listDialog.SelectedColumns);

                RefreshPage();
            }

            listDialog.Close();
            listDialog.Dispose();

            return;
        }
예제 #20
0
        /// <summary>
        /// Called when entering view.
        /// </summary>
        /// <param name="bookmark">Currently unused</param>
        public void ShowPage(string bookmark)
        {
            // Populate page with the logbook data
            Options.LoadSettings();

            // Initialize some items only if this is not already the active view
            if (!pageLoaded)
            {
                PluginMain.GetApplication().PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SportTracksApplication_PropertyChanged);
            }

            this.control.RefreshPage();
            pageLoaded = true;
        }
예제 #21
0
        /// <summary>
        /// Called when entering view.
        /// </summary>
        /// <param name="bookmark">Currently unused</param>
        public void ShowPage(string bookmark)
        {
            // Populate page with the logbook data
            // TODO: Fix LoadSettings
            //UserData.LoadSettings();

            // Initialize some items only if this is not already the active view
            if (!pageLoaded)
            {
                PluginMain.GetApplication().PropertyChanged += SportTracksApplication_PropertyChanged;
            }

            this.control.RefreshPage();
            pageLoaded = true;
        }
예제 #22
0
파일: SaveImage.cs 프로젝트: mechgt/meanmax
        private void btnTypeOpen_Click(object sender, EventArgs e)
        {
            // Create TreeListPopup
            popup = new TreeListPopup();
            popup.ThemeChanged(PluginMain.GetApplication().VisualTheme);
            size = false; // Indicate this popup is for the type (not the size) control
            popup.Tree.Columns.Clear();
            popup.Tree.Columns.Add(new TreeList.Column());
            popup.Tree.RowData  = types;
            popup.ItemSelected += new TreeListPopup.ItemSelectedEventHandler(popup_ItemSelected);
            Rectangle rect = new Rectangle(txtType.Location, txtType.Size);

            rect.Offset(this.Location);
            rect.Offset(4, txtType.Height + 4);
            popup.Popup(rect);
        }
예제 #23
0
        //private static List<Feature> features = new List<Feature>();

        public HillsPointsLayer(IRouteControlLayerProvider provider, IRouteControl control)
            : base(provider, control, 1)
        {
            // HACK: This can't be the best way to get the reports Layer
            // There are 2 layers on the reports view and I don't know how to separate them
            if (PluginMain.GetApplication().ActiveView.Id == GUIDs.ActivityReportsView)
            {
                if (reportsLayer == null)
                {
                    reportsLayer = this;
                }
            }
            else if (PluginMain.GetApplication().ActiveView.Id == GUIDs.DailyActivityView)
            {
                dailyLayer = this;
            }
        }
예제 #24
0
 // TOOD: Not sure how to use this
 internal void UICultureChanged(CultureInfo culture)
 {
     lblElevReqd.Text     = Resources.Strings.Label_HillElevationRequired;
     lblDistReqd.Text     = Resources.Strings.Label_HillDistanceRequired;
     lblMaxDescent.Text   = Resources.Strings.Label_MaxDescentLength;
     lblMaxElevChg.Text   = Resources.Strings.Label_MaxDescentElevationChange;
     lblMinAvgGrade.Text  = Resources.Strings.Label_MinAvgGrade;
     lblElevPct.Text      = Resources.Strings.Label_ElevationPercent;
     lblDistPct.Text      = Resources.Strings.Label_DistancePercent;
     button_Defaults.Text = Resources.Strings.Label_Defaults;
     button_Ok.Text       = CommonResources.Text.ActionOk;
     button_Cancel.Text   = CommonResources.Text.ActionCancel;
     this.Text            = Resources.Strings.Label_HillFinderSettings;
     label_dist.Text      = Length.LabelAbbr(PluginMain.GetApplication().SystemPreferences.DistanceUnits);
     label_ele1.Text      = Length.LabelAbbr(PluginMain.GetApplication().SystemPreferences.ElevationUnits);
     label_ele.Text       = Length.LabelAbbr(PluginMain.GetApplication().SystemPreferences.ElevationUnits);
     label_dist1.Text     = Length.LabelAbbr(PluginMain.GetApplication().SystemPreferences.DistanceUnits);
 }
예제 #25
0
 private void OnSystemPreferencesPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (Activity != null)
     {
         if (e.PropertyName == "DistanceUnits" ||
             e.PropertyName == "ElevationUnits")
         {
             if (m_Activity.Category.UseSystemLengthUnits)
             {
                 TriggerPropertyChangedEvent(PluginMain.GetApplication().SystemPreferences, e.PropertyName);
             }
         }
         else
         {
             TriggerPropertyChangedEvent(sender, e.PropertyName);
         }
     }
 }
예제 #26
0
파일: Units.cs 프로젝트: mechgt/gear-chart
        public static string GetPaceUnitLabelForActivity(IActivity activity)
        {
            Length.Units du = PluginMain.GetApplication().SystemPreferences.DistanceUnits;
            if (activity != null)
            {
                du = activity.Category.DistanceUnits;
            }

            // TODO: Migration to ST3 - Localize speed String
            //string paceUnitLabel = CommonResources.Text.LabelMinPerKm;
            string paceUnitLabel = "km/hr";

            if (!IsMetric(du))
            {
                //paceUnitLabel = CommonResources.Text.LabelMinPerMile;
                paceUnitLabel = "min/mile";
            }
            return(paceUnitLabel);
        }
예제 #27
0
        public void DrawRoute(IActivity activity)
        {
            if (activity.GPSRoute != null)
            {
                List <IGPSPoint> points = new List <IGPSPoint>();
                for (int i = 0; i < activity.GPSRoute.Count; i++)
                {
                    GPSPoint p = (GPSPoint)activity.GPSRoute[i].Value;
                    points.Add(p);
                }

                MapPolyline newLine = new MapPolyline(points,
                                                      PluginMain.GetApplication().SystemPreferences.RouteSettings.RouteWidth,
                                                      PluginMain.GetApplication().SystemPreferences.RouteSettings.RouteColor);

                MapControl.AddOverlay(newLine);

                activityMapDrawn = true;
            }
        }
예제 #28
0
        public SelectChartsForm(List <DetailPaneChart.LineChartTypes> selectedCharts,
                                IActivity activity)
        {
            InitializeComponent();

            Graphics tempGraphics = this.CreateGraphics();

            this.Text = Resources.Strings.ChartDetails;

            MainPanel.ThemeChanged(PluginMain.GetApplication().VisualTheme);
            MainPanel.BackColor = PluginMain.GetApplication().VisualTheme.Control;

            AvailableChartLabel.Text    = Resources.Strings.Available;
            SelectedChartLabel.Text     = Resources.Strings.SelectedCharts;
            AvailableChartsList.Format += new ListControlConvertEventHandler(ChartsList_Format);
            DisplayedChartsList.Format += new ListControlConvertEventHandler(ChartsList_Format);
            AddChartButton.LeftImage    = CommonResources.Images.DocumentAdd16;
            AddChartButton.Text         = Resources.Strings.AddChart;
            MoveUpButton.LeftImage      = CommonResources.Images.MoveUp16;
            MoveDownButton.LeftImage    = CommonResources.Images.MoveDown16;
            RemoveChartButton.LeftImage = CommonResources.Images.Delete16;
            RemoveChartButton.Text      = CommonResources.Text.ActionRemove;

            OKButton.Text      = CommonResources.Text.ActionOk;
            Cancel_Button.Text = CommonResources.Text.ActionCancel;

            // Resize buttons for text, autosize doesn't work
            AddChartButton.Size    = tempGraphics.MeasureString(AddChartButton.Text, AddChartButton.Font).ToSize() + new Size(32, 0);       // Extra space for the image
            RemoveChartButton.Size = tempGraphics.MeasureString(RemoveChartButton.Text, RemoveChartButton.Font).ToSize() + new Size(32, 0); // Extra space for the image
            tempGraphics.Dispose();

            // Fill lists with current values
            m_SelectedCharts.Clear();
            m_SelectedCharts.AddRange(selectedCharts);

            m_Activity = activity;

            RefreshChartsList();
        }
예제 #29
0
        private void UpdateAxisStripes()
        {
            if (Activity != null && Options.Instance.ShowZonesInChart)
            {
                switch (YAxisReferential)
                {
                case LineChartTypes.Cadence:
                {
                    ShownZones = PluginMain.GetApplication().Logbook.CadenceZones[0];
                    break;
                }

                case LineChartTypes.HeartRateBPM:
                case LineChartTypes.HeartRatePercentMax:
                {
                    ShownZones = Activity.Category.HeartRateZone;
                    break;
                }

                case LineChartTypes.Power:
                {
                    ShownZones = PluginMain.GetApplication().Logbook.PowerZones[0];
                    break;
                }

                case LineChartTypes.Speed:
                {
                    ShownZones = Activity.Category.SpeedZone;
                    break;
                }
                }
            }

            if (MainChart != null)
            {
                SetupAxisStripes(MainChart.YAxis, YAxisReferential);
            }
        }
예제 #30
0
        /// <summary>
        /// Called when exiting view.
        /// </summary>
        /// <returns></returns>
        public bool HidePage()
        {
            // Save any changes on settings exit
            PluginMain.GetApplication().PropertyChanged -= SportTracksApplication_PropertyChanged;
            pageLoaded = false;

            // Update plugin component enabled status
            for (int i = 0; i < ExtendActions.RouteExportActions.Count; i++)
            {
                //ExtendActions.ActivityDetailPages[i].RefreshPage();
            }

            // Update plugin component enabled status
            for (int i = 0; i < ExtendActions.RouteExportActions.Count; i++)
            {
                ExtendActions.ActivityEditActions[i].Refresh();
            }

            // Update plugin component enabled status
            for (int i = 0; i < ExtendActions.RouteExportActions.Count; i++)
            {
                ExtendActions.ActivityExportActions[i].Refresh();
            }

            // Update plugin component enabled status
            for (int i = 0; i < ExtendActions.RouteExportActions.Count; i++)
            {
                ExtendActions.RouteEditActions[i].Refresh();
            }

            // Update plugin component enabled status
            for (int i = 0; i < ExtendActions.RouteExportActions.Count; i++)
            {
                ExtendActions.RouteExportActions[i].Refresh();
            }

            return(true);
        }