Esempio n. 1
0
        }                                                  // Sub scroller data

        /****************************************************************
         * Constructors
         **/
        public ActivityStatsData(
            EAct_Types p_type,
            ulong p_epoch   = 0, // seconds passed since 1/1/1970
            uint p_steps    = 0,
            uint p_distance = 0,
            uint p_calories = 0,
            uint p_altitude = 0
            )
        {
            this.EpochTime = p_epoch;
            this.Steps     = p_steps;
            this.Distance  = p_distance;
            this.Calories  = p_calories;
            this.Altitude  = p_altitude;
            this.ActType   = p_type;

            // Test print
            DateTime date = KreyosUtils.ToDateTime((long)p_epoch);

            KreyosUtils.Log("ActivityStatsData::Constructor", "epoch:" + p_epoch + " date:" + date + " epochDate:" + date.ToShortDateString());// date.ToShortDateString()

            // Add display values
            this.TxtTime     = date.Hour + ":" + date.Minute + date.ToString("tt").ToLower().Substring(0, 1); // Add am or pm after the minute value
            this.TxtActImage = ActivityStatsData.ActImage(p_type);
            this.TxtActTitle = ActivityStatsData.ActToString(p_type);

            this.Hour   = date.Hour;
            this.Minute = date.Minute;
            this.Second = date.Second;

            // display altitude values for cycling.
            // Hard coded D:
            if (this.ActType == EAct_Types.ECycling)
            {
                this.TxtItemTitle = "altitude";
                this.TxtItemValue = p_altitude.ToString();
            }
            else
            {
                this.TxtItemTitle = "calories";
                this.TxtItemValue = p_calories.ToString();
            }

            // Create sub scroller data
            this.Stats = new List <StatsData>();
            this.UpdateData();
        }
        public List<StatsData> Stats { get; private set; } // Sub scroller data

        /****************************************************************
         * Constructors
         **/
        public ActivityStatsData(
            EAct_Types p_type,
            ulong p_epoch = 0, // seconds passed since 1/1/1970
            uint p_steps = 0,
            uint p_distance = 0,
            uint p_calories = 0,
            uint p_altitude = 0
        )
        {
            this.EpochTime = p_epoch;
            this.Steps = p_steps;
            this.Distance = p_distance;
            this.Calories = p_calories;
            this.Altitude = p_altitude;
            this.ActType = p_type;

            // Test print
            DateTime date = KreyosUtils.ToDateTime((long)p_epoch);
            KreyosUtils.Log("ActivityStatsData::Constructor", "epoch:" + p_epoch + " date:" + date + " epochDate:" + date.ToShortDateString());// date.ToShortDateString()

            // Add display values
            this.TxtTime = date.Hour + ":" + date.Minute + date.ToString("tt").ToLower().Substring(0,1); // Add am or pm after the minute value
            this.TxtActImage = ActivityStatsData.ActImage(p_type);
            this.TxtActTitle = ActivityStatsData.ActToString(p_type);

            this.Hour = date.Hour;
            this.Minute = date.Minute;
            this.Second = date.Second;

            // display altitude values for cycling.
            // Hard coded D:
            if (this.ActType == EAct_Types.ECycling)
            {
                this.TxtItemTitle = "altitude";
                this.TxtItemValue = p_altitude.ToString();
            }
            else
            {
                this.TxtItemTitle = "calories";
                this.TxtItemValue = p_calories.ToString();
            }

            // Create sub scroller data
            this.Stats = new List<StatsData>();
            this.UpdateData();
        }
Esempio n. 3
0
        /// <summary>
        /// Returns any element at random index of the same 'p_type'.
        /// Note: Unused 'ST' template, it was added just to fix compiler errors.
        /// </summary>
        /// <param name="p_type"></param>
        /// <returns></returns>
        public ActivityStatsData GetAny(EAct_Types p_type)
        {
            if (this.Count <= 0)
            {
                return(null);
            }

            foreach (T cell in this)
            {
                ActivityStatsData c = (ActivityStatsData)Convert.ChangeType(cell, typeof(ActivityStatsData));
                if (c.ActType == p_type)
                {
                    return(c);
                }
            }

            return(null);
        }
Esempio n. 4
0
        /// <summary>
        /// Returns true if one of it's elements contains an action type 'p_type'
        /// </summary>
        /// <param name="p_type"></param>
        /// <returns></returns>
        public bool Contains(EAct_Types p_type)
        {
            if (this.Count <= 0)
            {
                return(false);
            }

            foreach (T cell in this)
            {
                ActivityStatsData c = (ActivityStatsData)Convert.ChangeType(cell, typeof(ActivityStatsData));
                if (c.ActType == p_type)
                {
                    return(true);
                }
            }

            return(false);
        }
 public static string ActImage (EAct_Types p_act)
 {
     return IMG_ACTIVITIES[(int)p_act];
 }
 /****************************************************************
  * Helpers
  **/
 public static string ActToString (EAct_Types p_act)
 {
     return ACTIVITYIES[(int)p_act];
 }
Esempio n. 7
0
 public static string ActImage(EAct_Types p_act)
 {
     return(IMG_ACTIVITIES[(int)p_act]);
 }
Esempio n. 8
0
 /****************************************************************
  * Helpers
  **/
 public static string ActToString(EAct_Types p_act)
 {
     return(ACTIVITYIES[(int)p_act]);
 }