示例#1
0
        public static void OnActivityMesg(object sender, MesgEventArgs e)
        {
            ActivityValues values = new ActivityValues();
            ActivityMesg   mesg   = (ActivityMesg)e.mesg;

            try
            {
                values._totalTimerTime = mesg.GetTotalTimerTime();
                values._numSessions    = mesg.GetNumSessions();
                values._type           = mesg.GetType();
                values._actiEvent      = mesg.GetEvent();
                values._eventType      = mesg.GetEventType();
                uint?localTimeStamp = mesg.GetLocalTimestamp();
                if (localTimeStamp != null)
                {
                    values._localTimestamp = FitConvert.ToDateTime(((uint)localTimeStamp));
                }

                //Make sure properties with sub properties arent null before trying to create objects based on them
                if (mesg.GetTimestamp() != null)
                {
                    //values.timestamp = new Dynastream.Fit.DateTime(mesg.GetTimestamp().GetTimeStamp());
                    uint tc = (uint)mesg.GetTimestamp().GetTimeStamp();
                    values._timestamp = FitConvert.ToLocalDateTime(mesg.GetTimestamp().GetTimeStamp());
                }
            }
            catch (FitException exception)
            {
                Console.WriteLine("\tOnFileIDMesg Error {0}", exception.Message);
                Console.WriteLine("\t{0}", exception.InnerException);
            }
            DataManager.Instance.ActivityValues.Add(values);
        }
示例#2
0
 public FitActivity(ActivityMesg msg)
 {
     Event          = msg.GetEvent();
     EventGroup     = msg.GetEventGroup();
     EventType      = msg.GetEventType();
     LocalTimestamp = msg.GetLocalTimestamp();
     NumSessions    = msg.GetNumSessions();
     Timestamp      = FitFile.GetDateTime(msg.GetTimestamp());
     TotalTimerTime = FitFile.GetTimeSpan(msg.GetTotalTimerTime());
     Type           = msg.GetType();
 }