Exemplo n.º 1
0
        /// <summary>
        /// Occurs each time the normalized power changes.  Allows for UI update by marshalling the call accordingly.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NormalizedPowerChangedEventHandler(object sender, NormalizedPower.NormalizedPowerChangedEventArgs e)
        {
            //if (!m_dispatcher.CheckAccess()) // are we currently on the UI thread?
            //{
            //    // We're not in the UI thread, ask the dispatcher to call this same method in the UI thread, then exit
            //    m_dispatcher.BeginInvoke(new NormalizedPowerChangedEventHandlerDelegate(NormalizedPowerChangedEventHandler), new object[] { sender, e });
            //    return;
            //}

            lock (this.lvOverall)
            {
                SummaryListViewItem listViewItem = m_summaryHelper.SummaryListViewItem;
                SummaryItem         summaryItem  = listViewItem.SummaryItem;


                if (m_currentUser.PowerThreshold > 0)
                {
                    summaryItem.If = Math.Round(e.NormalizedPower / (double)m_currentUser.PowerThreshold, 2).ToString("#.00");
                }
                else
                {
                    summaryItem.If = ".00";
                }

                summaryItem.Normalized = e.NormalizedPower.ToString();

                if (m_currentUser.WeightAsKgs > 0)
                {
                    summaryItem.NormalizedWkg = Math.Round(e.NormalizedPower / m_currentUser.WeightAsKgs, 2).ToString("#.00");
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Occurs each time the normalized power changes.  Allows for UI update by marshalling the call accordingly.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NormalizedPowerChangedEventHandler(object sender, NormalizedPower.NormalizedPowerChangedEventArgs e)
        {
            //if (!m_dispatcher.CheckAccess()) // are we currently on the UI thread?
            //{
            //    // We're not in the UI thread, ask the dispatcher to call this same method in the UI thread, then exit
            //    m_dispatcher.BeginInvoke(new NormalizedPowerChangedEventHandlerDelegate(NormalizedPowerChangedEventHandler), new object[] { sender, e });
            //    return;
            //}

            string intensityFactorStr  = "";
            string totalSufferScoreStr = "";
            string normalizedPowerStr;
            string normalizedWkgStr = "";

            if (e.IntensityFactor != null && e.TotalSufferScore != null)
            {
                intensityFactorStr  = e.IntensityFactor.Value.ToString("#.00");
                totalSufferScoreStr = e.TotalSufferScore.ToString();
            }

            normalizedPowerStr = e.NormalizedPower.ToString();

            if (CurrentUser.WeightAsKgs > 0)
            {
                normalizedWkgStr = Math.Round(e.NormalizedPower / CurrentUser.WeightAsKgs, 2).ToString("#.00");
            }

            this.UpdateSummaryNormalizedPower(intensityFactorStr, normalizedPowerStr, normalizedWkgStr, totalSufferScoreStr);
        }