當前位置: 首頁>>代碼示例>>C#>>正文


C# Activity.GetInfo方法代碼示例

本文整理匯總了C#中Activity.GetInfo方法的典型用法代碼示例。如果您正苦於以下問題:C# Activity.GetInfo方法的具體用法?C# Activity.GetInfo怎麽用?C# Activity.GetInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Activity的用法示例。


在下文中一共展示了Activity.GetInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Main

        static void Main(string[] args)
        {
            Activity act = new Activity();

            var filesInDir = Directory.GetFiles(dir);

            List<Files> fileList = new List<Files>();
            int i = 0;
            foreach (var file in filesInDir)
            {
                fileList.Add(
                    new Files(i, file)
                    );
                var path = fileList[i].Path;
                //var activity = new Activity();
                var infoList = act.GetInfo(path);
                var dateInfo = infoList[0].Id; //activity.LapList[0].StartTime;

                var shownPath = path.Replace(@"F:\___PORZĄDKI___Dysk_D\.Net Libraries\tcx\", "");
                Console.WriteLine(fileList[i].Index + " - " + dateInfo);
                i++;
            }

            Console.WriteLine("Which file you want to know better (nr)? ;");
            int answer = Convert.ToInt32(Console.ReadLine());
            string chosenPath = fileList[answer].Path;
            var visiblePath = chosenPath.Replace(@"F:\___PORZĄDKI___Dysk_D\.Net Libraries\tcx\", "");
            //var fullPath = chosenPath;
            Console.WriteLine(chosenPath);

            var activityList = act.GetInfo(exampleFile);//chosenPath);

            foreach (var item in activityList)
            {
                Console.WriteLine("sport: {0}",item.Sport);
                Console.WriteLine("id: {0}",item.Id);
                var laps = item.LapList;
                int j = 1;
                foreach (var el in laps)
                {
                    Console.WriteLine("- {0} km", j);
                    Console.WriteLine("   start: {0}", el.StartTime.ToLongTimeString());
                    //Console.WriteLine("   total sec: {0}", el.TotalSeconds);
                    Console.WriteLine("   distance: {0:F2}", el.Distance);
                    //Console.WriteLine("   calories: {0}", el.Calories);
                    Console.WriteLine("   avg HR: {0}", el.AvgHR);
                    Console.WriteLine("   max HR: {0}", el.MaxHR);
                    Console.WriteLine("   avg speed: {0:F2} km/h", el.AvgSpeed);
                    Console.WriteLine("   avg speed: {0:F2} m/s", 0.27778 * el.AvgSpeed);
                    Console.WriteLine();

                    j++;
                    //foreach (var track in tracks)
                    //{
                    //    Console.WriteLine(track.);
                    //}
                }
            }

            Console.ReadKey();
        }
開發者ID:pawel-stolka,項目名稱:Activities,代碼行數:61,代碼來源:Program.cs


注:本文中的Activity.GetInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。